Re: [patch] fs: restore nobh

From: Jan Kara
Date: Thu Oct 25 2007 - 15:07:52 EST


Hi,

> This is overdue, sorry. Got a little complicated, and I've been away from
> my filesystem test setup so I didn't want ot send it (lucky, coz I found
> a bug after more substantial testing).
>
> Anyway, RFC?
Hmm, maybe one comment/question:

> Index: linux-2.6/fs/buffer.c
> ===================================================================
> --- linux-2.6.orig/fs/buffer.c 2007-10-08 14:09:35.000000000 +1000
> +++ linux-2.6/fs/buffer.c 2007-10-08 16:45:28.000000000 +1000
...

> -/*
> - * Make sure any changes to nobh_commit_write() are reflected in
> - * nobh_truncate_page(), since it doesn't call commit_write().
> - */
> -int nobh_commit_write(struct file *file, struct page *page,
> - unsigned from, unsigned to)
> +int nobh_write_end(struct file *file, struct address_space *mapping,
> + loff_t pos, unsigned len, unsigned copied,
> + struct page *page, void *fsdata)
> {
> struct inode *inode = page->mapping->host;
> - loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
> + struct buffer_head *head = NULL;
> + struct buffer_head *bh;
>
> - if (page_has_buffers(page))
> - return generic_commit_write(file, page, from, to);
> + if (!PageMappedToDisk(page)) {
> + if (unlikely(copied < len) && !page_has_buffers(page))
> + attach_nobh_buffers(page, head);
> + if (page_has_buffers(page))
> + return generic_write_end(file, mapping, pos, len, copied, page, fsdata);
> + }
So we can have a page with attached buffers but we decide to not call
generic_write_end()...

> SetPageUptodate(page);
> set_page_dirty(page);
And we just set the page dirty but we leave buffers clean. So cannot
subsequent try_to_free_buffers() come, mark page as clean (as buffers
are clean) and discard the data?

Honza
--
Jan Kara <jack@xxxxxxx>
SuSE CR Labs
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/