From: Eric Sandeen <sandeen@sandeen.net>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 3/5] xfs: make inodes dirty before issuing I/O
Date: Sun, 10 May 2009 13:02:16 -0500 [thread overview]
Message-ID: <4A0716A8.1040108@sandeen.net> (raw)
In-Reply-To: <20090426140707.884922000@bombadil.infradead.org>
Christoph Hellwig wrote:
> To make sure they get properly waited on in sync when I/O is in flight and
> we latter need to update the inode size.
>
maybe mention the new helper in the changelog just for completeness...
>
> Index: linux-2.6/fs/xfs/linux-2.6/xfs_aops.c
> ===================================================================
> --- linux-2.6.orig/fs/xfs/linux-2.6/xfs_aops.c 2009-04-26 10:33:05.556127371 +0200
> +++ linux-2.6/fs/xfs/linux-2.6/xfs_aops.c 2009-04-26 10:37:23.137953826 +0200
> @@ -186,19 +186,37 @@ xfs_destroy_ioend(
> }
>
> /*
> + * If the end of the current ioend is beyond the current EOF,
> + * return the new EOF value, otherwise zero.
> + */
> +STATIC xfs_fsize_t
> +xfs_ioend_new_eof(
> + xfs_ioend_t *ioend)
> +{
> + xfs_inode_t *ip = XFS_I(ioend->io_inode);
> + xfs_fsize_t isize;
> + xfs_fsize_t bsize;
> +
> + bsize = ioend->io_offset + ioend->io_size;
> + isize = MAX(ip->i_size, ip->i_new_size);
> + isize = MIN(isize, bsize);
> + return isize > ip->i_d.di_size ? isize : 0;
> +}
> +
> +/*
> * Update on-disk file size now that data has been written to disk.
> * The current in-memory file size is i_size. If a write is beyond
> * eof i_new_size will be the intended file size until i_size is
> * updated. If this write does not extend all the way to the valid
> * file size then restrict this update to the end of the write.
> */
> +
> STATIC void
> xfs_setfilesize(
> xfs_ioend_t *ioend)
> {
> xfs_inode_t *ip = XFS_I(ioend->io_inode);
> xfs_fsize_t isize;
> - xfs_fsize_t bsize;
>
> ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFREG);
> ASSERT(ioend->io_type != IOMAP_READ);
> @@ -206,14 +224,9 @@ xfs_setfilesize(
> if (unlikely(ioend->io_error))
> return;
>
> - bsize = ioend->io_offset + ioend->io_size;
> -
> xfs_ilock(ip, XFS_ILOCK_EXCL);
> -
> - isize = MAX(ip->i_size, ip->i_new_size);
> - isize = MIN(isize, bsize);
> -
> - if (ip->i_d.di_size < isize) {
> + isize = xfs_ioend_new_eof(ioend);
> + if (isize) {
It strikes me as a little odd to potentially get back "isize == 0" here
when nothing about the size is 0. Would it make more sense to rename
this variable to "new_isize" or something?
> ip->i_d.di_size = isize;
> ip->i_update_core = 1;
> ip->i_update_size = 1;
> @@ -405,10 +418,16 @@ xfs_submit_ioend_bio(
> struct bio *bio)
> {
> atomic_inc(&ioend->io_remaining);
> -
> bio->bi_private = ioend;
> bio->bi_end_io = xfs_end_bio;
>
> + /*
> + * if the I/O is beyond EOF we mark the inode dirty immediately
^If (uber-nitpick, in akpm-mode today I guess!)
> + * but don't update the inode size until I/O completion.
> + */
Maybe extend this comment a bit to say -why- you are doing this, not
just -what- you are doing?
> + if (xfs_ioend_new_eof(ioend))
> + xfs_mark_inode_dirty_sync(XFS_I(ioend->io_inode));
> +
> submit_bio(WRITE, bio);
> ASSERT(!bio_flagged(bio, BIO_EOPNOTSUPP));
> bio_put(bio);
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2009-05-10 18:02 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-26 14:03 [PATCH 0/5] fix sync (test 182, grub) Christoph Hellwig
2009-04-26 14:03 ` [PATCH 1/5] xfs: remove ->write_super and stop maintaining ->s_dirt Christoph Hellwig
2009-05-10 16:25 ` Eric Sandeen
2009-05-10 16:30 ` Eric Sandeen
2009-05-10 17:37 ` Eric Sandeen
2009-04-26 14:03 ` [PATCH 2/5] xfs: cleanup ->sync_fs Christoph Hellwig
2009-05-10 17:51 ` Eric Sandeen
2009-05-11 20:11 ` Christoph Hellwig
2009-04-26 14:03 ` [PATCH 3/5] xfs: make inodes dirty before issuing I/O Christoph Hellwig
2009-05-10 18:02 ` Eric Sandeen [this message]
2009-04-26 14:03 ` [PATCH 4/5] xfs: make sure xfs_sync_fsdata covers the log Christoph Hellwig
2009-05-10 18:29 ` Eric Sandeen
2009-04-26 14:03 ` [PATCH 5/5] xfs: fix xfs_quiesce_data Christoph Hellwig
2009-05-10 18:37 ` Eric Sandeen
2009-05-11 20:15 ` Christoph Hellwig
2009-06-04 9:45 ` Dave Chinner
2009-06-05 10:41 ` Christoph Hellwig
2009-05-06 9:33 ` [PATCH 0/5] fix sync (test 182, grub) Christoph Hellwig
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=4A0716A8.1040108@sandeen.net \
--to=sandeen@sandeen.net \
--cc=hch@infradead.org \
--cc=xfs@oss.sgi.com \
/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