From patchwork Fri Jan 6 05:45:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuezhang.Mo@sony.com" X-Patchwork-Id: 39940 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp659446wrt; Thu, 5 Jan 2023 21:49:39 -0800 (PST) X-Google-Smtp-Source: AMrXdXvNAzO9zQq8slAOdIGciwp5fq2/zhFj7bgVEehP5CNnWH553FIhMM3mGDhE0FhiCuaJcJTX X-Received: by 2002:a05:6402:550e:b0:47d:ca3a:3b32 with SMTP id fi14-20020a056402550e00b0047dca3a3b32mr58950757edb.9.1672984179289; Thu, 05 Jan 2023 21:49:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1672984179; cv=pass; d=google.com; s=arc-20160816; b=OpmoUUgARntL2u/kXWvtA17Eavwjid9YXWA2l5hfh2U/hSNDMrfH44qG9MI2obQHNs G9nBUD7g7veSdQabmVBv9+Ez1hLhoAt0WO04j0GXDX66NF04aM3MJWN71mJt/l177Jno Q/OT7uGjbwCqw+bM06TyvxGxrvuqWKAvCvl+MvTLdZMDheR9RtinUkxYmP3BS8nZoHHL kX174/yg+rMPpG07aetf3XuC3YqiXbJe75WHUmrkGGQAY4pFL8hMxFGKqjNcHYc0UvA7 kCjfHX9tJ3VZNt0nlychHAQaFBL2BdFQc+NoLKCyetafBPAgtFlbKmAZgD5SRfpnRf7q 4YdQ== 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 :content-language:accept-language:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=5YJ5kMK5pyZMZgjgHylPOxjOKuXW/t4yQe4ybOFyZsc=; b=Oh/BLcP1rdT2u6Zv88Kfd1/vXg8LsNBVfMekABPVbNXMehFvLcO0UZKXbfKpUAIaWo KaZrxKpfdjY72bd3OKUcmwQyBsvQQRAlRASTvD7eKvPxG1Kk1ED2wIx+mem95ktv7Mwx gQfWCKGnZKigbEODYrK1N6OgfHBllWGckXYfsnk2yi4idKyZwcKxZyXmZEJkW86xIwM2 7vZwJ30wLw6uVrQj1OPZBa7hynE56uV+A3wh87wwnm0DRbrbQyXXWJIp54NpipN5Lnsb W9jA2Hk2MIsc7TBT01dO1YjEXtzMa1dx+AVPVdrCfHDnjrOF+njBHSjRuVwzo9Z5FMnQ 0fWQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sony.com header.s=S1 header.b=VRdAvW5L; arc=pass (i=1 spf=pass spfdomain=sony.com dkim=pass dkdomain=sony.com dmarc=pass fromdomain=sony.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sony.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y18-20020a056402441200b00493b4398f11si559390eda.622.2023.01.05.21.49.15; Thu, 05 Jan 2023 21:49:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sony.com header.s=S1 header.b=VRdAvW5L; arc=pass (i=1 spf=pass spfdomain=sony.com dkim=pass dkdomain=sony.com dmarc=pass fromdomain=sony.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sony.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231289AbjAFFqb (ORCPT + 99 others); Fri, 6 Jan 2023 00:46:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229509AbjAFFq2 (ORCPT ); Fri, 6 Jan 2023 00:46:28 -0500 Received: from mx08-001d1705.pphosted.com (mx08-001d1705.pphosted.com [185.183.30.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C927D3E842; Thu, 5 Jan 2023 21:46:26 -0800 (PST) Received: from pps.filterd (m0209318.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3064gDjZ025234; Fri, 6 Jan 2023 05:46:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=from : to : cc : subject : date : message-id : content-type : content-transfer-encoding : mime-version; s=S1; bh=5YJ5kMK5pyZMZgjgHylPOxjOKuXW/t4yQe4ybOFyZsc=; b=VRdAvW5Lx+8bk5ecVZEEbRWg9wbC4aUt52ppPeDPxVLrSRElO8O5tr2fVAVGSimTXomZ my5Yqu8lHGQ+w+jeDmTZHntdyPABSfC/jd1raomEfmWg4djeuPy5APztEEczQufIZOKk dfCpz2g9dHEnHBOk7X8HHdg81zE1yjDS+i6MO4Zs69Hcwc/hQpqQsS9O19yTFqjtC8Q5 XRGQk6EiOLQ/Sm41nwC/Xy/aCYqqLcyvrhja8psSKt+MmBDMgnByW4A3OwKCVvNH9ZNp X0QMoSmFQHXjsdLFmfC3zg56a+q7EAktATUrfQfGFxsNw5Eq3bERyW5rvVw3PO5wjFs5 Kw== Received: from apc01-psa-obe.outbound.protection.outlook.com (mail-psaapc01lp2042.outbound.protection.outlook.com [104.47.26.42]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 3mtbn6ncxm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 06 Jan 2023 05:46:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZYAMMnA3NKo8DAVWYuNX1P/RRkTZom76HNZFOjM/WRK1QpIanOmpWhYQtBwQSuyLg6vWrMz22csehJQvl1kGX/iOhFOg7lDFonJOQXjIEk0S7KpzUiDm1Cky/gDy8S9DCqDJsn1rrXcnIjaj9qPUDSnwhSbd4xDju6Ty5k/3kzBA7lYT46jd5/qWRDfe4DmbCZ5ikjnhaHyY9VLgDNYnGKlzqMFwuPt0AeU/cB+fQMXElTcHFNetP8XVjWpKfcAHXxV24UHDtEU+9HWOCQzoorKHFsTM8AVsRy3vjpwtOxVY3Kl9L2+7OGFPz5AhQw1o3hQe3I44vg+dcCtneknSkQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5YJ5kMK5pyZMZgjgHylPOxjOKuXW/t4yQe4ybOFyZsc=; b=B+jTabIOWEp+Ve+Kzgx70PJXHnG3yoWIydsG8b1F91nqXFOzPOIUskisSGe4ZQOTeUPTPiyr1dC2zI8Xn8L3AFQR3qhiACqri09/wxLpHTuyXLeEYlZZ7nqAcInq+lthV2lD1p0dr05JFYK0+M0DgB3J++J/3ias5ozRnF5NLD0Xhlh60NgXP8HEnJJUzMSYkOPnmU/zkeUFp7KeVD1vCUneasy0fgzc3Zmv65Cv2GcKs57FCWEOGw9BDJ8vE1KZulgolrP6uHQ48QFTbbBft210VkpgZO/tiBtOoFGcItnBzTLEbDv2tdV2L/sFmmZje94m8mjcOjaeSctz8mPslQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=sony.com; dmarc=pass action=none header.from=sony.com; dkim=pass header.d=sony.com; arc=none Received: from PUZPR04MB6316.apcprd04.prod.outlook.com (2603:1096:301:fc::7) by TYZPR04MB5680.apcprd04.prod.outlook.com (2603:1096:400:1c7::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14; Fri, 6 Jan 2023 05:45:19 +0000 Received: from PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::1cb5:18cc:712d:1f13]) by PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::1cb5:18cc:712d:1f13%7]) with mapi id 15.20.5986.009; Fri, 6 Jan 2023 05:45:19 +0000 From: "Yuezhang.Mo@sony.com" To: "linkinjeon@kernel.org" , "sj1557.seo@samsung.com" CC: "linux-kernel@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , Wang Yugui , "Andy.Wu@sony.com" Subject: [PATCH v2] exfat: fix inode->i_blocks for non-512 byte sector size device Thread-Topic: [PATCH v2] exfat: fix inode->i_blocks for non-512 byte sector size device Thread-Index: AdkhkSpzW+Z4xVa9TL695QpkCntjkg== Date: Fri, 6 Jan 2023 05:45:19 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PUZPR04MB6316:EE_|TYZPR04MB5680:EE_ x-ms-office365-filtering-correlation-id: c96e237a-a844-46a6-e79e-08daefa93240 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: uTtEZnyohjVJ+4JgzoGpCAjmE1979aOcOmK1tWATHdOXUKSfOFGnVk78+Xq3MKFindT6bcgPkVBYEg3AglR/lW0srlh7UDy3u3H+eh+l3FzXa8pB5fGwKUjuLD2X+lmoP4Rxl07STNKmDfvF6ENH4uRYUp0hvmDIrufV56JvhTTVtXY1EG3jugMh5fy2p2taptOnXRPygYPfMRSr88WMrmnyEXbU1nOxhdcJYiscju7YQ61wNbXFYtdvO1RcLEzReeZQcAQBVB78WAY7TwM+7pKlSNBBZvkUn4PA6aqrPlhBjinuNFbsDmygqVANTp4/bwJcNb95j3YFH7IXm3/vNu4gS0VXJsyjp+BKC4BsxmUtvsZ25yEM8g4EPLCvs+4wMdFIP8lMjBptmdAlhFseY3g/CKWUS6ruUhm72y1dJugPEXu9BrE6tyMIXLzQhoTfwt3538Zmp9/edZL7LZllv9BiPT4BZ9KUkjDzYE874zXKPJGRaGZ3l4uzvY6kDZ2wCOHnPr3LkLgg9ZXDiRht5p3VYYxwEe18kEfUBGuC7ON0ERtqwnA4mgx77nx96fGwu0grAZ8b3ewBt9+QQoEzZ9drbE5jFYLcPFPKu37tsuF/zag+HoihS7LxtATdrREqIKgr9doJXzRYGG4BCqyy01CX8vVQ6UX7QD/Awv0hLHAZwkIx/CghBx3S07EyUC7jbelM3Pguv2hs3RIhnO315Q== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR04MB6316.apcprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(376002)(136003)(346002)(366004)(396003)(39860400002)(451199015)(38100700002)(33656002)(71200400001)(122000001)(83380400001)(8936002)(41300700001)(66476007)(66556008)(64756008)(52536014)(66446008)(5660300002)(107886003)(38070700005)(2906002)(66946007)(4326008)(76116006)(26005)(478600001)(86362001)(6506007)(8676002)(7696005)(9686003)(186003)(110136005)(54906003)(82960400001)(316002)(55016003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?vkRXzdVbLOLZWLbzpaq013U6LoLf?= =?utf-8?q?JDvEDuQiWDIVKfAmAPO4aS64oVpDGxP0baq5kzUj1+3yJTmVaOqD8KK63uIMxi1NL?= =?utf-8?q?FPheFKekZspLmEKyxgJMeQE9ttwC50sJJ/8DSnO060+4rBjN33zHRo+IMQiR4Ab+7?= =?utf-8?q?C0fxW5MVHxd3qUlf/iS/hQliozTv0U0oit5JKktLict71OZMv4+IElwTBQpb29h5W?= =?utf-8?q?nsoRf8nlOL2c5xZS4anVRje5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uBO/dav+EF7dQJIYnFBirHELzcKs9ZpKkPjPGld58uSiC7ypDoJnMyYuGKnzgqTdy8rW15PpKhBdvQVgKIBzaJPNcTfalBY/5WT9EStFwTlAb/HELivAKtjMk6rywJk1M4Eaz4FssRK/20Cw0/+wM4CAQ6Uk5ZLVxUBUQNsi7uKSfVqpCqole7fPmCsIhopumwL78GiYsjmoDqtzd+P1mLoB5dovr46MTSw5Qwz8PiR6x0zrSB2563ejzvXxaxLBhvZCZhJcM6AIIM1avmTcoDJ6u5up/YwhQsOXk+eY1RiYrDaoPC8HLasjfebdzc+pmB6RpsQfPXPjBXK4zddZ354EttFtVLM5zDy+kAUolSdMKCiFL62EEUVchvGFTT8xOeT7hZUnOb7gXM+uyyUsYaS+G91WRAy/kKixF7afzlUuRVmeNxzV X-OriginatorOrg: sony.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PUZPR04MB6316.apcprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c96e237a-a844-46a6-e79e-08daefa93240 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jan 2023 05:45:19.7816 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 66c65d8a-9158-4521-a2d8-664963db48e4 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: prNCg2kqDSMZa22qo2Zjlz8/aaD0NLyB3fMsyBBSUtt/ujRnvHWOoUBeHbFoFgfFB5zHo4fWAsdsleEPNWmVYA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR04MB5680 X-Proofpoint-ORIG-GUID: 5TgLCvXEqhm8AFNA0BTeXh-H_C5pqPkn X-Proofpoint-GUID: 5TgLCvXEqhm8AFNA0BTeXh-H_C5pqPkn X-Sony-Outbound-GUID: 5TgLCvXEqhm8AFNA0BTeXh-H_C5pqPkn X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-06_01,2023-01-05_02,2022-06-22_01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754251058819485889?= X-GMAIL-MSGID: =?utf-8?q?1754251058819485889?= inode->i_blocks is not real number of blocks, but 512 byte ones. Fixes: 98d917047e8b ("exfat: add file operations") Fixes: 5f2aa075070c ("exfat: add inode operations") Fixes: 719c1e182916 ("exfat: add super block operations") Reported-by: Wang Yugui Signed-off-by: Yuezhang Mo Reviewed-by: Andy Wu --- Changes for v2: - don't call inode_add_bytes()/inode_set_bytes(), just use >> 9. fs/exfat/file.c | 3 +-- fs/exfat/inode.c | 6 ++---- fs/exfat/namei.c | 2 +- fs/exfat/super.c | 3 +-- 4 files changed, 5 insertions(+), 9 deletions(-) -- 2.25.1 diff --git a/fs/exfat/file.c b/fs/exfat/file.c index f5b29072775d..b33431c74c8a 100644 --- a/fs/exfat/file.c +++ b/fs/exfat/file.c @@ -209,8 +209,7 @@ void exfat_truncate(struct inode *inode) if (err) goto write_size; - inode->i_blocks = round_up(i_size_read(inode), sbi->cluster_size) >> - inode->i_blkbits; + inode->i_blocks = round_up(i_size_read(inode), sbi->cluster_size) >> 9; write_size: aligned_size = i_size_read(inode); if (aligned_size & (blocksize - 1)) { diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c index 5b644cb057fa..481dd338f2b8 100644 --- a/fs/exfat/inode.c +++ b/fs/exfat/inode.c @@ -220,8 +220,7 @@ static int exfat_map_cluster(struct inode *inode, unsigned int clu_offset, num_clusters += num_to_be_allocated; *clu = new_clu.dir; - inode->i_blocks += - num_to_be_allocated << sbi->sect_per_clus_bits; + inode->i_blocks += EXFAT_CLU_TO_B(num_to_be_allocated, sbi) >> 9; /* * Move *clu pointer along FAT chains (hole care) because the @@ -576,8 +575,7 @@ static int exfat_fill_inode(struct inode *inode, struct exfat_dir_entry *info) exfat_save_attr(inode, info->attr); - inode->i_blocks = round_up(i_size_read(inode), sbi->cluster_size) >> - inode->i_blkbits; + inode->i_blocks = round_up(i_size_read(inode), sbi->cluster_size) >> 9; inode->i_mtime = info->mtime; inode->i_ctime = info->mtime; ei->i_crtime = info->crtime; diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index 5f995eba5dbb..7442fead0279 100644 --- a/fs/exfat/namei.c +++ b/fs/exfat/namei.c @@ -396,7 +396,7 @@ static int exfat_find_empty_entry(struct inode *inode, ei->i_size_ondisk += sbi->cluster_size; ei->i_size_aligned += sbi->cluster_size; ei->flags = p_dir->flags; - inode->i_blocks += 1 << sbi->sect_per_clus_bits; + inode->i_blocks += sbi->cluster_size >> 9; } return dentry; diff --git a/fs/exfat/super.c b/fs/exfat/super.c index 35f0305cd493..8c32460e031e 100644 --- a/fs/exfat/super.c +++ b/fs/exfat/super.c @@ -373,8 +373,7 @@ static int exfat_read_root(struct inode *inode) inode->i_op = &exfat_dir_inode_operations; inode->i_fop = &exfat_dir_operations; - inode->i_blocks = round_up(i_size_read(inode), sbi->cluster_size) >> - inode->i_blkbits; + inode->i_blocks = round_up(i_size_read(inode), sbi->cluster_size) >> 9; ei->i_pos = ((loff_t)sbi->root_dir << 32) | 0xffffffff; ei->i_size_aligned = i_size_read(inode); ei->i_size_ondisk = i_size_read(inode);