free_page() in readpage?

From: Thomas Horsten (th@horsten.com)
Date: Wed May 03 2000 - 05:17:26 EST


Hi,

I'm updating a driver for a compressed flash file system from 2.0 to 2.2
kernel. I noticed something that puzzles me a bit while reading romfs's
readpage function. In the beginning of the function this is done:

        atomic_inc(&page->count);
        set_bit(PG_locked, &page->flags);
        buf = page_address(page);

Then the data is copied to (void *)buf. Finally,

        clear_bit(PG_locked, &page->flags);
        wake_up(&page->wait);
        free_page(buf);
        return result;

What puzzles me, is: why is the free_page() in the end, and the
atomic_inc(&page->count) at the top required? In the old (2.0) version
this was done differently.

Regards

Thomas Horsten
Thomas@Horsten.COM

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun May 07 2000 - 21:00:11 EST