Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp360750rdb; Tue, 23 Jan 2024 01:46:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IHM88UJfke9BsN8Afn04mM8b6w3HkvONhg7yogfBUR060LY5Wey4GxoB8OOckFgR1d99p9n X-Received: by 2002:a05:6a20:bca6:b0:198:fbc4:87fa with SMTP id fx38-20020a056a20bca600b00198fbc487famr5237626pzb.94.1706003161061; Tue, 23 Jan 2024 01:46:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706003161; cv=pass; d=google.com; s=arc-20160816; b=wHW0ueI+//DbryF5YIzvCLhq1YYWnt6DykNlDxyBsY6WHSo+Hni3Kr+rSyLb4GXQZL Fj0+Xn1G6oudTi5EXXBvGcDXm/O3PFead0JxTkiAc1jfNVte3eSQDqmdpc1MLlznVCI7 F1b+i8CJaL9maXF8Cat8vEtl/+buOEbN7EGWzdwsLj7u6hJVKOHZZWQaIs8hqxT1cp65 WCNdc4UHT9+4pjo9BSg/WFBM1quuM72+N4l0eTtTXsBqrESUYPCfDzHN3wBUwrkQ+Dvu 7Jf9k1Dsy6aw6YkLPOqAr76CBrpR3QT6/D4o4cImO0gTsAgv2zEBpokA/dCqWX10vnVP kaiw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:wdcironportexception:ironport-sdr:ironport-sdr :dkim-signature; bh=Fru1l8dAq84Xfh5gnq+lN/Z+UvKQa5FRHDYekqiQyQc=; fh=eAi0k/flagmBX9JQ48PVdzOcGziLUreSp20hhkaGOsw=; b=XATWJ9bjAVSgK/r7zOLgEFDNmyujKAy7P1h07l8o9tTYroOz5qjtHkcPW9S62G29xv ztt37dAHPBKnKW4xfUU2G9Ow4rKMpkEsX+d+qDIOuiqT4urm74Lk4u1oHCL6cG00KRu3 XvP+rC9tWpFv9H5ija0tDDbT0CIbRMQdlq+14wj9zr1hpeUijBlym1Mjo5RbwPeAB9pa O+yiYGCSQ63zfQ/NwA4G5jdBC9TY0tSSx3gMk0GSblBcS1XLXVZ1Lr8gm2rKg33aUmHy RHB3/eKpBuPHuzXOPnxAapsi4JOQzG5Rn/agi/5Tl3sK5ecpVT/Szl46ys3ft/SWS4JN A0ig== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wdc.com header.s=dkim.wdc.com header.b=JLJGboem; arc=pass (i=1 spf=pass spfdomain=wdc.com dkim=pass dkdomain=wdc.com dmarc=pass fromdomain=wdc.com); spf=pass (google.com: domain of linux-kernel+bounces-35019-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35019-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wdc.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d1-20020a170903230100b001d7587f372dsi2927557plh.213.2024.01.23.01.46.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 01:46:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35019-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@wdc.com header.s=dkim.wdc.com header.b=JLJGboem; arc=pass (i=1 spf=pass spfdomain=wdc.com dkim=pass dkdomain=wdc.com dmarc=pass fromdomain=wdc.com); spf=pass (google.com: domain of linux-kernel+bounces-35019-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35019-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wdc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id AFED7288AE9 for ; Tue, 23 Jan 2024 09:46:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 264DA5DF1A; Tue, 23 Jan 2024 09:44:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="JLJGboem" Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D93005D8EB; Tue, 23 Jan 2024 09:44:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.143.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706003048; cv=none; b=jjXhc75YdNgr4qZxJoYwJF3jKWZIh9wZiYPED/0KuGMQ7D+SAQlvcncr+pCXyPl3XAasBWKyHp12V/2lTmgMiFYCY5Ah7Fjb9g88Lxlnlw8sLj37MBHqHMpHXMn97uADFGVr0/pxS0hJBulalo0X/6pmvEGGFqe+EXHlrG3R3nM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706003048; c=relaxed/simple; bh=jxy1iW5YBQpx2L/2XzM+MqzG0Ug1dnhtomAoOd2ZnbI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JQyeOSAxwxKJdUxMTEbJguZSGrhxq+YuU6DddaISzpx+GdEewqP0Y6qLx33A0/WMcvPtYyVGiv0POK31v1ioqlEexU6Ls98oo0pL0HuSngZ0yRfefXytl4z5NL9xPnIPEw54AcKIKFIjWAOBtpqxCm/Eq/Vmx2F4bkER77yZADg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=JLJGboem; arc=none smtp.client-ip=68.232.143.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1706003046; x=1737539046; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=jxy1iW5YBQpx2L/2XzM+MqzG0Ug1dnhtomAoOd2ZnbI=; b=JLJGboembopjgrt1zs02eflyRAHG8H9nuF5Vr2P3fVdIy0Fg844RYwaJ 85jGeIVggcv7CVmCpHsFgvJO1Zx4dGssMIiJAqnIcSoCdchUhZutVzA2n B9BOPijtqJbu9VXmkiequ7axE5pUIjyWJ9r9nL3SXqMdNc+V2ywavBur1 zgWAWnSje8KfpAvQO22vfujz9VfmYwAM+uE5s6T6inUMXfoBo6hUqA6Fk fCi1cXGd/sXzhwB1tSgJNaViOk+sN10aIhZQPCXMMox8x2yvqUMXHHAWf rQ2ji/kxu2oOS765nxZMS8WuhoPUvMrtD+ismSf+fwghsow+nBD27eY7e g==; X-CSE-ConnectionGUID: 7qswTcyESwiRNvCm+t8XhA== X-CSE-MsgGUID: te0q95g/RwOIyGX+bKGM0g== X-IronPort-AV: E=Sophos;i="6.05,214,1701100800"; d="scan'208";a="7514667" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 23 Jan 2024 17:44:05 +0800 IronPort-SDR: sLqNwAQ7YHnZIBl3IEvWOUIg9isqJQ2qAvuDmuUzzQRTTwWsfqrnI+fY7L9+5QvL4Quc5mafaZ TLXEsiHENqog== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 23 Jan 2024 00:54:08 -0800 IronPort-SDR: IOh8OwQ887uF8FYicwPpeIj8pGPKsumfi+cLbrdodtKz/molf3mfeRtZvITdJ29oAO3ta0WwLL KVxG7oRWNRUw== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 23 Jan 2024 01:44:02 -0800 From: Johannes Thumshirn Date: Tue, 23 Jan 2024 01:43:45 -0800 Subject: [PATCH 4/5] f2fs: guard blkdev_zone_mgmt with nofs scope Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240123-zonefs_nofs-v1-4-cc0b0308ef25@wdc.com> References: <20240123-zonefs_nofs-v1-0-cc0b0308ef25@wdc.com> In-Reply-To: <20240123-zonefs_nofs-v1-0-cc0b0308ef25@wdc.com> To: Damien Le Moal , Naohiro Aota , Mike Snitzer , dm-devel@lists.linux.dev, Chris Mason , Josef Bacik , David Sterba , Jaegeuk Kim , Chao Yu , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, Johannes Thumshirn , "Matthew Wilcox (Oracle)" X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1706003027; l=1916; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=jxy1iW5YBQpx2L/2XzM+MqzG0Ug1dnhtomAoOd2ZnbI=; b=3ZNl4h+s8HSPaptSA3bTG7Cc54lypNN6lGHNAsGVtJDwGDQrTa34PvB3BXdfTQsyIQIenyPIa XCtHIB+z9g5Bw9M9so4He4f+ztWTV5lnoteYP3kS9WTufWUnEYW9XJS X-Developer-Key: i=johannes.thumshirn@wdc.com; a=ed25519; pk=TGmHKs78FdPi+QhrViEvjKIGwReUGCfa+3LEnGoR2KM= 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), -- 2.43.0