Re: tmpfs + sendfile bug ?

From: Linus Torvalds (torvalds@transmeta.com)
Date: Mon May 21 2001 - 17:01:05 EST


In article <m3bsomwsgs.fsf@linux.local>, Christoph Rohland <cr@sap.com> wrote:
>
>tmpfs does not provide the necessary functions for sendfile and lo:
>readpage, prepare_write and commitwrite.
>
>And I do not see a way how to provide readpage in tmpfs :-(

Why not just do it the same way ramfs does?

If you don't have any backing store, you know that the page is empty. If
you _do_ have backing store, a readpage() won't be called. Ergo:

        static int ramfs_readpage(struct file *file, struct page * page)
        {
                if (!Page_Uptodate(page)) {
                        memset(kmap(page), 0, PAGE_CACHE_SIZE);
                        kunmap(page);
                        flush_dcache_page(page);
                        SetPageUptodate(page);
                }
                UnlockPage(page);
                return 0;
        }

while the writepage ones just do a "SetPageDirty(page)" (with
prepare_write() needing to do the same "Page_Uptodate()" checks to see
if we need to clear stuff first).

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



This archive was generated by hypermail 2b29 : Wed May 23 2001 - 21:00:44 EST