Skip to content

Commit

Permalink
xfs: don't bother looking at the refcount tree for reads
Browse files Browse the repository at this point in the history
There is no need to trim an extent into a shared or non-shared one, or
report any flags for plain old reads.

Signed-off-by: Christoph Hellwig <[email protected]>
Reviewed-by: Darrick J. Wong <[email protected]>
Reviewed-by: Brian Foster <[email protected]>
Signed-off-by: Dave Chinner <[email protected]>
  • Loading branch information
Christoph Hellwig authored and dchinner committed Oct 20, 2016
1 parent 62c5ac8 commit 5f9268c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions fs/xfs/xfs_iomap.c
Original file line number Diff line number Diff line change
Expand Up @@ -996,11 +996,14 @@ xfs_file_iomap_begin(
return error;
}

/* Trim the mapping to the nearest shared extent boundary. */
error = xfs_reflink_trim_around_shared(ip, &imap, &shared, &trimmed);
if (error) {
xfs_iunlock(ip, lockmode);
return error;
if (flags & (IOMAP_WRITE | IOMAP_ZERO | IOMAP_REPORT)) {
/* Trim the mapping to the nearest shared extent boundary. */
error = xfs_reflink_trim_around_shared(ip, &imap, &shared,
&trimmed);
if (error) {
xfs_iunlock(ip, lockmode);
return error;
}
}

if ((flags & IOMAP_WRITE) && imap_needs_alloc(inode, &imap, nimaps)) {
Expand Down

0 comments on commit 5f9268c

Please sign in to comment.