From patchwork Mon Apr 29 03:51:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13646259 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 lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DD449C04FFE for ; Mon, 29 Apr 2024 03:54:05 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1s1I5b-0008BE-85; Mon, 29 Apr 2024 03:54:03 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1s1I5a-0008B7-K0 for linux-f2fs-devel@lists.sourceforge.net; Mon, 29 Apr 2024 03:54:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=UA6GbvdGWwzQBd2O7IaYVnPbL4rbwkSkUTzujbKwIWs=; b=AiaO8rCVMs9lRMqxbyhwQy6Ec6 O5vYTkvjyba6od1pU0obqaWpO/f73H4zFRQ+I8IB88WQx9hjwwMcPRZw+nHaxKWNOOzrDRC40yl8Q 5YNTHKEorIryQ2z1DhVy5PDceS8M9r93lYWs/tNzV5sB620lFb+RP9do0DqJjurqYNbM=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=UA6GbvdGWwzQBd2O7IaYVnPbL4rbwkSkUTzujbKwIWs=; b=Z yaGedhmvSL6HVbUHD1SywOdvNc2FZRSURK5h9MkXE/ngbvgBqV5lPpPcQpE+AdjrnK9NeIX1XFB5K AExufYn9vOz7u/HBA3xpp4btZz6tisNtLpgmylmONBk8Bdcjr47sppsj65U/F253L6Isc/L4Uakd5 ft8k9YLVjeXU9lZk=; Received: from mail-sgaapc01on2053.outbound.protection.outlook.com ([40.107.215.53] helo=APC01-SG2-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1s1I5Z-00066w-6S for linux-f2fs-devel@lists.sourceforge.net; Mon, 29 Apr 2024 03:54:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oNteqcj6aapmRml7jR25eioCeZ7NFzFFuJkLM920qvoJ7mUYzQvsgIXEmgRZRlyhiVrD8jVbYBXJZ0f1QaMEydTKq1RMkWSQyKZKIls/PtfJG8NeCqgg40yWYuXc6FMdmMsWDEEg4ca2k5u5W58VG9fg3QmmecFalPkC805Pf+J1NgE2e8dyuj0h1W6igul12mQVjysauvKIv+CLTkTZHOX0K+eLFxzk1J4w7w9Eteuje9MXRAT5dGBDJODczdYoGTuI+vZcaE5fgvjktqV7c81SMDkxEHtR4G9ZDcufpafMigltRJzTZaBLDvR/qLrXhn4Tf1jMnDLX4jlXZoOZ+w== 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=UA6GbvdGWwzQBd2O7IaYVnPbL4rbwkSkUTzujbKwIWs=; b=Xmblv7os79Sv7d9NBMVjP141Ri1JRO7OVrFf6bfkxArGGPC9ZxuP7+UVw1+/qZcBiYydsGkEZyqiGLe6DqS+rKeKOLRfZIfbGwc8BdzkPlQvxufZKTYsox7t0VLdWw1T+sAYczNhpHesxGpDecg1kACE/tHbsV6SmzdBomvuGfIqiVq0Pv/GIxorUszrFcXW+d4x2mTaSl3kcUtaAoGIo2704qgSHCVLa14URGHV7THUqGgVf2qEwLLzjg9PVEY9JqTQ/322j3O5rbnQVr3cEmWd7uGlGYB2CzZp+2SZNBVoyEW9YWqnjWWfDLzhtiociIXqHULaA9Yp82uzVlZYaQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UA6GbvdGWwzQBd2O7IaYVnPbL4rbwkSkUTzujbKwIWs=; b=H2Sqj924TMABmd9d2zZkEDPQKT6AGxLcb+PgJKbGJBgMOoQXBeWBldOLuVrt+thhI6SpXsKDt5F9KBlhBTxX9G+7swVbt51vC6/mQ17iSxefjqamyuriCoxkOKqTPMbJT/qf7JYLbl2ICHkLamUD/Q2BwVDDevclNy/nTGfl9RUxs//aNGYGUhgi6k693osP4KQZ0lMF1SRekBY+w+vNh9MwIXXPal1Tam6f7EWxHWYkVr8EGnwnjQZk2UPYmZQNZo/4OTQFt659chwak/E9flNXuIk6F3lbq7BfUvOMiMcoQ6rc/PWOVVLydnRUHEOd6zG7a91ZHjFSm6bREO2FfA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) by TYUPR06MB6194.apcprd06.prod.outlook.com (2603:1096:400:346::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.34; Mon, 29 Apr 2024 03:38:44 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%5]) with mapi id 15.20.7519.031; Mon, 29 Apr 2024 03:38:44 +0000 To: Jaegeuk Kim , Chao Yu Date: Sun, 28 Apr 2024 21:51:42 -0600 Message-Id: <20240429035142.706356-1-bo.wu@vivo.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: SG2PR02CA0125.apcprd02.prod.outlook.com (2603:1096:4:188::13) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4486:EE_|TYUPR06MB6194:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b34974c-5086-4e6b-b760-08dc67fdde94 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|376005|366007|52116005|1800799015|38350700005; X-Microsoft-Antispam-Message-Info: EI3fG8ry2q02F+AdUDJndXNwKCKqE3swjIgYSR2THAOh/fJ53t4v2X4AZFsM1Ggvvo+JRgRepjY+xxWR+1lPdUObEkT0WBOX08sxqa9CeJ5PFgVDAjgmCe+GJx5VSX0EIHHNL5PcPfuxydNBwdEBsOlA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gwjgihwb7kKl0yjeXOxdl1YjYBcHpa3wDNhzYli//6JlIvkfFliCVBvU2uj6kE1bhe9LX0gyZ5EJCX9Wco177PGsUHHWa4zU2yEFGVeEHkJ+efjpEwg77iejSFAo0KJ8oQtKrURrERiKwnA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PSAPR06MB4486.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(366007)(52116005)(1800799015)(38350700005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2b+WxJhnAIw2+7vMhujuH7mfNqswX18wLGSswyiELszv3aO6GGVdlzmy/hYhelkCnE4gtbqmgqhIwuLGlfiZTyhVzHSP60GhJWdONnjB4s++BJimdieDp1q9PtLi5WGBd6juK5HPq2lSuTg2pyO2CnixmRWCqeVqipLLdz8UPm/MEV4agMESD70r6+gqLW0yCKzr9HLP7h8PDmwWkDg/qsG/tCCE35eoFeh4zoxoPsAhVizz0p4yDKvrTpVAfXJf/FDaVRGhAarNySF8/fCJG6oTP7Y733LRh0YFvIkCBowppt17fkI/X7mllrB93VKW2sgzwBCNagQLq5m7Etae64VxSQo/XYo3+nBVJ4S9YWfNZJwL9NiCPOf1avkUU+PgQq0tio0Z+gtKiWMcmoFiAAhJy+5q/VEorHQCOV/UpCt1bIj2SgwzXfzqkwB5ZnQdmPnsS0OQV7ZcM0k11NTs7+M/Kf7n9KD8wa6bx9vBHhsBZ4dws4qGtFL2BLoD2OuFp6jKDYlUmLTN0Wsmo647KMGuVQZhKSDGnJpd5ugjkMbJfz6nn71lrvQ/90Y/83zXGm3290Ad39xD+HojP54xTba26lFkhxMYJTtvP0tayC82iepmsdxpQPksT06AGjVdCVZfeH8UAAQDgIeseNaLP825Jc50PULcbcfbdOpEtA21+bIti32jkw/x6KW5vmUIJBoYoDZDFXqAWbvSKaXvs2MC7xt/BkG8ZgJWgU38HORk7gyq/z67eNoEwHVwuo8B00/b+C1ei/Ki5mdet5xjA9RShk4ZX/pLIoPsjDCibB4maATPfArSfWACT5AEk6ZbvfAkmar9imobb1jBoHpqTj3Sqh0149UfDxOusTIv9XPFtS3zIqCOMwg9FHY2DmOOy+Xd7H3hKCexkCJ+2DZhmEvG7/UFdKjwbnFJZA8cyyFs+OA+87DTbKXP9fi1qjrAaLo3tFez8d5gz28V077FnNZCYWIIpPAXAuidIv/zdbIQDt8cZ4UcrvjGZDmYIu+V83wy6nqn0alns3JJemJ1EQArOJ6t4OyEPokLX7/fI0ZVfLev2jYMYhfeb6Ke7VoEXc5rA7Y3G2chcjCAK+g1wD5UUP4vymCHojg8vwDYBHyGKHqEHRhL8L1wcjykrJy9VwY2xnESQd8VCc+HKbWvuMunDK+LqGCbhgi+PkmcnJoc3PACA5CijzJIkKvWmoIHuRO0zpHgm425RwhGlMWoyMWcxRpeKtxi9CW6J2iQpFSDXwvFAFwuf/PL6fSnG5Cw+5uTuiL68vus4QNZoESyHozWSdq+N6IUsx4Hp+MilvfV94h3mg6Qnxuht+/t93UMEAea7QqU8UTBadISO7viI1HbjhqDpe7w2VzMGa3WMtPIh2wBCIUQ3Fo/p3szkusfrEn65XoKfwCwe77zpiSLy18yoFyVoLgS8wRv+SQQiBi/kD3GvgtQFtk/m9SqhqiUdhW1aWPgQnmTq+Ckm+PokBeybxeuDZu5nWJOMUWj3oHRnIKDj2Z9rBssUbrbUp3/iVkGZ1GtbwSOAoSojjPC0KiV4NFbl2uktnN6J3qydNiO7fVBlOn1JJHEE7ZASudQ X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b34974c-5086-4e6b-b760-08dc67fdde94 X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2024 03:38:44.0175 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +qDf0Vvq/CKIN9dKR/6VN/brz+0c267Ej70ozOE6pqZWGH/a2whxdDQhC2GWJq6XllMYkI5C1G2BH/DoSz9RtA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYUPR06MB6194 X-Headers-End: 1s1I5Z-00066w-6S Subject: [f2fs-dev] [PATCH v2] f2fs: fix block migration when section is not aligned to pow2 X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Wu Bo via Linux-f2fs-devel From: Wu Bo Reply-To: Wu Bo Cc: Wu Bo , Liao Yuanhong , linux-kernel@vger.kernel.org, Wu Bo , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net As for zoned-UFS, f2fs section size is forced to zone size. And zone size may not aligned to pow2. Fixes: 859fca6b706e ("f2fs: swap: support migrating swapfile in aligned write mode") Signed-off-by: Liao Yuanhong Signed-off-by: Wu Bo Reviewed-by: Chao Yu --- v2: Fix arch-i386 build error. https://lore.kernel.org/oe-kbuild-all/202404290041.jfIs3zkw-lkp@intel.com/ --- fs/f2fs/data.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index bee1e45f76b8..6fd877c69c03 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -3916,15 +3916,14 @@ static int check_swap_activate(struct swap_info_struct *sis, struct address_space *mapping = swap_file->f_mapping; struct inode *inode = mapping->host; struct f2fs_sb_info *sbi = F2FS_I_SB(inode); - sector_t cur_lblock; - sector_t last_lblock; - sector_t pblock; - sector_t lowest_pblock = -1; - sector_t highest_pblock = 0; + block_t cur_lblock; + block_t last_lblock; + block_t pblock; + block_t lowest_pblock = -1; + block_t highest_pblock = 0; int nr_extents = 0; - unsigned long nr_pblocks; + unsigned int nr_pblocks; unsigned int blks_per_sec = BLKS_PER_SEC(sbi); - unsigned int sec_blks_mask = BLKS_PER_SEC(sbi) - 1; unsigned int not_aligned = 0; int ret = 0; @@ -3962,8 +3961,8 @@ static int check_swap_activate(struct swap_info_struct *sis, pblock = map.m_pblk; nr_pblocks = map.m_len; - if ((pblock - SM_I(sbi)->main_blkaddr) & sec_blks_mask || - nr_pblocks & sec_blks_mask || + if ((pblock - SM_I(sbi)->main_blkaddr) % blks_per_sec || + nr_pblocks % blks_per_sec || !f2fs_valid_pinned_area(sbi, pblock)) { bool last_extent = false;