Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4352915pxu; Wed, 9 Dec 2020 15:08:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJyNojji6trpBvxEYl2IQTE3AuO+l2bYaasB4B/ad36lwJ+3ShumVmUiIz2na8F/cnpTpi+G X-Received: by 2002:a17:906:85cf:: with SMTP id i15mr4197693ejy.373.1607555318329; Wed, 09 Dec 2020 15:08:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1607555318; cv=pass; d=google.com; s=arc-20160816; b=FM0mGFyodHNw6Lhrre5nfEGAgNBe0B6gAc71zvXH5EH88HkBGqQzBr6RxMXiEu9FDQ DJRPcbOLYx3weXb8pg4XQxJxx1yH58pZeR/yol58N/TdGBkSqjb/eDSTdeuQur8yFh0v +1jKjbHDFJFbioCTsuJTZ8hghxqJKF7704ret4FstfP3XTJQspIJ4eqQ3JitAlTsd4eo W64cusOHsBsoQT4ywWa6rJyLwHB5/hrkImED58cBe42SyAYqFn2KqVWP/xSmretGaq6F zoRkJg5DVFN6yONn23bRcjgkWug15i3RYi++el486xbBhBrTKPCDB/YBzgpGTp6725g8 +Lbg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=Ke/7zqoWtPar/bnT5PwSZO//Zr9ZzmItjeD/Z4qwMIQ=; b=kv5cyHMXZ8AhEHjgC4c8/GFBz/6hRIrYwX0SQ7aeEnnlYFUKHs8ZqrXWKZ/F7alJ6A bCwG5hriFz0IyqogA9AXZ/CXwokYokn4jua967urCYQOW7Pymm+vFA08MfZ8WcxIQv6m x2hChMIczalRGz8GwJdlBtkcv8OKCOTEZUKGEq7KhJfKgtajuppH559mZt5Ur3uljrFI T5c1uyeDP4yFG09yn30Y8Xuooi/LJAlKFJ1eozp4e7vUH/TU1sOkTLKkqKQLrhabeai1 BVwOXB79uX+GNTT9f0CAo/VS4PTzKGUgJpCI0RsM7N70MfMx59dTQCe4srm6+aaJ7+ip akGg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oppoglobal.onmicrosoft.com header.s=selector1-oppoglobal-onmicrosoft-com header.b=X7OvGF6S; arc=pass (i=1 spf=pass spfdomain=oppo.com dkim=pass dkdomain=oppo.com dmarc=pass fromdomain=oppo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oppo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r19si1497785ejc.668.2020.12.09.15.07.53; Wed, 09 Dec 2020 15:08:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oppoglobal.onmicrosoft.com header.s=selector1-oppoglobal-onmicrosoft-com header.b=X7OvGF6S; arc=pass (i=1 spf=pass spfdomain=oppo.com dkim=pass dkdomain=oppo.com dmarc=pass fromdomain=oppo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oppo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731050AbgLIL7m (ORCPT + 99 others); Wed, 9 Dec 2020 06:59:42 -0500 Received: from mail-eopbgr1300042.outbound.protection.outlook.com ([40.107.130.42]:56320 "EHLO APC01-HK2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730599AbgLIL7m (ORCPT ); Wed, 9 Dec 2020 06:59:42 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IYkZQiGsgMETgh0SwK3q0JEJV/6TffvrvT2J/zwAx3fCl77YY1QsVH3yqgwDzJ8aEYlRe4T1M9x5X2QobGu2Qidt4ZanD9jr/L37gM7Tc26CLVBamEXWXAHQCJZ2Psn/6KH/fHv5vIWUwUxVMf+UJ19INOMPQwmctC2XApU5/wWNPi4mzQsXL/nwmnHCW1+y1pi4/KCnb+I6o838tCN/mQLUunVkJiTLJvxaai2j6vGHI70FOcJ2IGGbLSEPXMZjl6ALm5uO0MUQYZoDNOfD6VmUjjo38P7FOSgqgMPNor2R8GnZmh/PBwyX1glpeZWRCTPRn08RL1JranlZK71nEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ke/7zqoWtPar/bnT5PwSZO//Zr9ZzmItjeD/Z4qwMIQ=; b=CZCfEXCCLR11pEmZufMjBH8vtX8wzByNV1Yv27VfjZ/nrqR+kuTBZha8FWxSVlCnPoE0mDiYl+RtaM/kM8VHR6WdFegVpWXGmERfW2K5gVe1gEf1gE7yDbJ+W08ZdZF1Pq7aJ0CpVyn1SQSX3jYwBNcs3GSS0Pi5aGtcmhh9a8yVBqmwtWvJ+ycEgIkoO5kUq2SEcLyooL+zbxebzDms39n52aUmoF7rEaiUYvtKA9IszJKWULN++HaY1M60dlsR2lsHX//a/xDmOde3mhS4Le8JvCTNuvkxpep0BzFuUzdequ0b52a1nGFrgo71YPQjbX4lyL95f/Ck2yQlXUgzLw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oppo.com; dmarc=pass action=none header.from=oppo.com; dkim=pass header.d=oppo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oppoglobal.onmicrosoft.com; s=selector1-oppoglobal-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ke/7zqoWtPar/bnT5PwSZO//Zr9ZzmItjeD/Z4qwMIQ=; b=X7OvGF6SXx3qh/Fl00mxd2zvCRq8IjCKbibJwoZkP/vurz71L24TlyNvmC7i3YI3W9qXek15TfxCiPfY/6mb4ArWSXqta+9smGxZb/g6n8zm1vgxmIRMfwObqayT8rkGJWzVGct4NsC2SQ8AZJLj6vIvtUcdHruWnk7I/slIZX0= Authentication-Results: lists.ozlabs.org; dkim=none (message not signed) header.d=none;lists.ozlabs.org; dmarc=none action=none header.from=oppo.com; Received: from SG2PR02MB4108.apcprd02.prod.outlook.com (2603:1096:4:96::19) by SG2PR02MB2559.apcprd02.prod.outlook.com (2603:1096:3:27::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.19; Wed, 9 Dec 2020 11:58:04 +0000 Received: from SG2PR02MB4108.apcprd02.prod.outlook.com ([fe80::dcd:13c1:2191:feb7]) by SG2PR02MB4108.apcprd02.prod.outlook.com ([fe80::dcd:13c1:2191:feb7%7]) with mapi id 15.20.3654.012; Wed, 9 Dec 2020 11:58:04 +0000 From: Huang Jianan To: linux-erofs@lists.ozlabs.org Cc: huangjianan@oppo.com, guoweichao@oppo.com, zhangshiming@oppo.com, linux-kernel@vger.kernel.org Subject: [PATCH v5] erofs: avoid using generic_block_bmap Date: Wed, 9 Dec 2020 19:57:40 +0800 Message-Id: <20201209115740.18802-1-huangjianan@oppo.com> X-Mailer: git-send-email 2.25.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [58.255.79.104] X-ClientProxiedBy: HKAPR03CA0017.apcprd03.prod.outlook.com (2603:1096:203:c8::22) To SG2PR02MB4108.apcprd02.prod.outlook.com (2603:1096:4:96::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (58.255.79.104) by HKAPR03CA0017.apcprd03.prod.outlook.com (2603:1096:203:c8::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.8 via Frontend Transport; Wed, 9 Dec 2020 11:58:03 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: db711528-6fe6-4e83-6f73-08d89c39af75 X-MS-TrafficTypeDiagnostic: SG2PR02MB2559: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:525; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2HwKS+MEZ94i0vPwcwZnJayUt6nROuj1ZpQAJK7eSLRxUsqytffXVOPlnIDih2Csp1p4bJJ3WmBgM+sHgkwjuwsQkS8OgKsmZ81NUdz2KJM8d5A3fMs7TkL1th6InsjPc2zoKxFftxsO0ukTy0m+PPrG+Z7HFXlhjogoXPBopoz9aObLiYH+gtkjLmE2tT+2OiqmDDHB/mOT9F/BZdLS5V7vey/EEbLvr05tOuU+o2Gw0e1UYf5M8Iyezx7HeJwYxHsElcvsPl/czilQjgkanQB/tv5Jl5RS8AgqiMvBENxrdTO8y6zhmRI699pbrp3IEXZo32MV3JMjXm/OVxwSjYth6iJEhiAUkI+zWJmof7S/ogE5KxxWd+bsYtrFPzaHEKayQ8cV0kUlVmktuuae9xuKhyNTCnii8KDAyKoQbGvIvQ1sKpCgVqSxAXEBI8im2Awb6EL46L7heL3zHuORdg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SG2PR02MB4108.apcprd02.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(376002)(346002)(136003)(34490700003)(5660300002)(6666004)(83380400001)(6506007)(956004)(86362001)(6512007)(1076003)(26005)(186003)(36756003)(16526019)(508600001)(69590400008)(6916009)(8936002)(66556008)(4326008)(6486002)(2906002)(66946007)(52116002)(2616005)(66476007)(8676002)(41533002)(11606006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?NCdQ2pmYLE1Fkn+s2tUDay9eDzaZKvv/gooToXVBoAzd248hBYax04siopoc?= =?us-ascii?Q?0b/04vtphPTUx/IHjUNzBlrkQerBxdLmx4r5honjw2/mE3LXRe1oGafzb8V+?= =?us-ascii?Q?WVvxC/utd68y+G29NEueVXgF4emA8+WIscjEIxj1eJg91P0ylbq5SdhNxfnb?= =?us-ascii?Q?TC3iSLEjeuXq4I7aRMR6wsXRjCqoIU/g30AG2O/mWHxArjFli+tBTmk0V2jM?= =?us-ascii?Q?poMmCYmB7b8EIKlfxIqb5t8D89/CXuNMGE9+f3W037zaZ8dueXKwjvk0SuUu?= =?us-ascii?Q?sBrzqpUhMguWes6jfy4bgoBuzM4trvRbsWhX+an2EgAwBTH9QVRjJNK9Umx7?= =?us-ascii?Q?6aV8LmrwLLHqOcAlZt54toCHCZKAA3Aj0k18mzcHtogZDniSx9E3mqT795Jk?= =?us-ascii?Q?AoGY6b25rMKXldVmiNUtSUzXUf6NjSG+TI2xLSX7R4y0eL3qtqn0pvEiwENJ?= =?us-ascii?Q?DK6oZC6HIlvTilSmGE+G3C6elMGIkgUBeWbzFVtTCLOnQKcyMWxhFlfMyODM?= =?us-ascii?Q?ziGbYcdhHJEHFO6FVxUmH+qv3tY/72cWrpR8yBqsFRlu0B/wl7E6BpQ4eQff?= =?us-ascii?Q?Sl1QChSJ4vUt9qgCCt+pKbvfASCZJD5pMuXm8FfxIs8/jE55e3u7AJFaFSG3?= =?us-ascii?Q?xNYWx66/vlUR2sA8JGuDfUNFryvcekAQoYI8/3fatIkMyE1p9AQYdBoKuA9z?= =?us-ascii?Q?J0+FSqA3ulNDgTaZjU+o6tIet211OuGvgX5+CPiemZzaFlphIVml4KRQnunm?= =?us-ascii?Q?tv+tzU+8j4p7fF7uWlO/6Q6eTV5zhGrKhGjKZDCmVukDz0rcXa8Bq7wEq+Aj?= =?us-ascii?Q?Jt9uffCms/ZHA6j9k7KltVSypgY07ZD0sTS6I4qU9RIOH2JKKgp7pTSzJOjI?= =?us-ascii?Q?eQ6PMk5VNkjp6JXi7udKu56jVDzEkUiXUmS7Jbljd3zDqAY0WVB78voRULVt?= =?us-ascii?Q?FjtF+UY/UxspUO6HP2/Bfdz75DIC3gOVSW3gXkV0MorfiPlyooLf9YxjQywX?= =?us-ascii?Q?lVPu?= X-OriginatorOrg: oppo.com X-MS-Exchange-CrossTenant-AuthSource: SG2PR02MB4108.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2020 11:58:04.2923 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f1905eb1-c353-41c5-9516-62b4a54b5ee6 X-MS-Exchange-CrossTenant-Network-Message-Id: db711528-6fe6-4e83-6f73-08d89c39af75 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LeTszkJlMiT3zDi5URFHdw3GjYvsKBe2O7GrZ4bUdlWBBEmssjrcjvKDV4J3cRzayPXVD4KndkGlAy6AvSv/RQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR02MB2559 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org iblock indicates the number of i_blkbits-sized blocks rather than sectors. In addition, considering buffer_head limits mapped size to 32-bits, should avoid using generic_block_bmap. Fixes: 9da681e017a3 ("staging: erofs: support bmap") Signed-off-by: Huang Jianan Signed-off-by: Guo Weichao --- fs/erofs/data.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/fs/erofs/data.c b/fs/erofs/data.c index 347be146884c..ea4f693bee22 100644 --- a/fs/erofs/data.c +++ b/fs/erofs/data.c @@ -312,27 +312,12 @@ static void erofs_raw_access_readahead(struct readahead_control *rac) submit_bio(bio); } -static int erofs_get_block(struct inode *inode, sector_t iblock, - struct buffer_head *bh, int create) -{ - struct erofs_map_blocks map = { - .m_la = iblock << 9, - }; - int err; - - err = erofs_map_blocks(inode, &map, EROFS_GET_BLOCKS_RAW); - if (err) - return err; - - if (map.m_flags & EROFS_MAP_MAPPED) - bh->b_blocknr = erofs_blknr(map.m_pa); - - return err; -} - static sector_t erofs_bmap(struct address_space *mapping, sector_t block) { struct inode *inode = mapping->host; + struct erofs_map_blocks map = { + .m_la = blknr_to_addr(block), + }; if (EROFS_I(inode)->datalayout == EROFS_INODE_FLAT_INLINE) { erofs_blk_t blks = i_size_read(inode) >> LOG_BLOCK_SIZE; @@ -341,7 +326,10 @@ static sector_t erofs_bmap(struct address_space *mapping, sector_t block) return 0; } - return generic_block_bmap(mapping, block, erofs_get_block); + if (!erofs_map_blocks(inode, &map, EROFS_GET_BLOCKS_RAW)) + return erofs_blknr(map.m_pa); + + return 0; } /* for uncompressed (aligned) files and raw access for other files */ -- 2.25.1