Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp760676lqb; Fri, 15 Mar 2024 06:02:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW1BoPAXxfiLOOj0zeyt/ikJykJJM4+W2MAc+WNxHm2cfiTQypgbgPvytse6Unp9r44+5YIOT/ti9ocd0H6rLhlBN8EqMBoo1nQVnd/Sw== X-Google-Smtp-Source: AGHT+IEvYlhvryzmrrbx5r8M9W24ET35HH8C5dMXgNHP373XAMSuOIVoTnHJzb1Bea6BXsiGMyaV X-Received: by 2002:a17:902:dac9:b0:1dc:affb:1f50 with SMTP id q9-20020a170902dac900b001dcaffb1f50mr3641187plx.47.1710507736760; Fri, 15 Mar 2024 06:02:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710507736; cv=pass; d=google.com; s=arc-20160816; b=G+bc3RgYlTxBlGfa0Mp0uo23hCHhOBqg2CH8QL4bds6tosA0EQj+QAowhS6bHmyB5e sw8MkCa4IbPFnb/gN9AUiK1BhwaCS/4MaWhwk5A+3D1fkNwpWpMlfCUml8n3c0mPeb/Z ehjBXBtI7UsDNQEXT0ij83MooAFCYuJA5V1I2Xm8y39KCdmsX29oH5sMJkcYYy1FMeX/ xlbfxXYu2Anwh/B7DMNTtxuhVEbS9lhBX6ZOEsXdjO605N70oWwsQqwkLZCyriu3FPXg VEhvxVJe1kkXUvTPGRW4OjK1zslCF4QoeCqU3x2jqvxTuIYrU760CuFiZP77Qyt5A6+7 c+Lw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=fN5F1EPtnmyLvea2ZVJO2/BrY4sJHbEFrDhPbXEUV6E=; fh=5dB93T9RUScPXiJBPgMY9ddAKXpKWIKqxrLOkZR5g5k=; b=CyI7/vk+GoHOtqYCFBV8LfcCv65zuqTC9MhKzT0OxML0QBl0RdkcYdAqyoUVpzmSl4 LC+Sr7MRqbI5b2kWKWNhOXjkLJbufFK6r2MjQSWyxEqeYJ6xN+C86pd1LLLxqQ8oOzAT kGol6NPMSb0G0wcWYEJ4R81xtm1Rs9hqXvaKRlRHvMWsvG3RQ6DtNnlKc4meyR5wnyQD u1foLFMWu7F+qf3RCksrMgfkez1Z843Dt3h5t3q8+nINjdAur9I6zd9JnnnEwk4sXjcn Cl0hc2joDUdp061FcAUp+oy5ErBxqjOpTf3LCoix7c9fVE1dt3KbbXaPVPOnDrALWFwt NI3Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-104423-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104423-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id l9-20020a170903120900b001dd46c442e4si3550132plh.270.2024.03.15.06.02.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 06:02:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-104423-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-104423-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104423-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D3C652841E5 for ; Fri, 15 Mar 2024 13:01:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4BE7F39AE1; Fri, 15 Mar 2024 13:01:11 +0000 (UTC) Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 520C4250EA; Fri, 15 Mar 2024 13:01:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710507670; cv=none; b=emxt0K5uFWV7aTJ25d5RbDiPC8sQYIte+8Gt4c0zblEABLiROTiYb9sOcXaT4U6yre6rjGdcELbvzmVN4jntyNxewIAPqJIM9ZjEm5FG4eAoS2qisDR28Rdg9ONRFc3HPwaMBkVZEpxefcrRcim7Bg15qhQUhUNF8RosQctOap4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710507670; c=relaxed/simple; bh=2VQ3RbP2jhMVp7hMprxxtBhvz+K+R9bKIFP7F3guo2U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Bk7sq7yDz2qbGyOk8OPpU3Uk6V62C/DK2Cdjr04WUQT7g1ke8/feyBGZ1CZfHIZ+A8TCpVoMC1KzHuq+lrqGq9UF6Mhx/uqmHUBk1eA6C8QgrTfyFzFQrVSzAhpv3tjHdpJJdaVlFrLZiTEaLgcS1HDmXKJ4/1XY3dD1A5H+0A4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4Tx49z3chWz4f3m7L; Fri, 15 Mar 2024 21:00:55 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 445901A09E0; Fri, 15 Mar 2024 21:01:03 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgCXaBF9RvRldVMfHA--.12032S8; Fri, 15 Mar 2024 21:01:03 +0800 (CST) From: Zhang Yi To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, djwong@kernel.org, hch@infradead.org, brauner@kernel.org, david@fromorbit.com, tytso@mit.edu, jack@suse.cz, yi.zhang@huawei.com, yi.zhang@huaweicloud.com, chengzhihao1@huawei.com, yukuai3@huawei.com Subject: [PATCH v2 04/10] xfs: drop xfs_convert_blocks() Date: Fri, 15 Mar 2024 20:53:48 +0800 Message-Id: <20240315125354.2480344-5-yi.zhang@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240315125354.2480344-1-yi.zhang@huaweicloud.com> References: <20240315125354.2480344-1-yi.zhang@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgCXaBF9RvRldVMfHA--.12032S8 X-Coremail-Antispam: 1UD129KBjvJXoW7Cr45uF1xury8uF1xtw43KFg_yoW8uw1UpF ZxCa4xGF4qgw1F9an2ya1DJ3WfC34kGF4UtFy3Wws7X3yFvr1fXFn2yF18Z345t397Zw1j qF4rAry7W39xCa7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPF14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYI kIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2 z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F 4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq 3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7 IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4U M4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2 kIc2xKxwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E 14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIx kGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAF wI0_Cr0_Gr1UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJV W8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjfUOBTY UUUUU X-CM-SenderInfo: d1lo6xhdqjqx5xdzvxpfor3voofrz/ From: Zhang Yi Since xfs_bmapi_convert_delalloc() can make sure converting the target offset, it's time to drop xfs_convert_blocks(). Signed-off-by: Zhang Yi --- fs/xfs/xfs_aops.c | 41 ++++++++++++++--------------------------- 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 376ec0993943..6479e0dac69d 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c @@ -233,32 +233,6 @@ xfs_imap_valid( return true; } -/* - * Pass in a dellalloc extent and convert it to real extents, return the real - * extent that maps offset_fsb in wpc->iomap. - * - * The current page is held locked so nothing could have removed the block - * backing offset_fsb, although it could have moved from the COW to the data - * fork by another thread. - */ -static int -xfs_convert_blocks( - struct iomap_writepage_ctx *wpc, - struct xfs_inode *ip, - int whichfork, - loff_t offset) -{ - unsigned *seq; - - if (whichfork == XFS_COW_FORK) - seq = &XFS_WPC(wpc)->cow_seq; - else - seq = &XFS_WPC(wpc)->data_seq; - - return xfs_bmapi_convert_delalloc(ip, whichfork, offset, - &wpc->iomap, seq); -} - static int xfs_map_blocks( struct iomap_writepage_ctx *wpc, @@ -276,6 +250,7 @@ xfs_map_blocks( struct xfs_iext_cursor icur; int retries = 0; int error = 0; + unsigned int *seq; if (xfs_is_shutdown(mp)) return -EIO; @@ -373,7 +348,19 @@ xfs_map_blocks( trace_xfs_map_blocks_found(ip, offset, count, whichfork, &imap); return 0; allocate_blocks: - error = xfs_convert_blocks(wpc, ip, whichfork, offset); + /* + * Convert a dellalloc extent to a real one. The current page is held + * locked so nothing could have removed the block backing offset_fsb, + * although it could have moved from the COW to the data fork by another + * thread. + */ + if (whichfork == XFS_COW_FORK) + seq = &XFS_WPC(wpc)->cow_seq; + else + seq = &XFS_WPC(wpc)->data_seq; + + error = xfs_bmapi_convert_delalloc(ip, whichfork, offset, + &wpc->iomap, seq); if (error) { /* * If we failed to find the extent in the COW fork we might have -- 2.39.2