From patchwork Thu Nov 23 08:06:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 10072457 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 41BEB6056E for ; Thu, 23 Nov 2017 08:06:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32B6F29EDD for ; Thu, 23 Nov 2017 08:06:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2621429EF2; Thu, 23 Nov 2017 08:06:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A10B229EDD for ; Thu, 23 Nov 2017 08:06:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751643AbdKWIGT (ORCPT ); Thu, 23 Nov 2017 03:06:19 -0500 Received: from mx2.suse.de ([195.135.220.15]:51062 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751537AbdKWIGT (ORCPT ); Thu, 23 Nov 2017 03:06:19 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 5C87BAB22; Thu, 23 Nov 2017 08:06:18 +0000 (UTC) From: Nikolay Borisov To: linux-xfs@vger.kernel.org Cc: sandeen@redhat.com, darrick.wong@oracle.com, Nikolay Borisov Subject: [PATCH] xfs: Don't trim extents for fiemap Date: Thu, 23 Nov 2017 10:06:09 +0200 Message-Id: <1511424369-28740-1-git-send-email-nborisov@suse.com> X-Mailer: git-send-email 2.7.4 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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;