summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_pnfs.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2019-10-30 12:24:58 -0700
committerDarrick J. Wong <darrick.wong@oracle.com>2019-11-03 10:22:30 -0800
commit307cdb54b80e036978b7b717abcbcfdac0b34e38 (patch)
treefa05be76a421b431b98530f9d694fed55ca2ad0d /fs/xfs/xfs_pnfs.c
parent88cdb7147b21b2d8b4bd3f3d95ce0bffd73e1ac3 (diff)
xfs: don't log the inode in xfs_fs_map_blocks if it
Even if we are asked for a write layout there is no point in logging the inode unless we actually modified it in some way. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/xfs_pnfs.c')
-rw-r--r--fs/xfs/xfs_pnfs.c42
1 files changed, 18 insertions, 24 deletions
diff --git a/fs/xfs/xfs_pnfs.c b/fs/xfs/xfs_pnfs.c
index 3634ffff3b07..ada46e9f5ff1 100644
--- a/fs/xfs/xfs_pnfs.c
+++ b/fs/xfs/xfs_pnfs.c
@@ -150,30 +150,24 @@ xfs_fs_map_blocks(
ASSERT(!nimaps || imap.br_startblock != DELAYSTARTBLOCK);
- if (write) {
- enum xfs_prealloc_flags flags = 0;
-
- if (!nimaps || imap.br_startblock == HOLESTARTBLOCK) {
- /*
- * xfs_iomap_write_direct() expects to take ownership of
- * the shared ilock.
- */
- xfs_ilock(ip, XFS_ILOCK_SHARED);
- error = xfs_iomap_write_direct(ip, offset, length,
- &imap, nimaps);
- if (error)
- goto out_unlock;
-
- /*
- * Ensure the next transaction is committed
- * synchronously so that the blocks allocated and
- * handed out to the client are guaranteed to be
- * present even after a server crash.
- */
- flags |= XFS_PREALLOC_SET | XFS_PREALLOC_SYNC;
- }
-
- error = xfs_update_prealloc_flags(ip, flags);
+ if (write && (!nimaps || imap.br_startblock == HOLESTARTBLOCK)) {
+ /*
+ * xfs_iomap_write_direct() expects to take ownership of the
+ * shared ilock.
+ */
+ xfs_ilock(ip, XFS_ILOCK_SHARED);
+ error = xfs_iomap_write_direct(ip, offset, length, &imap,
+ nimaps);
+ if (error)
+ goto out_unlock;
+
+ /*
+ * Ensure the next transaction is committed synchronously so
+ * that the blocks allocated and handed out to the client are
+ * guaranteed to be present even after a server crash.
+ */
+ error = xfs_update_prealloc_flags(ip,
+ XFS_PREALLOC_SET | XFS_PREALLOC_SYNC);
if (error)
goto out_unlock;
}