linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Chris Mason <chris.mason@oracle.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Theodore Ts'o <tytso@mit.edu>,
	Linux Kernel Developers List <linux-kernel@vger.kernel.org>,
	Ext4 Developers List <linux-ext4@vger.kernel.org>,
	Mike Galbraith <efault@gmx.de>
Subject: Re: [PATCH RFC] ext3 data=guarded v7
Date: Thu, 30 Apr 2009 13:52:07 +0200	[thread overview]
Message-ID: <20090430115207.GD29220@duck.suse.cz> (raw)
In-Reply-To: <1241038424.20099.74.camel@think.oraclecorp.com>

On Wed 29-04-09 16:53:44, Chris Mason wrote:
...
> +static int ext3_guarded_write_end(struct file *file,
> +				struct address_space *mapping,
> +				loff_t pos, unsigned len, unsigned copied,
> +				struct page *page, void *fsdata)
> +{
> +	handle_t *handle = ext3_journal_current_handle();
> +	struct inode *inode = file->f_mapping->host;
> +	unsigned from, to;
> +	int ret = 0, ret2;
> +
> +	copied = block_write_end(file, mapping, pos, len, copied,
> +				 page, fsdata);
> +
> +	from = pos & (PAGE_CACHE_SIZE - 1);
> +	to = from + copied;
> +	ret = walk_page_buffers(handle, page_buffers(page),
> +		from, to, NULL, journal_dirty_data_guarded_fn);
> +
> +	/*
> +	 * we only update the in-memory i_size.  The disk i_size is done
> +	 * by the end io handlers
> +	 */
> +	if (ret == 0 && pos + copied > inode->i_size) {
> +		int must_log;
> +
> +		/* updated i_size, but we may have raced with a
> +		 * data=guarded end_io handler.
> +		 *
> +		 * All the guarded IO could have ended while i_size was still
> +		 * small, and if we're just adding bytes into an existing block
> +		 * in the file, we may not be adding a new guarded IO with this
> +		 * write.  So, do a check on the disk i_size and make sure it
> +		 * is updated to the highest safe value.
> +		 *
> +		 * This may also be required if the
> +		 * journal_dirty_data_guarded_fn chose to do an fully
> +		 * ordered write of this buffer instead of a guarded
> +		 * write.
> +		 *
> +		 * ext3_ordered_update_i_size tests inode->i_size, so we
> +		 * make sure to update it with the ordered lock held.
> +		 */
> +		ext3_ordered_lock(inode);
> +		i_size_write(inode, pos + copied);
> +		must_log = ext3_ordered_update_i_size(inode);
> +		ext3_ordered_unlock(inode);
> +
> +		orphan_del_trans(inode, must_log > 0);
> +	}
  Didn't we agree that only "i_size_write" should remain from the above
"if" after you changed journal_dirty_data_guarded_fn() function?

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  reply	other threads:[~2009-04-30 11:52 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-28 18:04 [PATCH RFC] ext3 data=guarded v5 Chris Mason
2009-04-28 18:33 ` Mike Galbraith
2009-04-28 18:54   ` Chris Mason
2009-04-29  2:12 ` KOSAKI Motohiro
2009-04-29  8:56 ` Jan Kara
2009-04-29 14:08   ` Chris Mason
2009-04-29 14:43     ` Chris Mason
2009-04-29 19:47       ` Andreas Dilger
2009-04-29 19:15     ` Jan Kara
2009-04-29 19:41       ` Chris Mason
2009-04-29 20:04         ` Jan Kara
2009-04-29 20:37           ` Chris Mason
2009-04-30 11:38             ` Jan Kara
2009-04-29 21:53         ` Theodore Tso
2009-04-29 19:51 ` [PATCH RFC] ext3 data=guarded v6 Chris Mason
2009-04-29 20:21   ` Jan Kara
2009-04-29 20:53   ` [PATCH RFC] ext3 data=guarded v7 Chris Mason
2009-04-30 11:52     ` Jan Kara [this message]
2009-04-30 13:17       ` Chris Mason

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=20090430115207.GD29220@duck.suse.cz \
    --to=jack@suse.cz \
    --cc=chris.mason@oracle.com \
    --cc=efault@gmx.de \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    /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).