From patchwork Thu Nov 23 11:40:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 10072679 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 9644A602DC for ; Thu, 23 Nov 2017 11:40:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8560E29D54 for ; Thu, 23 Nov 2017 11:40:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 77BED29D74; Thu, 23 Nov 2017 11:40:10 +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 673AA29D54 for ; Thu, 23 Nov 2017 11:40:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752446AbdKWLkH (ORCPT ); Thu, 23 Nov 2017 06:40:07 -0500 Received: from mx2.suse.de ([195.135.220.15]:49847 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751799AbdKWLkH (ORCPT ); Thu, 23 Nov 2017 06:40:07 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id F0C87AAD0; Thu, 23 Nov 2017 11:40:05 +0000 (UTC) From: Nikolay Borisov To: linux-xfs@vger.kernel.org, hch@infradead.org Cc: sandeen@redhat.com, darrick.wong@oracle.com, Nikolay Borisov Subject: [PATCH] xfs: Don't trim file extents during iomap Date: Thu, 23 Nov 2017 13:40:03 +0200 Message-Id: <1511437203-4329-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 calls xfs_bmapi_read with flag set to 0, meaning extents are going to be truncated to the requested range. Since the same codepath is used for fiemap this means xfs is special in that regard, since other filesystems (ext4/btrfs) do not trim extents for fiemap. Make the behavior consistent by always passing XFS_BMAPI_ENTIRE. A full xfstest run validated that this doesn't regress on ordinary read/write IO. Signed-off-by: Nikolay Borisov Reviewed-by: Christoph Hellwig Reviewed-by: Darrick J. Wong --- fs/xfs/xfs_iomap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index f179bdf1644d..8942324a4d3d 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c @@ -1008,7 +1008,7 @@ 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, XFS_BMAPI_ENTIRE); if (error) goto out_unlock;