Commit 307cdb54 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Darrick J. Wong

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent 88cdb714
...@@ -150,30 +150,24 @@ xfs_fs_map_blocks( ...@@ -150,30 +150,24 @@ xfs_fs_map_blocks(
ASSERT(!nimaps || imap.br_startblock != DELAYSTARTBLOCK); ASSERT(!nimaps || imap.br_startblock != DELAYSTARTBLOCK);
if (write) { if (write && (!nimaps || imap.br_startblock == HOLESTARTBLOCK)) {
enum xfs_prealloc_flags flags = 0; /*
* xfs_iomap_write_direct() expects to take ownership of the
if (!nimaps || imap.br_startblock == HOLESTARTBLOCK) { * shared ilock.
/* */
* xfs_iomap_write_direct() expects to take ownership of xfs_ilock(ip, XFS_ILOCK_SHARED);
* the shared ilock. error = xfs_iomap_write_direct(ip, offset, length, &imap,
*/ nimaps);
xfs_ilock(ip, XFS_ILOCK_SHARED); if (error)
error = xfs_iomap_write_direct(ip, offset, length, goto out_unlock;
&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.
* Ensure the next transaction is committed */
* synchronously so that the blocks allocated and error = xfs_update_prealloc_flags(ip,
* handed out to the client are guaranteed to be XFS_PREALLOC_SET | XFS_PREALLOC_SYNC);
* present even after a server crash.
*/
flags |= XFS_PREALLOC_SET | XFS_PREALLOC_SYNC;
}
error = xfs_update_prealloc_flags(ip, flags);
if (error) if (error)
goto out_unlock; goto out_unlock;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment