Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fc0063c4 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Alex Elder
Browse files

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
parent c859cdd1
Loading
Loading
Loading
Loading
+15 −1
Original line number Original line Diff line number Diff line
@@ -149,6 +149,15 @@ xfs_ioend_new_eof(
	return isize > ip->i_d.di_size ? isize : 0;
	return isize > ip->i_d.di_size ? isize : 0;
}
}


/*
 * 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
 * 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
 * current in-memory file size is i_size.  If a write is beyond eof i_new_size
@@ -186,6 +195,9 @@ xfs_setfilesize(


/*
/*
 * Schedule IO completion handling on the final put of an ioend.
 * 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
STATIC void
xfs_finish_ioend(
xfs_finish_ioend(
@@ -194,8 +206,10 @@ xfs_finish_ioend(
	if (atomic_dec_and_test(&ioend->io_remaining)) {
	if (atomic_dec_and_test(&ioend->io_remaining)) {
		if (ioend->io_type == IO_UNWRITTEN)
		if (ioend->io_type == IO_UNWRITTEN)
			queue_work(xfsconvertd_workqueue, &ioend->io_work);
			queue_work(xfsconvertd_workqueue, &ioend->io_work);
		else
		else if (xfs_ioend_is_append(ioend))
			queue_work(xfsdatad_workqueue, &ioend->io_work);
			queue_work(xfsdatad_workqueue, &ioend->io_work);
		else
			xfs_destroy_ioend(ioend);
	}
	}
}
}