From patchwork Sat Apr 15 09:32:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13212370 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C145C77B71 for ; Sat, 15 Apr 2023 09:32:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229848AbjDOJci (ORCPT ); Sat, 15 Apr 2023 05:32:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229561AbjDOJcg (ORCPT ); Sat, 15 Apr 2023 05:32:36 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D284D9F for ; Sat, 15 Apr 2023 02:32:35 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33F3FuFQ010458 for ; Sat, 15 Apr 2023 09:32:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=rMnmCmH8d0I4eZwVCjCpD9LqRK4rmrKAtsjBFWIovUU=; b=JdVfS5KGeho8HagIGBForAqk8SJmhf+wdIyKy1h6gC0qMxJwnVesS1krFVvmqWWTrkas sAoeYHRRisdX7wZSa/WYphaHRQBYBWSnMBhzWLam0n4mJFWuJaRCddJOEkhiKgaTIzMl IGbhr7RAHRT6WkhhgTgoeg7kT1fQqNwABOfwfVs7VRsHZhmwQnkl41aQV7STvZFY9nMx xT7iwrCSGchRNz2j2FyzKVm5F0RUBCZV82vUZMJM3XkAOuY4pDpoG2a2j4s3Ekc5w/rL Jv+GICyVTLb0XYOi3nYCu/lHzAN1YumZstZPnT0XbodGglTaB1ChK/9qqAULQOh0e/Zv VA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3pyjq40dap-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sat, 15 Apr 2023 09:32:34 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 33F7LAoX023945 for ; Sat, 15 Apr 2023 09:32:34 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2047.outbound.protection.outlook.com [104.47.66.47]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3pyjc8qnqe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sat, 15 Apr 2023 09:32:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YCU91n3BuVt+oMZZo8EpAyM1wkLYJy14cbzxFnq7XJbfXHfHpzNywY3bVbt3FZ1zcQ7SL9Pcly9GkIS3RJRDhqTWfYhTe4sIKu7+asVy6CvspnUZp4Nm/UqGf0zuJ43J6AuBjMkiYUy/G0UWRjFdggHUL+NWb0RKvX9TbeVeA7Rk9LOWOwmeIltlZktkfMCwHysclHKL296B3Mdi6e8ScRgCsIIkd/y0odEdlBtbcIVwrPEvDey1w8kLAgmfbrJVhH4lLuEYG/MqP9Q94rn7xEfHNefy1p4fDK+7T39vY0YK3cuNiQj+WJUl/sAepIkW3CztHSz8bnl9jc6MeW8lIw== 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=rMnmCmH8d0I4eZwVCjCpD9LqRK4rmrKAtsjBFWIovUU=; b=RTyLnc6dJt4th3AQ97ZxdG3VA05n1OcAkl/HlUElTuY35APDAsUqWHo4Wt98T1iA+B6duxeAMhsm5+Tmqzzmit298Q5Z7QIXlxSlCGab9HNfNfe0Cfe8wvFNbctQaks/VjMGTJJb/saTIdwbTBFCfd0JrGHu7CzxQVElOIsULm17MGRUqCNmvjluzMsrJcv8ouY3ugGLfeEpTX4bB3KZnw7jmCX9ooOJHvC8lXJgVUTQxpH8IPv70WpYUPWkoeAGbs8h67px7n5RDiIXIexZXwpSZQ7WQo0yBbcqZtlhkfZlsUJqS5bHxELOfg1GkDRPR9Ko0GlKqgLpXwluGCtDhA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rMnmCmH8d0I4eZwVCjCpD9LqRK4rmrKAtsjBFWIovUU=; b=hOnNuGkv4Gx5sF1OcjYoMUOzEL3GgHIw5WrGFxBDeDvml4gNTGBJ/ePVCS2GxJa1b2OeI1GXOu2coznhM3bcvXpEufR5xQEhSRL+q6jqekDmSlejrWqSWP3MR+EGu4meJ5WiAyT/MDFdyFIeiRkpODoqFNWbDo1KCn1Yit1VhVM= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SJ0PR10MB5860.namprd10.prod.outlook.com (2603:10b6:a03:3ee::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30; Sat, 15 Apr 2023 09:32:26 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::bc67:ac75:2c91:757e]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::bc67:ac75:2c91:757e%6]) with mapi id 15.20.6277.038; Sat, 15 Apr 2023 09:32:26 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH] btrfs: use SECTOR_SHIFT in issue discard Date: Sat, 15 Apr 2023 17:32:06 +0800 Message-Id: X-Mailer: git-send-email 2.39.2 X-ClientProxiedBy: MAXP287CA0007.INDP287.PROD.OUTLOOK.COM (2603:1096:a00:49::20) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|SJ0PR10MB5860:EE_ X-MS-Office365-Filtering-Correlation-Id: 88b5843b-fbaa-4829-3c71-08db3d945328 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6Pal3Vx99ULs34tBPDaQxXeszV43++ZK4DAzwcQXdXoF1z2WkeaDMKemKnVdpLUxrsWVmorMTtXOEnl6U1gUjcz9grplPoqEbsR2zMKNGWqrTL2BsdOkpU1pf1kbmxtWZZ56qjH4IOcaZVnG1B0MLB+73LpMCtmGvgRYk8xwZljhB1C87pKPaAYQo+AGC0nSUDgqAiXglm+zuHylZMgokH8GTMbdJlEILyF+hsrfro6PNMdmolkMGnM2MrRdA8YgHsxES/uBgh9mufCCm81TkP3Yd3Rt5LSQoaeUvwkZ6MY5TYFIUaAhjlvHMLeEFuzBbVRDSMm0yOhYhKi47bEysWUgR24JTYD1iS/lxoe+gdZmwWlznURUXSkL1FOzLI7Ae4o3ODpCzpD6F2jnfiX/oVDg+4M8w1R0OcJ1aXDGCRyty7JOibXafTTnCV6NRDdlxO2HEeg2ajDbA2brH9o1PI3lzgQXvEOCv0ofw+I6zs+qFQAG8JvhOHFI/dyzJb65LFjdh5fehsY5g2+kR3lWb4xJvF+akWfCV4PR2rsvDhbhBTWVPH/kJofXstUD6KF6 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5706.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(39860400002)(376002)(366004)(346002)(396003)(451199021)(86362001)(44832011)(316002)(478600001)(41300700001)(8936002)(38100700002)(8676002)(5660300002)(66476007)(66556008)(107886003)(6512007)(6506007)(36756003)(186003)(6916009)(4326008)(66946007)(6666004)(83380400001)(2906002)(6486002)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /8pqvIHv9IsBbVSx8bFDfLVAQ6XvbpXodlGz52Ywupy/nIfBOzSuWJHfSoqxDbv3LrCiGVMhY21LOikXbK3Ingk1KCo4+I0jrDMfkwoBnjCprC9cYyeiVrwfpcUMbVKpQwijI4ObQeofOOrveW8K33Wvyvnl2atBE15qEROA2eFSbOhvddNeMVVGve6iHg5tv6H/e7h9zJ0XdokXTmeO52JHRxIaTWRZy1aM7PHWVTVRrYaPIkHBXRQevCBr4r6vcOWixjjFFsNFWEgElKuJaRpN4JafIbwhK8IpAxI8aa9U4dQZe9b20N2wjA1JsMTRMiLEAIKE5L9AJtkBwKJGBreaiJTLFulOmRnIgYx7eC2CVXjIdz+9y7axNDUnHrG9UvmgELCcbaOEShxhQ1QU+7HG/S+NvPAZM/ui3IOGlyVgwZzoC+M5FE5NTbbT+vL4lssyE4DWYilSgzyuV5D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rq1T6KnalNJ75Zl5/mM9ktoRIarI9iB22eUgLoGn/OP6Mum3Z/5mQgV6Hghcj+sml6FNVTpplvqESTX0nc/7xtluEW5abQWCqHyqUVYooDleyl3zXEGIFMTLIHeaXGccJ8TK0tMkiOR3b26K8W1nyVA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 7XVp+FrwLSIa8IHwdBNd4IRkS9yWa3yr26JQJXItIo+TsxoiBGIYuwfn4sG20waXvYb+kwqL3lv6HL4hFNUVaaz/Zj29Pe70TMJ9BGW/3GCh2n0QOWqkztP/RoNybQBm4WQY69oQRerBk6LkJG4ZrbEYi32+w1ud6aBBTOoNJ3IzIszUDwLYhn4oOSV1/60Z1HuaiVnEqYff4EHKI8PlJ9hxp5fNJVdhko6WS9NxNXvAKGwv4zYT8+oM5Zk+wrSQGVOi3p10seYqYznalrm1iMN86FPkDI2FI/VbUKpEmKrispWl3bY3w4ZsUSyT9p1fQhZp7YRZZhjBt9oFzcYwgFNYwSQ+HxtSis4jCbOoT17+V5ZjEreaiBlTCg8HEIpikIBXTEa91WNYji8xQ7OiZ8+/DABFTOl+FvbcQTJI3bgT4MyeiFSepCGdPPcVWtgh1I+KqKkirUIw4vBN+9OWQecQBHgeddnAsUeBvcl2LOoGpTVX6Ei7WXWLH6wQ30NnA+8Giwt8Z3BTXtHAY+jLgQxf33wIcLui77MoHH4i+bY4tiSKsK5gSGIvpqGqTnPNU+U4fGefQU9yeeAqE44OtmDqUuYnQ6baKc9ndVEB6sbwxIg6+Or0ksjSg8V8N+QaW5pIwP1d7BHwuX5f08ytUu8FJhf5Fx2QX0MXPa9YgubzzIyMs6MV/r7NTWP6WXEjFd8YdWY29e8q2Kxtn8Qwol8+iGr3PdzRgOIZISme6Bcs0MNCDBKFD7SMsbflsNUy8mlFhT+pA9iRPgW/8nZFbQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 88b5843b-fbaa-4829-3c71-08db3d945328 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Apr 2023 09:32:26.4865 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: MfRaLY8S9+yC8dXcRrJy1l0sXMZGpsI0+ENN3qBdqEuQjarWWrUFyZ3jwlFK1jEpGAsLGtCcpnfTpxD2T4vvAQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5860 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-15_02,2023-04-14_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 suspectscore=0 phishscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304150084 X-Proofpoint-GUID: Nv9LPvBMe98cx1KyLR7ZVm2PeB-Py4M6 X-Proofpoint-ORIG-GUID: Nv9LPvBMe98cx1KyLR7ZVm2PeB-Py4M6 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org SECTOR_SHIFT can be used to convert a physical address to an LBA, makes it more readable. Signed-off-by: Anand Jain --- fs/btrfs/extent-tree.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 5cd289de4e92..b0b9df93398d 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -1250,7 +1250,8 @@ static int btrfs_issue_discard(struct block_device *bdev, u64 start, u64 len, } if (size) { - ret = blkdev_issue_discard(bdev, start >> 9, size >> 9, + ret = blkdev_issue_discard(bdev, start >> SECTOR_SHIFT, + size >> SECTOR_SHIFT, GFP_NOFS); if (!ret) *discarded_bytes += size; @@ -1267,7 +1268,8 @@ static int btrfs_issue_discard(struct block_device *bdev, u64 start, u64 len, } if (bytes_left) { - ret = blkdev_issue_discard(bdev, start >> 9, bytes_left >> 9, + ret = blkdev_issue_discard(bdev, start >> SECTOR_SHIFT, + bytes_left >> SECTOR_SHIFT, GFP_NOFS); if (!ret) *discarded_bytes += bytes_left;