aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_aops.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2011-08-23 04:28:11 -0400
committerAlex Elder <aelder@sgi.com>2011-10-11 22:15:00 -0400
commitfc0063c4474599b7a066ba76b90902abe21bc675 (patch)
tree9b402cb8337cbfb231627494e85fda32256fad19 /fs/xfs/xfs_aops.c
parentc859cdd1da008b3825555be3242908088a3de366 (diff)
xfs: reduce ioend latency
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> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_aops.c')
-rw-r--r--fs/xfs/xfs_aops.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 10660c364105..e1ff0770784e 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -150,6 +150,15 @@ xfs_ioend_new_eof(
150} 150}
151 151
152/* 152/*
153 * Fast and loose check if this write could update the on-disk inode size.
154 */
155static inline bool xfs_ioend_is_append(struct xfs_ioend *ioend)
156{
157 return ioend->io_offset + ioend->io_size >
158 XFS_I(ioend->io_inode)->i_d.di_size;
159}
160
161/*
153 * Update on-disk file size now that data has been written to disk. The 162 * Update on-disk file size now that data has been written to disk. The
154 * current in-memory file size is i_size. If a write is beyond eof i_new_size 163 * current in-memory file size is i_size. If a write is beyond eof i_new_size
155 * will be the intended file size until i_size is updated. If this write does 164 * will be the intended file size until i_size is updated. If this write does
@@ -186,6 +195,9 @@ xfs_setfilesize(
186 195
187/* 196/*
188 * Schedule IO completion handling on the final put of an ioend. 197 * Schedule IO completion handling on the final put of an ioend.
198 *
199 * If there is no work to do we might as well call it a day and free the
200 * ioend right now.
189 */ 201 */
190STATIC void 202STATIC void
191xfs_finish_ioend( 203xfs_finish_ioend(
@@ -194,8 +206,10 @@ xfs_finish_ioend(
194 if (atomic_dec_and_test(&ioend->io_remaining)) { 206 if (atomic_dec_and_test(&ioend->io_remaining)) {
195 if (ioend->io_type == IO_UNWRITTEN) 207 if (ioend->io_type == IO_UNWRITTEN)
196 queue_work(xfsconvertd_workqueue, &ioend->io_work); 208 queue_work(xfsconvertd_workqueue, &ioend->io_work);
197 else 209 else if (xfs_ioend_is_append(ioend))
198 queue_work(xfsdatad_workqueue, &ioend->io_work); 210 queue_work(xfsdatad_workqueue, &ioend->io_work);
211 else
212 xfs_destroy_ioend(ioend);
199 } 213 }
200} 214}
201 215