From patchwork Thu Jan 25 16:53:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13531466 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 A1B16C47422 for ; Thu, 25 Jan 2024 17:09:38 +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 1rT3EO-0002IP-W8; Thu, 25 Jan 2024 17:09:37 +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 1rT3EM-0002IH-Qg for linux-f2fs-devel@lists.sourceforge.net; Thu, 25 Jan 2024 17:09:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=fpd79ziWWnEkE4PQSjIRnLcjjQg7HoWMKhlTrkjmDK0=; b=SPexYLQZ63sY27Z9cM6sedePrj f0FVn+6aBEmOB0TS6Grbl9FAsMDq2RNLbblVxmQ6+ZxfS+PQHgT3pC3hnp7t8y0Ed1gg96ACt0e3I 9K2mwjzs6bsCP5ngyNG392UvrooWAVaFnGGPhQJ8qJSJqMXRrhZW5iSDoanYQOGdVnKo=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Cc:To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=fpd79ziWWnEkE4PQSjIRnLcjjQg7HoWMKhlTrkjmDK0=; b=bXv8f2YEdbGhBL9qFWAd3cZxwh lot5LMpdmQSAAH8De6MOXXagFDCJZqu2PoIUNJ7ITBQKAcCCmHeP3+sietgQyiExNWwFX9+ZNtNWp uFEe5oo7+ISOsfQYTLbMTEgG327QpCnorPadGN00Eo2RzPULnw2MIxHi4CXJsiUEn4SE=; Received: from esa1.hgst.iphmx.com ([68.232.141.245]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1rT3EI-0006th-IJ for linux-f2fs-devel@lists.sourceforge.net; Thu, 25 Jan 2024 17:09:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1706202570; x=1737738570; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=eGx4McY1FmrYKhrAp3TTxFkfkbSfbNbdZDzzsYbn3SA=; b=R+nHMDnVyWuCuY8lBNLQEB1Gf0PNU92KXP0q47qhGsLMeAeYq0Vs3M91 hmbFwq7X0d8DU/AtiXGWitTXU5WVVoD4tqLfFnwNbusT+oqSqKF6e/4/O GSEkT702u9aTuIgGjH5gFzl86QDOkdLNoNJAHORrqcRU1q7IPwJwfrUNq 0FsGUlWuLvYDbLYVntdkqqNqHAB7KlMPf6T3/wuzyTVKLplFNfsNqyuEv n6TIgPpAAjdvOTnbG3z5Qq9ZeiTZELv7IwBknY/4sG+iq42u2VnQJNhs9 BKsbF6J4vyAux2HzBsMqa7JTyhYU4F7Gz4O9Cq4vqEd1dF2xyrH4FDrG2 g==; X-CSE-ConnectionGUID: ZW5sP5YMS5u0Z5rZ3jlwAQ== X-CSE-MsgGUID: pn/OcF0sRGuBBlF0cQkQ5g== X-IronPort-AV: E=Sophos;i="6.05,216,1701100800"; d="scan'208";a="7967069" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 26 Jan 2024 00:53:36 +0800 IronPort-SDR: CWgrePKn44DXbTDFJ2AfjIuwM1k3SBDd4z07VngjEfLOw/1DHzwnTSkxib4jCzlZ07GNWtJPIj B4IILCCh1uyg== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 25 Jan 2024 08:03:36 -0800 IronPort-SDR: VOx0UIr5lbldPsjxQBhoPSsQoOEZNWGs3Yn004iQ+BbMXVrE9gDtrUz+juD/7EPs5IyZ7d6MAQ oXv5yVO5EAbg== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip01.wdc.com with ESMTP; 25 Jan 2024 08:53:33 -0800 Date: Thu, 25 Jan 2024 08:53:24 -0800 MIME-Version: 1.0 Message-Id: <20240125-zonefs_nofs-v2-1-2d975c8c1690@wdc.com> References: <20240125-zonefs_nofs-v2-0-2d975c8c1690@wdc.com> In-Reply-To: <20240125-zonefs_nofs-v2-0-2d975c8c1690@wdc.com> To: Damien Le Moal , Naohiro Aota , Johannes Thumshirn , Alasdair Kergon , Mike Snitzer , Mikulas Patocka , dm-devel@lists.linux.dev, Chris Mason , Josef Bacik , David Sterba , Jaegeuk Kim , Chao Yu , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1706201608; l=1041; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=eGx4McY1FmrYKhrAp3TTxFkfkbSfbNbdZDzzsYbn3SA=; b=7i7rSG5FOL3Y+GFA5rvmzOGA1LPZcNa6uQEcp9OZuAhx8o+EuzcMQlp/v7AQwfxAOFFlfDgdz pJC/jmeDno3BoWXgTUVMLTNlb/W+P6XXYXlpj2p8o3WXeCGKXi91zBB X-Developer-Key: i=johannes.thumshirn@wdc.com; a=ed25519; pk=TGmHKs78FdPi+QhrViEvjKIGwReUGCfa+3LEnGoR2KM= X-Headers-End: 1rT3EI-0006th-IJ Subject: [f2fs-dev] [PATCH v2 1/5] zonefs: pass GFP_KERNEL to blkdev_zone_mgmt() call 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: Johannes Thumshirn via Linux-f2fs-devel From: Johannes Thumshirn Reply-To: Johannes Thumshirn Cc: Johannes Thumshirn , linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Pass GFP_KERNEL instead of GFP_NOFS to the blkdev_zone_mgmt() call in zonefs_zone_mgmt(). As as zonefs_zone_mgmt() and zonefs_inode_zone_mgmt() are never called from a place that can recurse back into the filesystem on memory reclaim, it is save to call blkdev_zone_mgmt() with GFP_KERNEL. Link: https://lore.kernel.org/all/ZZcgXI46AinlcBDP@casper.infradead.org/ Signed-off-by: Johannes Thumshirn --- fs/zonefs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c index 93971742613a..63fbac018c04 100644 --- a/fs/zonefs/super.c +++ b/fs/zonefs/super.c @@ -113,7 +113,7 @@ static int zonefs_zone_mgmt(struct super_block *sb, trace_zonefs_zone_mgmt(sb, z, op); ret = blkdev_zone_mgmt(sb->s_bdev, op, z->z_sector, - z->z_size >> SECTOR_SHIFT, GFP_NOFS); + z->z_size >> SECTOR_SHIFT, GFP_KERNEL); if (ret) { zonefs_err(sb, "Zone management operation %s at %llu failed %d\n", From patchwork Thu Jan 25 16:53:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13531467 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 5484BC48286 for ; Thu, 25 Jan 2024 17:09:40 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1rT3EQ-0001Zx-FF; Thu, 25 Jan 2024 17:09:38 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rT3EO-0001Zq-KE for linux-f2fs-devel@lists.sourceforge.net; Thu, 25 Jan 2024 17:09:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=kjczz8mPkeKokmXTN6NURwCatsfIVh3T4Cfy2Zqik+o=; b=SY+HKO9dS2C1rnrlk6cdPiH6g2 lQ7x4mS7QmeRw31MAFlLmiShu28x0tWjnDdUdO+RJen1GQDh0rMuJmtomfvKxpyJY2XR/ExLsABCg CE26HIXSbFaPIBobg4XK4+aFLY/Dy5c+QPaLXBcv903g5wYRdCTHdgvjoVGEk0ndbuqQ=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Cc:To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=kjczz8mPkeKokmXTN6NURwCatsfIVh3T4Cfy2Zqik+o=; b=j4NzF9uyZ83DTu32uUXXEmyfw8 clMSJq/j8GFTO0NUtUGPkZtFe7Fv8xGcMl93ODb40yYVxVQoyAjNTJ4wXaTu41fMC0MWbGqGJTk30 i2pIcrVen4OMIADskoWf07nozZ7Ax9+q2ZtBN9gyEoweIhugdbFDtqEadzDubO3qWlDM=; Received: from esa1.hgst.iphmx.com ([68.232.141.245]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1rT3EN-0006th-40 for linux-f2fs-devel@lists.sourceforge.net; Thu, 25 Jan 2024 17:09:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1706202575; x=1737738575; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=CVSDtwbfJeIFTP08Wyxu5GIZXiQgdv2rMRXO0YSre0A=; b=cyYJT3RnXuUjyD3Tb/BoDiP21/VAG8dimrO9x5dtArAJf+jmt6WXBsDs tSHDaLDoxZyHI3liTinKUQdM2XZb7zDLbtdbrPfSFdNxGKyypm+pz7F6x WBSwX3sQeMyBPMLc9bjdhnx1ziQTlKY5l5WPHube/JxERw6fbjOtddzKw mFQfg9nGzZoBRsJhGCa57J3PEDeecD4nrD5sk7v5KgpWy1wH+8ZAOzGA0 pCfT0x7ZjuVT0HXdHI6vgulwDBNQS8QM/KpL/bZRvKhUkygVl/RlGcDHr 9yIl74z+z/JRthoGhP+056maLI8wcN55AQeHzq+4vGvpWQsEdZqemJ5ZT Q==; X-CSE-ConnectionGUID: PPCHijo6T5m2EaWgH1/TnA== X-CSE-MsgGUID: TTjgk5afQg2IXHIT4XPIDA== X-IronPort-AV: E=Sophos;i="6.05,216,1701100800"; d="scan'208";a="7967078" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 26 Jan 2024 00:53:40 +0800 IronPort-SDR: kRStqwrZmb/jfTDBE0OV84hF+oHR3kfU1pzErW9mG+CvDsw3GdFahPxp8KB9uwLsCQEt+eIyGn C45vruWkPbhg== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 25 Jan 2024 08:03:40 -0800 IronPort-SDR: sBgbgkN5bVB0enbBw/iyb8cMMu+2pAh1JkthbGxPDDItWfESaHFsqFp68AyWN5LkQ+syR4acGA 0IKcbDNJkDbA== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip01.wdc.com with ESMTP; 25 Jan 2024 08:53:37 -0800 Date: Thu, 25 Jan 2024 08:53:25 -0800 MIME-Version: 1.0 Message-Id: <20240125-zonefs_nofs-v2-2-2d975c8c1690@wdc.com> References: <20240125-zonefs_nofs-v2-0-2d975c8c1690@wdc.com> In-Reply-To: <20240125-zonefs_nofs-v2-0-2d975c8c1690@wdc.com> To: Damien Le Moal , Naohiro Aota , Johannes Thumshirn , Alasdair Kergon , Mike Snitzer , Mikulas Patocka , dm-devel@lists.linux.dev, Chris Mason , Josef Bacik , David Sterba , Jaegeuk Kim , Chao Yu , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1706201608; l=1101; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=CVSDtwbfJeIFTP08Wyxu5GIZXiQgdv2rMRXO0YSre0A=; b=oFwFIqk+a1bu3Gme4liw+RG2cMT5QTjli7I99okyi7hJJltokvsxJSP+mr+nCDIrJWXq34TTT jsVdpNzfNZbAcO1z7yd2EbMw7/v2dBFV8630y+/qR9JS2+Bul5QIMOO X-Developer-Key: i=johannes.thumshirn@wdc.com; a=ed25519; pk=TGmHKs78FdPi+QhrViEvjKIGwReUGCfa+3LEnGoR2KM= X-Headers-End: 1rT3EN-0006th-40 Subject: [f2fs-dev] [PATCH v2 2/5] dm: dm-zoned: guard blkdev_zone_mgmt with noio scope 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: Johannes Thumshirn via Linux-f2fs-devel From: Johannes Thumshirn Reply-To: Johannes Thumshirn Cc: Johannes Thumshirn , linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Guard the calls to blkdev_zone_mgmt() with a memalloc_noio scope. This helps us getting rid of the GFP_NOIO argument to blkdev_zone_mgmt(); Signed-off-by: Johannes Thumshirn --- drivers/md/dm-zoned-metadata.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm-zoned-metadata.c b/drivers/md/dm-zoned-metadata.c index fdfe30f7b697..165996cc966c 100644 --- a/drivers/md/dm-zoned-metadata.c +++ b/drivers/md/dm-zoned-metadata.c @@ -1655,10 +1655,13 @@ static int dmz_reset_zone(struct dmz_metadata *zmd, struct dm_zone *zone) if (!dmz_is_empty(zone) || dmz_seq_write_err(zone)) { struct dmz_dev *dev = zone->dev; + unsigned int noio_flag; + noio_flag = memalloc_noio_save(); ret = blkdev_zone_mgmt(dev->bdev, REQ_OP_ZONE_RESET, dmz_start_sect(zmd, zone), - zmd->zone_nr_sectors, GFP_NOIO); + zmd->zone_nr_sectors, GFP_KERNEL); + memalloc_noio_restore(noio_flag); if (ret) { dmz_dev_err(dev, "Reset zone %u failed %d", zone->id, ret); From patchwork Thu Jan 25 16:53:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13531469 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 B8E18C48260 for ; Thu, 25 Jan 2024 17:09:40 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1rT3ER-00023L-PV; Thu, 25 Jan 2024 17:09:40 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rT3EO-000232-NH for linux-f2fs-devel@lists.sourceforge.net; Thu, 25 Jan 2024 17:09:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=2i0P4UtDfM2GvJlRWNENr44DBD4bzBaFXfbBxw+clIM=; b=g2u3i0ax+k7Z/dq45xgGkV17RC BaRxd+6Kz7f0ik6BLz0oCF4ultVTNCJFUbpdpMUI4WwDAQmpI3UxnTCkjNiIx2BBp9rDvl3/Upt5b LENukTW50JuDC7DXeGI7g53txy6AQS3Ymy1BzW7X9ofykTX1GOsMKU3mFHzRdpuJzJtE=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Cc:To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=2i0P4UtDfM2GvJlRWNENr44DBD4bzBaFXfbBxw+clIM=; b=E5AzLs63ttB1Ye8YTyoJARun8H lWw+IBCD/LQQXRdulsVPYlHEbnpA76+pKnlwx8qJ5ijvUeKxiUEcMkDP527gq1wXdxEalzEuouvAf owJaBvv7QeXzx2Gk32xOpTMxm3O/d9Cb3G/DS6PVs37BrIa96BsIekXccBNmkapS25/0=; Received: from esa1.hgst.iphmx.com ([68.232.141.245]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1rT3EN-0006th-RL for linux-f2fs-devel@lists.sourceforge.net; Thu, 25 Jan 2024 17:09:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1706202576; x=1737738576; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=MadywNv3PPpA8atuGcDj3Vd17mnoG/ezGAm6iZoKSro=; b=SVNV2wc10GTLntt4hH/yB1SVh0uZS1D1Zd+7s6wcxVUryg6j7rdHpWI3 A8S2YM8xAWJ8WeHFKQ78W+5pj+6ImAU41+PNhWKHtfw4PMAhuLd2gPNId cV3pjCVB8mt/meFbjpg3lxieplxPyGBco27HW79c+HdBLC3ySQFeazttJ 1LqkMNYIOLrSYRiuISy/Go3MjxS6T1cOBma5vhpqTnXp6sdV6UJhH8So5 eLVox7UmnO4yUnPLqEfBeJ14HxzdsMM1b9KCIgUmFHPG3klp/FZLYRyaC txOmaf76zUkwGk49/KPLW3XxCNPy3DxBmaRvFMQladPDbHIHUILYcszzL A==; X-CSE-ConnectionGUID: GW1GCGGxRP65caKXT8zRRw== X-CSE-MsgGUID: 8NvXJGmVR8+R6wWFnO/6kQ== X-IronPort-AV: E=Sophos;i="6.05,216,1701100800"; d="scan'208";a="7967092" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 26 Jan 2024 00:53:44 +0800 IronPort-SDR: ssmk45hnkMR36xSw1tavbIuSuEbiYzKt+7uj5nnvR/vMWDSWoVnbReFUsBYhsGM589e5kMs4iE GWcR/DaWpctQ== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 25 Jan 2024 08:03:44 -0800 IronPort-SDR: iGbJfwTm9aux0HAHn2Hu4+5MaKexoPy7oBPg1gDFb4sShWjqtqNmtHUakx83XvcY7OzLhKfXSU svTD8SbpHGFQ== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip01.wdc.com with ESMTP; 25 Jan 2024 08:53:41 -0800 Date: Thu, 25 Jan 2024 08:53:26 -0800 MIME-Version: 1.0 Message-Id: <20240125-zonefs_nofs-v2-3-2d975c8c1690@wdc.com> References: <20240125-zonefs_nofs-v2-0-2d975c8c1690@wdc.com> In-Reply-To: <20240125-zonefs_nofs-v2-0-2d975c8c1690@wdc.com> To: Damien Le Moal , Naohiro Aota , Johannes Thumshirn , Alasdair Kergon , Mike Snitzer , Mikulas Patocka , dm-devel@lists.linux.dev, Chris Mason , Josef Bacik , David Sterba , Jaegeuk Kim , Chao Yu , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1706201608; l=3714; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=MadywNv3PPpA8atuGcDj3Vd17mnoG/ezGAm6iZoKSro=; b=OeiWcP8kl57wFLapxrMUtXeqJjNXTQJbNM0ivK0560YCzP4hJ0iOZeaEiCTU0BJrEPblLrrlV hEAm7xgua+VD3na0CHCBXETqitu+y+6zukGX52zzUrvhHVDMFcgECJ1 X-Developer-Key: i=johannes.thumshirn@wdc.com; a=ed25519; pk=TGmHKs78FdPi+QhrViEvjKIGwReUGCfa+3LEnGoR2KM= X-Headers-End: 1rT3EN-0006th-RL Subject: [f2fs-dev] [PATCH v2 3/5] btrfs: zoned: call blkdev_zone_mgmt in nofs scope 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: Johannes Thumshirn via Linux-f2fs-devel From: Johannes Thumshirn Reply-To: Johannes Thumshirn Cc: Johannes Thumshirn , linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Add a memalloc_nofs scope around all calls to blkdev_zone_mgmt(). This allows us to further get rid of the GFP_NOFS argument for blkdev_zone_mgmt(). Signed-off-by: Johannes Thumshirn --- fs/btrfs/zoned.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index 168af9d000d1..05640d61e435 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -824,11 +824,15 @@ static int sb_log_location(struct block_device *bdev, struct blk_zone *zones, reset = &zones[1]; if (reset && reset->cond != BLK_ZONE_COND_EMPTY) { + unsigned int nofs_flags; + ASSERT(sb_zone_is_full(reset)); + nofs_flags = memalloc_nofs_save(); ret = blkdev_zone_mgmt(bdev, REQ_OP_ZONE_RESET, reset->start, reset->len, - GFP_NOFS); + GFP_KERNEL); + memalloc_nofs_restore(nofs_flags); if (ret) return ret; @@ -974,11 +978,14 @@ int btrfs_advance_sb_log(struct btrfs_device *device, int mirror) * explicit ZONE_FINISH is not necessary. */ if (zone->wp != zone->start + zone->capacity) { + unsigned int nofs_flags; int ret; + nofs_flags = memalloc_nofs_save(); ret = blkdev_zone_mgmt(device->bdev, REQ_OP_ZONE_FINISH, zone->start, - zone->len, GFP_NOFS); + zone->len, GFP_KERNEL); + memalloc_nofs_restore(nofs_flags); if (ret) return ret; } @@ -996,11 +1003,13 @@ int btrfs_advance_sb_log(struct btrfs_device *device, int mirror) int btrfs_reset_sb_log_zones(struct block_device *bdev, int mirror) { + unsigned int nofs_flags; sector_t zone_sectors; sector_t nr_sectors; u8 zone_sectors_shift; u32 sb_zone; u32 nr_zones; + int ret; zone_sectors = bdev_zone_sectors(bdev); zone_sectors_shift = ilog2(zone_sectors); @@ -1011,9 +1020,13 @@ int btrfs_reset_sb_log_zones(struct block_device *bdev, int mirror) if (sb_zone + 1 >= nr_zones) return -ENOENT; - return blkdev_zone_mgmt(bdev, REQ_OP_ZONE_RESET, - zone_start_sector(sb_zone, bdev), - zone_sectors * BTRFS_NR_SB_LOG_ZONES, GFP_NOFS); + nofs_flags = memalloc_nofs_save(); + ret = blkdev_zone_mgmt(bdev, REQ_OP_ZONE_RESET, + zone_start_sector(sb_zone, bdev), + zone_sectors * BTRFS_NR_SB_LOG_ZONES, + GFP_KERNEL); + memalloc_nofs_restore(nofs_flags); + return ret; } /* @@ -1124,12 +1137,15 @@ static void btrfs_dev_clear_active_zone(struct btrfs_device *device, u64 pos) int btrfs_reset_device_zone(struct btrfs_device *device, u64 physical, u64 length, u64 *bytes) { + unsigned int nofs_flags; int ret; *bytes = 0; + nofs_flags = memalloc_nofs_save(); ret = blkdev_zone_mgmt(device->bdev, REQ_OP_ZONE_RESET, physical >> SECTOR_SHIFT, length >> SECTOR_SHIFT, - GFP_NOFS); + GFP_KERNEL); + memalloc_nofs_restore(nofs_flags); if (ret) return ret; @@ -2234,14 +2250,17 @@ static int do_zone_finish(struct btrfs_block_group *block_group, bool fully_writ struct btrfs_device *device = map->stripes[i].dev; const u64 physical = map->stripes[i].physical; struct btrfs_zoned_device_info *zinfo = device->zone_info; + unsigned int nofs_flags; if (zinfo->max_active_zones == 0) continue; + nofs_flags = memalloc_nofs_save(); ret = blkdev_zone_mgmt(device->bdev, REQ_OP_ZONE_FINISH, physical >> SECTOR_SHIFT, zinfo->zone_size >> SECTOR_SHIFT, - GFP_NOFS); + GFP_KERNEL); + memalloc_nofs_restore(nofs_flags); if (ret) return ret; From patchwork Thu Jan 25 16:53:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13531468 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 436C8C47258 for ; Thu, 25 Jan 2024 17:09:40 +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 1rT3EP-0002Ig-He; Thu, 25 Jan 2024 17:09:38 +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 1rT3EO-0002IN-Up for linux-f2fs-devel@lists.sourceforge.net; Thu, 25 Jan 2024 17:09:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Fru1l8dAq84Xfh5gnq+lN/Z+UvKQa5FRHDYekqiQyQc=; b=at4p9iwMEvSXzl2M5mraN8gP9l AigzkafEJKZEbRI7C4cWHDPbQrLIy2PUxt032XvfJMoowlnKmldWcJL54j18DCVQSIG3oAIifyoQK 3lcZJT3tHfrHCokvtQmNYRUcmHfeFXSVJPckbrfNnu05aT0bgBguIXcQKCAX97U8ROks=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Cc:To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Fru1l8dAq84Xfh5gnq+lN/Z+UvKQa5FRHDYekqiQyQc=; b=eMU9gUZVcrLgQo98kc4CUgnNA4 ApSCzLO1bm5axSl8LbeCWgJzPyOV/vDjTf7Lfe4PbTH+EzESMmpp1FeTJwjyx/DX7sfqwx7gJ+Qaf sIVXstEN9DFmEJjtwvIdSOVKFv2FSwcJNS07zoAPDhC3D1KfnuTbcI20acISasnicQns=; Received: from esa1.hgst.iphmx.com ([68.232.141.245]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1rT3EO-0006th-KW for linux-f2fs-devel@lists.sourceforge.net; Thu, 25 Jan 2024 17:09:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1706202577; x=1737738577; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=jxy1iW5YBQpx2L/2XzM+MqzG0Ug1dnhtomAoOd2ZnbI=; b=LgQWzpQRuFDjiqVLcooFdfBAn4HZGVNzukm5SaVIsT70w9+ojBq5AP9S AMrzzmUPvfIh5US2gWynSHDgOrvczT3ERw+GNCz9sJOwQwpty6i0pdsbW fRWb0WlCDzfZSnW0BPYUTwIpa36JCVlfbEAzfbYFunSsqNyU456I7prTg DAR0HeE4uKem1j7McjwWJyvpRk6xazTxIUShiGweQg0Yuv536qYb++Ai8 0HdCDe6xnLIaA4xN5USUpxqegfUWGcgphE63QOe+cOhaX8g/6R6Bmgmuf 0rh3RL9/sNgXCeMiYyRwuLW2vQyJlszZYDXUu/tfz3D0OvjlAA/xhmGk2 w==; X-CSE-ConnectionGUID: dxgBAPzcThKs3Jyqopj9hg== X-CSE-MsgGUID: G/xJqNseTlGRrQUEBBAA2Q== X-IronPort-AV: E=Sophos;i="6.05,216,1701100800"; d="scan'208";a="7967101" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 26 Jan 2024 00:53:48 +0800 IronPort-SDR: 4GzkS1uonOFJTMqFqjCHBXOb9N2BneS0smOPHpAbIHRLnrCHvoBIs6J8UyfToxJfrF6TRcGBXF 4UiL1OAIOQUQ== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 25 Jan 2024 08:03:48 -0800 IronPort-SDR: vvINqP4GdCHHBUjrb+eTmiCcQWnfbMc+2pMGcRzFL6dLXp7d61N849rxXvVPTSMHLUafyk3OEY WA9UeNNLFunA== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip01.wdc.com with ESMTP; 25 Jan 2024 08:53:45 -0800 Date: Thu, 25 Jan 2024 08:53:27 -0800 MIME-Version: 1.0 Message-Id: <20240125-zonefs_nofs-v2-4-2d975c8c1690@wdc.com> References: <20240125-zonefs_nofs-v2-0-2d975c8c1690@wdc.com> In-Reply-To: <20240125-zonefs_nofs-v2-0-2d975c8c1690@wdc.com> To: Damien Le Moal , Naohiro Aota , Johannes Thumshirn , Alasdair Kergon , Mike Snitzer , Mikulas Patocka , dm-devel@lists.linux.dev, Chris Mason , Josef Bacik , David Sterba , Jaegeuk Kim , Chao Yu , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1706201608; l=1916; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=jxy1iW5YBQpx2L/2XzM+MqzG0Ug1dnhtomAoOd2ZnbI=; b=6us0f0y8sZaGXrk0YEnbz9rCMC7kxZhDixZl391EGOrX5/lIDzriXPbrRnxwUUYl4Zr6sOeSq 7toptEmDVs6Bj71yz4Kq8CNaR0lPsnmNTeTOXYxfHWc5XpmvrxgA/Op X-Developer-Key: i=johannes.thumshirn@wdc.com; a=ed25519; pk=TGmHKs78FdPi+QhrViEvjKIGwReUGCfa+3LEnGoR2KM= X-Headers-End: 1rT3EO-0006th-KW Subject: [f2fs-dev] [PATCH v2 4/5] f2fs: guard blkdev_zone_mgmt with nofs scope 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: Johannes Thumshirn via Linux-f2fs-devel From: Johannes Thumshirn Reply-To: Johannes Thumshirn Cc: Johannes Thumshirn , linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Guard the calls to blkdev_zone_mgmt() with a memalloc_nofs scope. This helps us getting rid of the GFP_NOFS argument to blkdev_zone_mgmt(); Signed-off-by: Johannes Thumshirn --- fs/f2fs/segment.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 4c8836ded90f..0094fe491364 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1971,9 +1971,15 @@ static int __f2fs_issue_discard_zone(struct f2fs_sb_info *sbi, } if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING))) { + unsigned int nofs_flags; + int ret; + trace_f2fs_issue_reset_zone(bdev, blkstart); - return blkdev_zone_mgmt(bdev, REQ_OP_ZONE_RESET, - sector, nr_sects, GFP_NOFS); + nofs_flags = memalloc_nofs_save(); + ret = blkdev_zone_mgmt(bdev, REQ_OP_ZONE_RESET, + sector, nr_sects, GFP_KERNEL); + memalloc_nofs_restore(nofs_flags); + return ret; } __queue_zone_reset_cmd(sbi, bdev, blkstart, lblkstart, blklen); @@ -4865,6 +4871,7 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi, block_t zone_block, valid_block_cnt; unsigned int log_sectors_per_block = sbi->log_blocksize - SECTOR_SHIFT; int ret; + unsigned int nofs_flags; if (zone->type != BLK_ZONE_TYPE_SEQWRITE_REQ) return 0; @@ -4912,8 +4919,10 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi, "pointer: valid block[0x%x,0x%x] cond[0x%x]", zone_segno, valid_block_cnt, zone->cond); + nofs_flags = memalloc_nofs_save(); ret = blkdev_zone_mgmt(fdev->bdev, REQ_OP_ZONE_FINISH, - zone->start, zone->len, GFP_NOFS); + zone->start, zone->len, GFP_KERNEL); + memalloc_nofs_restore(nofs_flags); if (ret == -EOPNOTSUPP) { ret = blkdev_issue_zeroout(fdev->bdev, zone->wp, zone->len - (zone->wp - zone->start), From patchwork Thu Jan 25 16:53:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13531470 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 2CCC1C47422 for ; Thu, 25 Jan 2024 17:09:41 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1rT3ES-0001aF-Pf; Thu, 25 Jan 2024 17:09:40 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rT3EQ-0001a4-QY for linux-f2fs-devel@lists.sourceforge.net; Thu, 25 Jan 2024 17:09:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=CLhezGN2ooOqwf1rRyp++iPoYB+U7gUCrqzkKgaViR0=; b=Sui7xFcZoTdemx9o16XSUVoVpL m9myWMeYdShsNY4uv+53VFr15dkcPBqPZzNsASTg+5U4l9ppl7dc9vzV+56yTtJKq0uhhKVVtxkw0 wFfsTo/vi+iGeAT0Vm40tgxhSKpahyLKLsscxOY+D75JkhwTvip8M6gf5NOejTxHfRjs=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Cc:To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=CLhezGN2ooOqwf1rRyp++iPoYB+U7gUCrqzkKgaViR0=; b=nIkdy4uQB7n57Us90zXxQKYxGk cgfz8oezZUGswVQ/mO3wx5pOVUvY4t5zO3vqdQ0tU/TacBkt+PbeRLxZ9W2MMN8wkDLFIvGTwlXn/ Y7M+ztvpHsA89KGsMJDX9/hO0lhzRfvQFKTpEDdAzR7QIKhgW3yGAMyZox5/3UXCC7p8=; Received: from esa1.hgst.iphmx.com ([68.232.141.245]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1rT3EP-0006th-8J for linux-f2fs-devel@lists.sourceforge.net; Thu, 25 Jan 2024 17:09:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1706202577; x=1737738577; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=aOQGuVXVKnWXSkXzQjMJhwwtHyTg4oH1lbCa+QOjXsc=; b=MI6K1t/OckqA+bb7xSqN7gMnDE7IjotUNmVi6WHKPEQUVoY5jx2WrYFw lq/X6CrUYpO0MsvpqH6hyXAzAqNWF7GHiFXBhHVGvhEPDbF9BUetgqGcM Ds3di3ipviNJQI81t/T2ncmrVMK20yc4Wo4aRfI4uQQ9Zg0MHZC3ohgiA 6eh2vlXIli+MhPcA+Ao+o/pi6A2B0egxC4ar7gvMK0wU9KvBT7o59T2lH uRJD1l2FTQYjcz5rAq3QSDntFWfVjHRlD85/wRNfJOqoPMfYzoKhEz8x0 Fwycnb6axZXfT/S6p/YBOlfoJEIcVYFTWrBXSeOwzIwcpDWkIhR+245YZ A==; X-CSE-ConnectionGUID: 0ArXqVS/Q8GWTyswGyjMOw== X-CSE-MsgGUID: 3drb8QGLRFymR+l5oyjpRA== X-IronPort-AV: E=Sophos;i="6.05,216,1701100800"; d="scan'208";a="7967116" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 26 Jan 2024 00:53:52 +0800 IronPort-SDR: 0LThULu3Mvnyij5E6Mx+kO4AAW5SOYYhDS1EF6rD4bgMkUupwkRVZ08JYg+xxnFq9zZmuhvV6W qdSAC6OtdnWg== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 25 Jan 2024 08:03:52 -0800 IronPort-SDR: TBCDD4Thkm8BrPR1XzWIPOZqfzdkz1041ne0LyGGutnRmfcC/stR3be2CIXXIpt7JC9paTeRFa RFgyYlmFlmlA== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip01.wdc.com with ESMTP; 25 Jan 2024 08:53:49 -0800 Date: Thu, 25 Jan 2024 08:53:28 -0800 MIME-Version: 1.0 Message-Id: <20240125-zonefs_nofs-v2-5-2d975c8c1690@wdc.com> References: <20240125-zonefs_nofs-v2-0-2d975c8c1690@wdc.com> In-Reply-To: <20240125-zonefs_nofs-v2-0-2d975c8c1690@wdc.com> To: Damien Le Moal , Naohiro Aota , Johannes Thumshirn , Alasdair Kergon , Mike Snitzer , Mikulas Patocka , dm-devel@lists.linux.dev, Chris Mason , Josef Bacik , David Sterba , Jaegeuk Kim , Chao Yu , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1706201608; l=8572; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=aOQGuVXVKnWXSkXzQjMJhwwtHyTg4oH1lbCa+QOjXsc=; b=8HbsS72JbdVISVJtRSkp1fHOlxfE3YR6cby4sKXHjUFnvYpEI/MMFArO04UDtfIQfvhJkYxY5 sfwKGXTd9KAAbvVOsOHpZ6pmMpLCZkWaDj9z/EQE1RRI+WHbigR7Vc0 X-Developer-Key: i=johannes.thumshirn@wdc.com; a=ed25519; pk=TGmHKs78FdPi+QhrViEvjKIGwReUGCfa+3LEnGoR2KM= X-Headers-End: 1rT3EP-0006th-8J Subject: [f2fs-dev] [PATCH v2 5/5] block: remove gfp_flags from blkdev_zone_mgmt 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: Johannes Thumshirn via Linux-f2fs-devel From: Johannes Thumshirn Reply-To: Johannes Thumshirn Cc: Johannes Thumshirn , linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Now that all callers pass in GFP_KERNEL to blkdev_zone_mgmt() and use memalloc_no{io,fs}_{save,restore}() to define the allocation scope, we can drop the gfp_mask parameter from blkdev_zone_mgmt() as well as blkdev_zone_reset_all() and blkdev_zone_reset_all_emulated(). Signed-off-by: Johannes Thumshirn --- block/blk-zoned.c | 19 ++++++++----------- drivers/nvme/target/zns.c | 5 ++--- fs/btrfs/zoned.c | 14 +++++--------- fs/f2fs/segment.c | 4 ++-- fs/zonefs/super.c | 2 +- include/linux/blkdev.h | 2 +- 6 files changed, 19 insertions(+), 27 deletions(-) diff --git a/block/blk-zoned.c b/block/blk-zoned.c index d343e5756a9c..d4f4f8325eff 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -177,8 +177,7 @@ static int blk_zone_need_reset_cb(struct blk_zone *zone, unsigned int idx, } } -static int blkdev_zone_reset_all_emulated(struct block_device *bdev, - gfp_t gfp_mask) +static int blkdev_zone_reset_all_emulated(struct block_device *bdev) { struct gendisk *disk = bdev->bd_disk; sector_t capacity = bdev_nr_sectors(bdev); @@ -205,7 +204,7 @@ static int blkdev_zone_reset_all_emulated(struct block_device *bdev, } bio = blk_next_bio(bio, bdev, 0, REQ_OP_ZONE_RESET | REQ_SYNC, - gfp_mask); + GFP_KERNEL); bio->bi_iter.bi_sector = sector; sector += zone_sectors; @@ -223,7 +222,7 @@ static int blkdev_zone_reset_all_emulated(struct block_device *bdev, return ret; } -static int blkdev_zone_reset_all(struct block_device *bdev, gfp_t gfp_mask) +static int blkdev_zone_reset_all(struct block_device *bdev) { struct bio bio; @@ -238,7 +237,6 @@ static int blkdev_zone_reset_all(struct block_device *bdev, gfp_t gfp_mask) * @sector: Start sector of the first zone to operate on * @nr_sectors: Number of sectors, should be at least the length of one zone and * must be zone size aligned. - * @gfp_mask: Memory allocation flags (for bio_alloc) * * Description: * Perform the specified operation on the range of zones specified by @@ -248,7 +246,7 @@ static int blkdev_zone_reset_all(struct block_device *bdev, gfp_t gfp_mask) * or finish request. */ int blkdev_zone_mgmt(struct block_device *bdev, enum req_op op, - sector_t sector, sector_t nr_sectors, gfp_t gfp_mask) + sector_t sector, sector_t nr_sectors) { struct request_queue *q = bdev_get_queue(bdev); sector_t zone_sectors = bdev_zone_sectors(bdev); @@ -285,12 +283,12 @@ int blkdev_zone_mgmt(struct block_device *bdev, enum req_op op, */ if (op == REQ_OP_ZONE_RESET && sector == 0 && nr_sectors == capacity) { if (!blk_queue_zone_resetall(q)) - return blkdev_zone_reset_all_emulated(bdev, gfp_mask); - return blkdev_zone_reset_all(bdev, gfp_mask); + return blkdev_zone_reset_all_emulated(bdev); + return blkdev_zone_reset_all(bdev); } while (sector < end_sector) { - bio = blk_next_bio(bio, bdev, 0, op | REQ_SYNC, gfp_mask); + bio = blk_next_bio(bio, bdev, 0, op | REQ_SYNC, GFP_KERNEL); bio->bi_iter.bi_sector = sector; sector += zone_sectors; @@ -419,8 +417,7 @@ int blkdev_zone_mgmt_ioctl(struct block_device *bdev, blk_mode_t mode, return -ENOTTY; } - ret = blkdev_zone_mgmt(bdev, op, zrange.sector, zrange.nr_sectors, - GFP_KERNEL); + ret = blkdev_zone_mgmt(bdev, op, zrange.sector, zrange.nr_sectors); fail: if (cmd == BLKRESETZONE) diff --git a/drivers/nvme/target/zns.c b/drivers/nvme/target/zns.c index 5b5c1e481722..3148d9f1bde6 100644 --- a/drivers/nvme/target/zns.c +++ b/drivers/nvme/target/zns.c @@ -456,8 +456,7 @@ static u16 nvmet_bdev_execute_zmgmt_send_all(struct nvmet_req *req) switch (zsa_req_op(req->cmd->zms.zsa)) { case REQ_OP_ZONE_RESET: ret = blkdev_zone_mgmt(req->ns->bdev, REQ_OP_ZONE_RESET, 0, - get_capacity(req->ns->bdev->bd_disk), - GFP_KERNEL); + get_capacity(req->ns->bdev->bd_disk)); if (ret < 0) return blkdev_zone_mgmt_errno_to_nvme_status(ret); break; @@ -508,7 +507,7 @@ static void nvmet_bdev_zmgmt_send_work(struct work_struct *w) goto out; } - ret = blkdev_zone_mgmt(bdev, op, sect, zone_sectors, GFP_KERNEL); + ret = blkdev_zone_mgmt(bdev, op, sect, zone_sectors); if (ret < 0) status = blkdev_zone_mgmt_errno_to_nvme_status(ret); diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index 05640d61e435..cf2e779d8ef4 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -830,8 +830,7 @@ static int sb_log_location(struct block_device *bdev, struct blk_zone *zones, nofs_flags = memalloc_nofs_save(); ret = blkdev_zone_mgmt(bdev, REQ_OP_ZONE_RESET, - reset->start, reset->len, - GFP_KERNEL); + reset->start, reset->len); memalloc_nofs_restore(nofs_flags); if (ret) return ret; @@ -984,7 +983,7 @@ int btrfs_advance_sb_log(struct btrfs_device *device, int mirror) nofs_flags = memalloc_nofs_save(); ret = blkdev_zone_mgmt(device->bdev, REQ_OP_ZONE_FINISH, zone->start, - zone->len, GFP_KERNEL); + zone->len); memalloc_nofs_restore(nofs_flags); if (ret) return ret; @@ -1023,8 +1022,7 @@ int btrfs_reset_sb_log_zones(struct block_device *bdev, int mirror) nofs_flags = memalloc_nofs_save(); ret = blkdev_zone_mgmt(bdev, REQ_OP_ZONE_RESET, zone_start_sector(sb_zone, bdev), - zone_sectors * BTRFS_NR_SB_LOG_ZONES, - GFP_KERNEL); + zone_sectors * BTRFS_NR_SB_LOG_ZONES); memalloc_nofs_restore(nofs_flags); return ret; } @@ -1143,8 +1141,7 @@ int btrfs_reset_device_zone(struct btrfs_device *device, u64 physical, *bytes = 0; nofs_flags = memalloc_nofs_save(); ret = blkdev_zone_mgmt(device->bdev, REQ_OP_ZONE_RESET, - physical >> SECTOR_SHIFT, length >> SECTOR_SHIFT, - GFP_KERNEL); + physical >> SECTOR_SHIFT, length >> SECTOR_SHIFT); memalloc_nofs_restore(nofs_flags); if (ret) return ret; @@ -2258,8 +2255,7 @@ static int do_zone_finish(struct btrfs_block_group *block_group, bool fully_writ nofs_flags = memalloc_nofs_save(); ret = blkdev_zone_mgmt(device->bdev, REQ_OP_ZONE_FINISH, physical >> SECTOR_SHIFT, - zinfo->zone_size >> SECTOR_SHIFT, - GFP_KERNEL); + zinfo->zone_size >> SECTOR_SHIFT); memalloc_nofs_restore(nofs_flags); if (ret) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 0094fe491364..e1065ba70207 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1977,7 +1977,7 @@ static int __f2fs_issue_discard_zone(struct f2fs_sb_info *sbi, trace_f2fs_issue_reset_zone(bdev, blkstart); nofs_flags = memalloc_nofs_save(); ret = blkdev_zone_mgmt(bdev, REQ_OP_ZONE_RESET, - sector, nr_sects, GFP_KERNEL); + sector, nr_sects); memalloc_nofs_restore(nofs_flags); return ret; } @@ -4921,7 +4921,7 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi, nofs_flags = memalloc_nofs_save(); ret = blkdev_zone_mgmt(fdev->bdev, REQ_OP_ZONE_FINISH, - zone->start, zone->len, GFP_KERNEL); + zone->start, zone->len); memalloc_nofs_restore(nofs_flags); if (ret == -EOPNOTSUPP) { ret = blkdev_issue_zeroout(fdev->bdev, zone->wp, diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c index 63fbac018c04..cadb1364f951 100644 --- a/fs/zonefs/super.c +++ b/fs/zonefs/super.c @@ -113,7 +113,7 @@ static int zonefs_zone_mgmt(struct super_block *sb, trace_zonefs_zone_mgmt(sb, z, op); ret = blkdev_zone_mgmt(sb->s_bdev, op, z->z_sector, - z->z_size >> SECTOR_SHIFT, GFP_KERNEL); + z->z_size >> SECTOR_SHIFT); if (ret) { zonefs_err(sb, "Zone management operation %s at %llu failed %d\n", diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 99e4f5e72213..8467c1910404 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -325,7 +325,7 @@ void disk_set_zoned(struct gendisk *disk); int blkdev_report_zones(struct block_device *bdev, sector_t sector, unsigned int nr_zones, report_zones_cb cb, void *data); int blkdev_zone_mgmt(struct block_device *bdev, enum req_op op, - sector_t sectors, sector_t nr_sectors, gfp_t gfp_mask); + sector_t sectors, sector_t nr_sectors); int blk_revalidate_disk_zones(struct gendisk *disk, void (*update_driver_data)(struct gendisk *disk));