aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_file.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2011-09-19 10:55:51 -0400
committerAlex Elder <aelder@sgi.com>2011-10-11 22:15:08 -0400
commitb10370585349d364ff3c550afa7922e6e21f029d (patch)
tree23996ee7961fc5595d72c5e149a4250c444356f4 /fs/xfs/xfs_file.c
parent815cb21662b914e1e14c256a3d662b1352c8509e (diff)
xfs: unlock the inode before log force in xfs_fsync
Only read the LSN we need to push to with the ilock held, and then release it before we do the log force to improve concurrency. This also removes the only direct caller of _xfs_trans_commit, thus allowing it to be merged into the plain xfs_trans_commit again. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_file.c')
-rw-r--r--fs/xfs/xfs_file.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 558543c146b3..d8ef02eb178a 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -137,6 +137,7 @@ xfs_file_fsync(
137 struct xfs_trans *tp; 137 struct xfs_trans *tp;
138 int error = 0; 138 int error = 0;
139 int log_flushed = 0; 139 int log_flushed = 0;
140 xfs_lsn_t lsn = 0;
140 141
141 trace_xfs_file_fsync(ip); 142 trace_xfs_file_fsync(ip);
142 143
@@ -214,9 +215,9 @@ xfs_file_fsync(
214 */ 215 */
215 xfs_trans_ijoin(tp, ip); 216 xfs_trans_ijoin(tp, ip);
216 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); 217 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
217 xfs_trans_set_sync(tp); 218 error = xfs_trans_commit(tp, 0);
218 error = _xfs_trans_commit(tp, 0, &log_flushed);
219 219
220 lsn = ip->i_itemp->ili_last_lsn;
220 xfs_iunlock(ip, XFS_ILOCK_EXCL); 221 xfs_iunlock(ip, XFS_ILOCK_EXCL);
221 } else { 222 } else {
222 /* 223 /*
@@ -227,14 +228,14 @@ xfs_file_fsync(
227 * disk yet, the inode will be still be pinned. If it is, 228 * disk yet, the inode will be still be pinned. If it is,
228 * force the log. 229 * force the log.
229 */ 230 */
230 if (xfs_ipincount(ip)) { 231 if (xfs_ipincount(ip))
231 error = _xfs_log_force_lsn(mp, 232 lsn = ip->i_itemp->ili_last_lsn;
232 ip->i_itemp->ili_last_lsn,
233 XFS_LOG_SYNC, &log_flushed);
234 }
235 xfs_iunlock(ip, XFS_ILOCK_SHARED); 233 xfs_iunlock(ip, XFS_ILOCK_SHARED);
236 } 234 }
237 235
236 if (!error && lsn)
237 error = _xfs_log_force_lsn(mp, lsn, XFS_LOG_SYNC, &log_flushed);
238
238 /* 239 /*
239 * If we only have a single device, and the log force about was 240 * If we only have a single device, and the log force about was
240 * a no-op we might have to flush the data device cache here. 241 * a no-op we might have to flush the data device cache here.