public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 3/5] xfs: reduce ioend latency
Date: Mon, 22 Aug 2011 16:43:45 +1000	[thread overview]
Message-ID: <20110822064345.GM3162@dastard> (raw)
In-Reply-To: <20110814222518.001177781@bombadil.infradead.org>

On Sun, Aug 14, 2011 at 06:24:15PM -0400, Christoph Hellwig wrote:
> There is no reason to queue up ioends for processing in user context
> unless we actually need it.  Just complete ioends that do not convert
> unwritten extents or need a size update from the end_io context.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> Index: xfs/fs/xfs/xfs_aops.c
> ===================================================================
> --- xfs.orig/fs/xfs/xfs_aops.c	2011-08-13 10:57:57.559366326 -0700
> +++ xfs/fs/xfs/xfs_aops.c	2011-08-13 10:57:57.979364052 -0700
> @@ -150,6 +150,15 @@ xfs_ioend_new_eof(
>  }
>  
>  /*
> + * Fast and loose check if this write could update the on-disk inode size.
> + */
> +static inline bool xfs_ioend_is_append(struct xfs_ioend *ioend)
> +{
> +	return ioend->io_offset + ioend->io_size >
> +		XFS_I(ioend->io_inode)->i_d.di_size;
> +}
> +
> +/*
>   * 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
> @@ -186,6 +195,9 @@ xfs_setfilesize(
>  
>  /*
>   * Schedule IO completion handling on the final put of an ioend.
> + *
> + * If there is no work to do we might as well call it a day and free the
> + * ioend right now.
>   */
>  STATIC void
>  xfs_finish_ioend(
> @@ -194,8 +206,10 @@ xfs_finish_ioend(
>  	if (atomic_dec_and_test(&ioend->io_remaining)) {
>  		if (ioend->io_type == IO_UNWRITTEN)
>  			queue_work(xfsconvertd_workqueue, &ioend->io_work);
> -		else
> +		else if (xfs_ioend_is_append(ioend))
>  			queue_work(xfsdatad_workqueue, &ioend->io_work);
> +		else
> +			xfs_destroy_ioend(ioend);
>  	}
>  }

That's similar to a check I added in a previous patch series to
avoid taking the ILOCK in IO completion if it wasn't necessary. THis
just checks earlier to avoid the workqueue switch, so it definitely
better than what I did.

Reviewed-by: Dave Chinner <dchinner@redhat.com>

-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2011-08-22  6:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-14 22:24 [PATCH 0/5] simply and speedup I/O completion handling Christoph Hellwig
2011-08-14 22:24 ` [PATCH 1/5] xfs: remove dead ENODEV handling in xfs_destroy_ioend Christoph Hellwig
2011-08-22  6:32   ` Dave Chinner
2011-08-22 14:27     ` Christoph Hellwig
2011-08-14 22:24 ` [PATCH 2/5] xfs: defer AIO/DIO completions Christoph Hellwig
2011-08-22  6:40   ` Dave Chinner
2011-08-22 14:28     ` Christoph Hellwig
2011-08-14 22:24 ` [PATCH 3/5] xfs: reduce ioend latency Christoph Hellwig
2011-08-22  6:43   ` Dave Chinner [this message]
2011-08-22 14:29     ` Christoph Hellwig
2011-08-14 22:24 ` [PATCH 4/5] xfs: wait for I/O completion when writing out pages in xfs_setattr_size Christoph Hellwig
2011-08-22  6:44   ` Dave Chinner
2011-08-14 22:24 ` [PATCH 5/5] xfs: remove i_iocount Christoph Hellwig
2011-08-22  6:46   ` Dave Chinner

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=20110822064345.GM3162@dastard \
    --to=david@fromorbit.com \
    --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