From patchwork Thu Mar 2 05:51:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 63244 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4071669wrd; Wed, 1 Mar 2023 22:16:35 -0800 (PST) X-Google-Smtp-Source: AK7set/bYANgn9zTA4GlFBUKEHSmPUSj2CZgpEUey/7jhDbypS4YgWNWIUtT+mNzV8TX8iIC+tEW X-Received: by 2002:a62:5884:0:b0:5a9:cbc3:ca70 with SMTP id m126-20020a625884000000b005a9cbc3ca70mr8162856pfb.24.1677737795696; Wed, 01 Mar 2023 22:16:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1677737795; cv=pass; d=google.com; s=arc-20160816; b=SKYlJ4GtXdQxT+iqH7UfnVjXP1uStnsomnjBDumy0CaZrZG7S6VIPs4Rk9lLlNyLpn hJIsGqUHmNF4FpGdHtTaVYzKhzKxi26baOLEG2CU1LJ1vnj4fNiNWnrCuuNwJJH6ADJk LvUQyDFTcIR15Eg7U3Ku9Im1q5xTYxw6sW5wT+0ymmAgMoZE1bYmKpDVpilXGQL4rjmh /bhdMIdHezusdx1e5LrEw/24adeIikelnzHR5+f/abhFtUULpqsV6Vn4qBdaPKAK8AxP 8kAQ3WJQsitFRfSPKYBAywYnGzjq34C/tjrVoCMGL752oZC+jMVhDNRormtxk1HLX50f Ik8w== 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=d8U23HfExjRgsC3oxbJ1tIOZD6CMduUOQ8H1T/8W08o=; b=MD1VIaQ4e+uWPASrpPpCMT2RuK7cDZBRkd4AIX5JeNklyIFhDKLB/VzHIPMN3KVOf7 /P8mOrp/KgCI7BdxX7UI7spmihWWdBBEh/YFre7juqzDeF5OEe/SWdUfFLOJyYPz27hl Je9UGUd1hdqeHlKMhRvelLxiQCSf8lxDbwKUq01dvd1Iw4t/TUo//z3zMqV2vaG2TTmv /vnFWFw1t8NfNAQvjqq6x5VAlaaMqH1QWFwRscz4Y4cAXn6xcx9dnrk78g+6fjBf3jRp mYYOdG/i9tjAoRZSRurO6rn66+7YduEkOaH3VbLTiOnkMXOM3FUL6oDqtzFVsBLDTmhD wDow== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=PohmtqJ3; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d15-20020a65620f000000b00502f9ffb8bbsi13135181pgv.297.2023.03.01.22.16.23; Wed, 01 Mar 2023 22:16:35 -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=@vivo.com header.s=selector2 header.b=PohmtqJ3; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229790AbjCBGC1 (ORCPT + 99 others); Thu, 2 Mar 2023 01:02:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbjCBGCZ (ORCPT ); Thu, 2 Mar 2023 01:02:25 -0500 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on20727.outbound.protection.outlook.com [IPv6:2a01:111:f400:feab::727]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 138C21A49A for ; Wed, 1 Mar 2023 22:01:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AWxNByWjW2SzestqYPp0lfQyi2TfC2GaGC3hNDyn4cwM4ZCBwYOs0n1rM8kkJcJ2Hli2++eu14gfnh41NLpRI656plXeLcQ7ATrYUSSzAaXa5qMCfgCFnY6CHaV02juFM3fJwph6/v/JetOsknQh0snwEnDtLaKgKSZ23jWNwOEQQfL1iI3DkflntZLONdH0Dh5vgauU3yAx//W+A9HpXv7aEy985YafrSHEYyDo+ZadC2Ucf4/K5Q4knS/C/h7BZPSWljDGutxmDBy4dGpKt2dd1jELqvdfjGTiEBjdgwCg9/GIpCxHRy9J0O84d9GZBpBp8v+ewgU+fK/0acEUCg== 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=d8U23HfExjRgsC3oxbJ1tIOZD6CMduUOQ8H1T/8W08o=; b=EysDfL0fHrhbKtjoJ5Sxmk5LZwZlKJ9c2E5h76ZbOEjLbn8Bw+BHXqnLZLK8jMDZoOWa5UKSLywU0wmYeEcCnkogUKpI/0YWwbntMTYcpx7LjC+j4caARXZlMrY3t1mITq4Jw7qMbmyhX97jLbiPF/lEDrm/eaYICtaykT1SoDm7pNqryJjB2S+8SO76bD7h7j2IUsHxRkjBRVAHbqrJoAHDyKp5cGov9bJ5RVKRgB3hLrD0EHM20hHB+F3df32KqqUH9vswvtTZrMwZEIDDFxMWbY+WnqkvvC1AGnj4oIIj51JHZnRM4BCofGo+P/NkkCAmahARdSn5cug3hnZnzA== 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=d8U23HfExjRgsC3oxbJ1tIOZD6CMduUOQ8H1T/8W08o=; b=PohmtqJ3ye+RLqFGTiZ8EXunllEXSvAsa6fJMKBhqbqs2SUCkyQ5Kj5wdUyH0l0+0kRX0KaKwkxiCSCnAwAyUpGvYnxlCFm27lWTWcdvTE8DpD2xO7P09n2NQYMmFO6Il4dM/TM8wXWsYhZowMNRSMcsolJem5URo2iW+U/OJ26EMC8BjWxqvBqEq/xCgbib74kDQfHvM6/OQzZgapyC6IfL+8ewjtLgsX8kFRFAe09UUcxLNyhnVBoxvb51x/ao5n8HOzy0vpv/U2QmvoSAh8eucAOPC3OFMxl3n2OVmtjQa+oJvcaQXbU0R4Cfi91qKU6MFzvHzyNuQrqrxsPE+Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by TYUPR06MB6220.apcprd06.prod.outlook.com (2603:1096:400:35c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.16; Thu, 2 Mar 2023 05:51:17 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::daf6:5ebb:a93f:1869]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::daf6:5ebb:a93f:1869%9]) with mapi id 15.20.6156.016; Thu, 2 Mar 2023 05:51:17 +0000 From: Yangtao Li To: jaegeuk@kernel.org, chao@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Yangtao Li Subject: [PATCH v2] f2fs: introduce discard_cpuset mount opt Date: Thu, 2 Mar 2023 13:51:03 +0800 Message-Id: <20230302055103.60116-1-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 X-ClientProxiedBy: SI1PR02CA0001.apcprd02.prod.outlook.com (2603:1096:4:1f7::15) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|TYUPR06MB6220:EE_ X-MS-Office365-Filtering-Correlation-Id: 6f74a8fb-8b56-4abf-98dc-08db1ae22416 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NSl8quMaOFkcGZ2NhEjGeBYLrbrqvlmMMR2j2SyPEmryQ3QRZ1eAzNv4Jq7JiwbBxbRrNJciuGG8oMzmLO5nQpBcRkBuiWEVG37Audnl2AAjO5LYzg2rLVJ2NUEoZtS3u19QLgm+AuffMJiYmZXxUE3czxD4e4/K0TG/MKbDhGQoR4BgP987/GTdQzYRdYXKKfNYOnFvdQ5cph0YNZY5g7TTlfeqdZZwmDGQtUjwIP/K27X6nrfKiacR7kXx8G85TuSU63DI80EPanC0FOvssetpirGIp8s+BujGe9F+AlM9d6lv1650DgGixronny99/cvUa6PFzNOGW06LBRWTkAYr2mebGmLpKZqOreqrrm4mtmjTWwZsCfMfDVIdtoOXKrlhWk0pfZPLrFaSbWpPuFNzliQ9Pl8ry1N32yDmFnRtBWsBIRG7umATjTY9CcHETrvAbjX1pUj5pSIycNpTwP6z1JU3OCOgd2aeNKE2XB+5LmNExOaQalnT2bJPh9UBaXh9R6yS0nSPXEeOOUysQNi6R9Pq/hOHxMHrSj5jgEE+OKO8GN1l4CDanDaWrOIizvI4mMJFnOrzwo+yEAFlNC+2HEs47xPOIomU86EHvTL3ao/8wkmXNvOBQhCZRuqnjnvMU7aIP6REGBSD0Gm/OgHiM9QBquLN2xcSytYAFZjjVoya0uxnCCPEGmVtG8oUP86Hp7UU7HEcRr+VlQtACQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(39860400002)(376002)(346002)(396003)(136003)(366004)(451199018)(2906002)(8676002)(1076003)(8936002)(36756003)(5660300002)(66946007)(66476007)(316002)(6486002)(4326008)(41300700001)(478600001)(52116002)(66556008)(86362001)(107886003)(38350700002)(38100700002)(186003)(6512007)(2616005)(6506007)(26005)(83380400001)(6666004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FWbIQXHjrVzv5cYCWIrgXcOU/ntX7JfoR8OGYwenV3j61xsTKVqJwSMhTF6+szCdikRjomk/0oNoWs4qOYVQGoW0LjgyN9+UN9lIpSrRvZV6Qt5mLO/sbzEMBAFoGc/QgJCBKKbtd/R2ZXBp/oGjuPKqK0XAMJsFZPjvrSKn5hv6VyH8uysT3hRS4IHqd8e08KNr8RE/GGanJpbmkhT8k57nHmb3YAwVDA+kiUfMDscPwopTzTEMrgS1SdEIFY76+4NCKKI0hTTKUTJcQhHjni7TA5jpp3qqsxooAvsHVOShQopWzMe5rd6QoFzpA9ZANFtTQKhSP6Lu+sIcISG58lpEuAse95xuI0XDGUnLvDpU8Vwyhrn9VQuZpfTdxoT+co0JtnM9vF5WRK5fWU7p1+ZxivPfo18n8Oh9kgVi6XjNyrddCJna3rv7sBJThlSPQCCgBokiJdHsU9jVBMaeI8n99XIyKRTL5nkgYudhaECwVM6/Be4q++WPbUH270/bUKAr/jC+sqoAaKyuUMH7X8caXqha2tuMzHj+wDlMjyB+9UkKLNB9CAl2IaFwWyokkovfM5tJhKZqLi4KhnZHG/5nSq+oC7pQV4g/hXZkKnBp/i2Tjgw9YSW2FK7UIPcEIEVJXzxEzzPaEj9VhPayJ6Sw9fR/ozAnPIjaD/JA7lXozae7d2EfNvrPTNTQ8fDQLAF+zlsrZs8V8yplg/1rttgGw6jDt+LXnOOcj3+0NO+lhcWUxUNKzoUrYyNZ98aA3ECW4egsU7R/zVxsgpcNGJgdNdYwSCAhg/L4Jb1vLNm4Se2VoBG4L6YqDCeVSJdUZPzSgC80pCL0MXdv79sHv2DyrcDi2zXYhZcWI904JvPcH5zoi3UfXPAm93rd89pA+80dkWUPTTIcBjuD4nW5B2h1X2Tipxtk156uxmJBMe0D1uMBfQAYj1ph23VTZZkfAPyhH/6EzX7LWNF8nl07aHnohvH8J8VOfnoPlysYgRAxEhKyfXoGP2o3vKUII51Qat8fnDbHK4VhJv6s7zrlvjbRhB/cw4YLeHL68HnzdG4uDwPg2qyfZEfAsT+lObeObRfGflxaDOEt21KOx2QbU6WETRFspAD9xEHvSg5Ohi1Ihn4twsjbOrNKL4KQQoVrzQ+FJVPdEan28XN3c3mbmFst1wfq27dLqaPaE/GFgIy+x5o0kxpJYnwv3t37PXEA3LrqQLtxCDKf7/BpBV6dsEoUHg3ownqMfqeA/IaqCKuyMqt9wFr+kYyeR1a8Pz4fYbesYeoR1bS5vnraya31PfljhTda3gdJjFwjh3hWsVsi/F3VX1jgKfrM2M3qeDTJkco0KCX5rLsphlL15q9bxE6Xy2rGjxLXiGmyrWjk+C9KPiK5/cvs+pJ+nizGAidhnAzBvO2A7NDykirLg4cmfTrUHnKbo4Lv69Kyh4Q/HpYnIWpX1oeoRxPbrLSqrVDK8g1l2VPrzSkUcKxcZNroJedxVz4ZRL5L2hNq1mDv4NzJ0lbR5VxVvNVf4KIGoEcVLSsFKdZQOxeQ7f6WRBxPUvF941VmSNaPRiKnxnn74FHduoknYdDty880AX/uaL88 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6f74a8fb-8b56-4abf-98dc-08db1ae22416 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2023 05:51:17.5479 (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: rJDlN50riUE0JQIu5b4LHcQSO8xXd0BaZIwhNSVgT+lXukHOHyGuo8KesTs8BY3TXJPJNN1q45ht1OZZVqFHng== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYUPR06MB6220 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS 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?1759235587133597401?= X-GMAIL-MSGID: =?utf-8?q?1759235587133597401?= It makes the discard process run faster on a more powerful CPU, or not. And if bind it to a specific cpu, it is possible to have more cache locality. Signed-off-by: Yangtao Li --- v2: -fix kernel test robot warn Documentation/filesystems/f2fs.rst | 2 ++ fs/f2fs/f2fs.h | 1 + fs/f2fs/segment.c | 8 ++++++- fs/f2fs/super.c | 36 ++++++++++++++++++++++++++++++ kernel/kthread.c | 1 + 5 files changed, 47 insertions(+), 1 deletion(-) diff --git a/Documentation/filesystems/f2fs.rst b/Documentation/filesystems/f2fs.rst index 2055e72871fe..dc005f3b784a 100644 --- a/Documentation/filesystems/f2fs.rst +++ b/Documentation/filesystems/f2fs.rst @@ -351,6 +351,8 @@ age_extent_cache Enable an age extent cache based on rb-tree. It records data block update frequency of the extent per inode, in order to provide better temperature hints for data block allocation. +discard_cpuset=%u Set the cpumask of dicard thread, it makes the discard + process run faster on a more powerful CPU, or not. ======================== ============================================================ Debugfs Entries diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index b0ab2062038a..62ce02a87d33 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -183,6 +183,7 @@ struct f2fs_mount_info { int compress_mode; /* compression mode */ unsigned char extensions[COMPRESS_EXT_NUM][F2FS_EXTENSION_LEN]; /* extensions */ unsigned char noextensions[COMPRESS_EXT_NUM][F2FS_EXTENSION_LEN]; /* extensions */ + struct cpumask discard_cpumask; /* discard thread cpumask */ }; #define F2FS_FEATURE_ENCRYPT 0x0001 diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 227e25836173..2648c564833e 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -2054,11 +2054,17 @@ int f2fs_start_discard_thread(struct f2fs_sb_info *sbi) if (!f2fs_realtime_discard_enable(sbi)) return 0; - dcc->f2fs_issue_discard = kthread_run(issue_discard_thread, sbi, + dcc->f2fs_issue_discard = kthread_create(issue_discard_thread, sbi, "f2fs_discard-%u:%u", MAJOR(dev), MINOR(dev)); if (IS_ERR(dcc->f2fs_issue_discard)) { err = PTR_ERR(dcc->f2fs_issue_discard); dcc->f2fs_issue_discard = NULL; + } else { + if (!cpumask_empty(&F2FS_OPTION(sbi).discard_cpumask)) { + kthread_bind_mask(dcc->f2fs_issue_discard, + &F2FS_OPTION(sbi).discard_cpumask); + } + wake_up_process(dcc->f2fs_issue_discard); } return err; diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index fbaaabbcd6de..8ecbe3595f34 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -164,6 +164,7 @@ enum { Opt_discard_unit, Opt_memory_mode, Opt_age_extent_cache, + Opt_discard_cpuset, Opt_err, }; @@ -243,6 +244,7 @@ static match_table_t f2fs_tokens = { {Opt_discard_unit, "discard_unit=%s"}, {Opt_memory_mode, "memory=%s"}, {Opt_age_extent_cache, "age_extent_cache"}, + {Opt_discard_cpuset, "discard_cpuset=%u"}, {Opt_err, NULL}, }; @@ -1256,6 +1258,22 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) case Opt_age_extent_cache: set_opt(sbi, AGE_EXTENT_CACHE); break; + case Opt_discard_cpuset: + if (!f2fs_hw_support_discard(sbi)) { + f2fs_warn(sbi, "device does not support discard"); + break; + } + + if (args->from && match_int(args, &arg)) + return -EINVAL; + + if (!cpu_possible(arg)) { + f2fs_err(sbi, "invalid cpu%d for discard_cpuset", arg); + return -EINVAL; + } + + cpumask_set_cpu(arg, &F2FS_OPTION(sbi).discard_cpumask); + break; default: f2fs_err(sbi, "Unrecognized mount option \"%s\" or missing value", p); @@ -1358,6 +1376,14 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) f2fs_err(sbi, "Allow to mount readonly mode only"); return -EROFS; } + + if (!cpumask_empty(&F2FS_OPTION(sbi).discard_cpumask) && + !cpumask_intersects(cpu_online_mask, + &F2FS_OPTION(sbi).discard_cpumask)) { + f2fs_err(sbi, "Must include one online CPU for discard_cpuset"); + return -EINVAL; + } + return 0; } @@ -1884,6 +1910,7 @@ static inline void f2fs_show_compress_options(struct seq_file *seq, static int f2fs_show_options(struct seq_file *seq, struct dentry *root) { struct f2fs_sb_info *sbi = F2FS_SB(root->d_sb); + unsigned int cpu; if (F2FS_OPTION(sbi).bggc_mode == BGGC_MODE_SYNC) seq_printf(seq, ",background_gc=%s", "sync"); @@ -1909,6 +1936,8 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root) seq_printf(seq, ",discard_unit=%s", "segment"); else if (F2FS_OPTION(sbi).discard_unit == DISCARD_UNIT_SECTION) seq_printf(seq, ",discard_unit=%s", "section"); + for_each_cpu(cpu, &F2FS_OPTION(sbi).discard_cpumask) + seq_printf(seq, ",discard_cpuset=%u", cpu); } else { seq_puts(seq, ",nodiscard"); } @@ -2340,6 +2369,13 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) goto restore_opts; } + if (!cpumask_equal(&org_mount_opt.discard_cpumask, + &F2FS_OPTION(sbi).discard_cpumask)) { + err = -EINVAL; + f2fs_warn(sbi, "switch discard_cpuset option is not allowed"); + goto restore_opts; + } + if ((*flags & SB_RDONLY) && test_opt(sbi, DISABLE_CHECKPOINT)) { err = -EINVAL; f2fs_warn(sbi, "disabling checkpoint not compatible with read-only"); diff --git a/kernel/kthread.c b/kernel/kthread.c index 7e6751b29101..8ddc2cd1b27e 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c @@ -541,6 +541,7 @@ void kthread_bind_mask(struct task_struct *p, const struct cpumask *mask) { __kthread_bind_mask(p, mask, TASK_UNINTERRUPTIBLE); } +EXPORT_SYMBOL_GPL(kthread_bind_mask); /** * kthread_bind - bind a just-created kthread to a cpu.