Re: The INN/mmap bug

From: Linus Torvalds (torvalds@transmeta.com)
Date: Sun Sep 17 2000 - 23:46:33 EST


On Mon, 18 Sep 2000, Alexander Viro wrote:
>
> We might as well do it in create_empty_buffers(), FWIW. Do you see any
> case when it would mean extra work? I'm thinking about the following:
>
> if (page is uptodate)
> do get_block(...,0) for all buffers and mark them uptodate
>
> in the end of buffer-ring creation. Comments?

The above _will_ cause extra work, notably for the case of writing to a
hole (first create_empty_buffers() will do the get_block( .., 0) and get a
zero, then the writing will do a get_block( .., 1) to actually allocate
the block.

We could push the "create" thing into create_empty_buffers(), though. We'd
give it a "begin,end" the way writing wants, and a reader (or truncate)
would just pass in 0,0.

Hmmm.. I like that approach - because I suspect that eventually we want to
change the FS mapping function away from the current buffer-based one, and
make it a page-based one to let the low-level filesystem handle the tail
etc issues itself.

And when we do that, we'd have to pass in that "I'm going to want to dirty
this range" information anyway, and the current "create_empty_buffers()"
would in fact become the new "map this page, please" function.

At that point, block_write_full_page() would become something like

        unsigned long index = inode->i_size >> PAGE_CACHE_SHIFT;

        offset = inode->i_size & (PAGE_CACHE_SIZE-1);
        if (index > page->index)
                offset = PAGE_CACHE_SIZE;

        create_empty_buffers(page, 0, offset);
        for_each_buffer(page) {
                if (buffer_mapped(bh))
                        mark_buffer_dirty(bh);
        }

which would certainly be simpler than the current code. Hmm.

                Linus

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



This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 21:00:16 EST