linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs: Don't trim extents for fiemap
@ 2017-11-23  8:06 Nikolay Borisov
  2017-11-23  8:15 ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Nikolay Borisov @ 2017-11-23  8:06 UTC (permalink / raw)
  To: linux-xfs; +Cc: sandeen, darrick.wong, Nikolay Borisov

For file extents xfs currently always calls xfs_bmapi_read with not flags,
meaning extents are going to be truncated to the requested range. This is
differs than what other filesystems do (ext4/btrfs don't trim extents). So
harmonize the behavior across the filesystem by explicitly not trimming
extents when we are called from fiemap code.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/xfs/xfs_iomap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index f179bdf1644d..129550fbf898 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -1008,7 +1008,8 @@ xfs_file_iomap_begin(
 	end_fsb = XFS_B_TO_FSB(mp, offset + length);
 
 	error = xfs_bmapi_read(ip, offset_fsb, end_fsb - offset_fsb, &imap,
-			       &nimaps, 0);
+			       &nimaps,
+			       flags & IOMAP_REPORT ? XFS_BMAPI_ENTIRE : 0);
 	if (error)
 		goto out_unlock;
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] xfs: Don't trim extents for fiemap
  2017-11-23  8:06 [PATCH] xfs: Don't trim extents for fiemap Nikolay Borisov
@ 2017-11-23  8:15 ` Christoph Hellwig
  2017-11-23  8:28   ` Nikolay Borisov
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2017-11-23  8:15 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: linux-xfs, sandeen, darrick.wong

On Thu, Nov 23, 2017 at 10:06:09AM +0200, Nikolay Borisov wrote:
> For file extents xfs currently always calls xfs_bmapi_read with not flags,
> meaning extents are going to be truncated to the requested range. This is
> differs than what other filesystems do (ext4/btrfs don't trim extents). So
> harmonize the behavior across the filesystem by explicitly not trimming
> extents when we are called from fiemap code.

Given that the iomap code generally trims extents, can you just try
to always enable XFS_BMAPI_ENTIRE?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xfs: Don't trim extents for fiemap
  2017-11-23  8:15 ` Christoph Hellwig
@ 2017-11-23  8:28   ` Nikolay Borisov
  2017-11-23  8:30     ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Nikolay Borisov @ 2017-11-23  8:28 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-xfs, sandeen, darrick.wong



On 23.11.2017 10:15, Christoph Hellwig wrote:
> On Thu, Nov 23, 2017 at 10:06:09AM +0200, Nikolay Borisov wrote:
>> For file extents xfs currently always calls xfs_bmapi_read with not flags,
>> meaning extents are going to be truncated to the requested range. This is
>> differs than what other filesystems do (ext4/btrfs don't trim extents). So
>> harmonize the behavior across the filesystem by explicitly not trimming
>> extents when we are called from fiemap code.
> 
> Given that the iomap code generally trims extents, can you just try
> to always enable XFS_BMAPI_ENTIRE?

What you are saying is that iomap currently always trims the returned
range from the underlying filesystem so doing trimming in the fs is
redundant and I can just pass XFS_BMAPI_ENTIRE indiscriminately ?

> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xfs: Don't trim extents for fiemap
  2017-11-23  8:28   ` Nikolay Borisov
@ 2017-11-23  8:30     ` Christoph Hellwig
  2017-11-23 11:35       ` Nikolay Borisov
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2017-11-23  8:30 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: Christoph Hellwig, linux-xfs, sandeen, darrick.wong

On Thu, Nov 23, 2017 at 10:28:39AM +0200, Nikolay Borisov wrote:
> What you are saying is that iomap currently always trims the returned
> range from the underlying filesystem so doing trimming in the fs is
> redundant and I can just pass XFS_BMAPI_ENTIRE indiscriminately ?

I think so.  But the theory needs proper valiation first, so please
do a full test run with that change.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xfs: Don't trim extents for fiemap
  2017-11-23  8:30     ` Christoph Hellwig
@ 2017-11-23 11:35       ` Nikolay Borisov
  0 siblings, 0 replies; 5+ messages in thread
From: Nikolay Borisov @ 2017-11-23 11:35 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-xfs, sandeen, darrick.wong



On 23.11.2017 10:30, Christoph Hellwig wrote:
> On Thu, Nov 23, 2017 at 10:28:39AM +0200, Nikolay Borisov wrote:
>> What you are saying is that iomap currently always trims the returned
>> range from the underlying filesystem so doing trimming in the fs is
>> redundant and I can just pass XFS_BMAPI_ENTIRE indiscriminately ?
> 
> I think so.  But the theory needs proper valiation first, so please
> do a full test run with that change.
> 

Right, so no new failures introduced by always passing XFS_BMAP_ENTIRE
so I will resend the patch.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-11-23 11:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-23  8:06 [PATCH] xfs: Don't trim extents for fiemap Nikolay Borisov
2017-11-23  8:15 ` Christoph Hellwig
2017-11-23  8:28   ` Nikolay Borisov
2017-11-23  8:30     ` Christoph Hellwig
2017-11-23 11:35       ` Nikolay Borisov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).