linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nick Piggin <npiggin@suse.de>
To: Jan Kara <jack@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-fsdevel@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [patch] fs: restore nobh
Date: Fri, 26 Oct 2007 00:49:41 +0200	[thread overview]
Message-ID: <20071025224941.GB6453@wotan.suse.de> (raw)
In-Reply-To: <20071025190736.GB12883@atrey.karlin.mff.cuni.cz>

On Thu, Oct 25, 2007 at 09:07:36PM +0200, Jan Kara wrote:
>   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?

Hmm, we might just be OK here because set_page_dirty should dirty the
buffers. However, I think you have spotted a mistake here and it would be
better if the generic_write_end test was outside the PageMapedToDisk
check.

Thanks!


  reply	other threads:[~2007-10-25 22:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-08  6:52 [patch] fs: restore nobh Nick Piggin
2007-10-25 18:36 ` Jan Kara
2007-10-25 19:07 ` Jan Kara
2007-10-25 22:49   ` Nick Piggin [this message]
2007-10-26 16:55     ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071025224941.GB6453@wotan.suse.de \
    --to=npiggin@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).