From patchwork Mon Jan 29 07:52:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 193312 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp417826dyb; Sun, 28 Jan 2024 23:57:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IH+TO/qvZG88u23xjbWk/InM8dN8VXrqwxj3oWKeTmwXXqCH6wk+Frpo9WA5+15HLm7BV6n X-Received: by 2002:a17:90b:291:b0:28e:848c:74cd with SMTP id az17-20020a17090b029100b0028e848c74cdmr1532366pjb.49.1706515051399; Sun, 28 Jan 2024 23:57:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706515051; cv=pass; d=google.com; s=arc-20160816; b=qWSR9OxiIZuH3X69ED5UsYfxngHsse2rrsjMp6lFwBoKg7VJlAoym5mYekmD5AIGWj NmGYKVh2Ys/LY51A8rqNEwp8okgxznLKeM/4Xee0KWMtahFxH01XPpdXkxTNtZCzO8yZ WYPTjcPI20zCN9RNxDJjyHhyqsdcAthzy8/v5klVmWG/K+R26bvC2hROgxRya1EtnzQO +ys3lURvQUb7g+IUIzcaKFYnl0Adcd7i9h/hcMb5apftO23J70/eFD9uvF6y1b/xpjcQ ekO9nQfTPWjqmQ5fy80EAvGYlC65k2UYtg5oOWBxuMyKn1TodjuW49mUthuKfpYS9GYB c/Vg== 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=vtx/9SjU+G6yTbfUE/Jg3PhHwMv090uaPA+oNrmxeyw=; b=hRhSpaSTlLiVCC8LBVC21JEXT2FbltrySxGTufBRahujE9SAdJPSCc5N8n3+2cOATY jxr/H7WLzq7e8glz4R5uiwa6swmU4Bx4MFXou6LwKadgaS50YNSOkV3pAWrROU3RSbta TZk5rNCbv7NkXN0WBkN6UMPeK7rp4z+fA0tCVwh8oeU1vw7aumkYGqDLznqAPUYxdxar lvskj4g0deqwt73L9+2UDk13LGznqQYQu58AsGnJ97w9huoV5CUOtie6Db2vOtBvCDSN xGEJ2txU5sxZBrHCwFduVW7ATm72062jnfonHGjGpquFVXy7e9PYACJ2WUN/jWOoMYYR YNvQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wdc.com header.s=dkim.wdc.com header.b=LLs5ki5P; 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-42307-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42307-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wdc.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id a2-20020a17090a688200b0029045a7dceesi5331792pjd.136.2024.01.28.23.57.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 23:57:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42307-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@wdc.com header.s=dkim.wdc.com header.b=LLs5ki5P; 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-42307-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42307-ouuuleilei=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id F2376B23AB3 for ; Mon, 29 Jan 2024 07:55:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 701FA56461; Mon, 29 Jan 2024 07:52:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="LLs5ki5P" Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) (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 A9A2F54FAC; Mon, 29 Jan 2024 07:52:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.141.245 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706514763; cv=none; b=fD7trqdtpew42KDbOfhSXy5dY45IniPjdjnz+xyLylhWJAudLVaZmhqqU5ZZqR3HsMjk6WfbQSBaWxFohXACrHPw1hYIqkAw8HR0LRsvKiVD7o7yRiKniAMmra+h7mFQXwj+GKbIhFB04wIGccNSQCWZiOg3LJsAZslFRlJazpc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706514763; c=relaxed/simple; bh=jxy1iW5YBQpx2L/2XzM+MqzG0Ug1dnhtomAoOd2ZnbI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MnOl4yW4ax2b1vfi56BWuk+T1Qsw6M+Wqz+r6yRKuKTQrBXE2w77sPejneIHMEbroxVKgTDLNbLBTubPWp9+FzTtSz9aMbn3D27S3kad0s8mO36pqfLSN9Hg44IQ4PIWm+ZPhMaw6U5adbMC8REWJFwaK9EMVb8J+iWv53gVsTk= 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=LLs5ki5P; arc=none smtp.client-ip=68.232.141.245 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=1706514761; x=1738050761; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=jxy1iW5YBQpx2L/2XzM+MqzG0Ug1dnhtomAoOd2ZnbI=; b=LLs5ki5P7p4tIlwCHZ8IokUa+QAnY53bYyj9Tsstn4no5tEeiXgRzp6x JHypCUm2oAc/aArXycLz/yElfTI5K5HubfOk0Y+shHBC0hYFHjJv4eOZm c2+zzZLlx45rTCDPeRhpQ1qA8t8a2uRl6Gyyv0ZM92vyCD1AqcW3GGFI+ XRSBPACrRX4EaoA6ugWJinmBMnFJF9nBko3zpNrFIW6KW5dZ6/XZttOgH 06y7n0Jushiw1JCNWEEVpBsJucJ6zLGy6qg+2JWAwPf/fPbpTqn9bEETp sSUkmlNfhjSslHVnwyeJTMcwe8TSVbHZZ7a1k44j/15N5yZ6RV/6zOsz9 w==; X-CSE-ConnectionGUID: HFhZjRb7QRWOFmR/LvmBTw== X-CSE-MsgGUID: urPmD0xASTevSJa8jmrupA== X-IronPort-AV: E=Sophos;i="6.05,226,1701100800"; d="scan'208";a="8194638" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 29 Jan 2024 15:52:41 +0800 IronPort-SDR: KTQ3lJrMIj/4DNsUTqm/EbPG5L5/tVZ89YUKuXekVCMw9khOpa1iQ9V2p1TrsdSy5DaZi1eH5/ 1Nmndr/UYi1g== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 28 Jan 2024 22:56:56 -0800 IronPort-SDR: a6fqmhL2Ifron5h/FtoAVEOrd9znA+k+ph2NG7O67agAlvm0Y7V7iCtpbCu6M/MJk4AD1wdZc5 lY5ZpgbYrY7w== WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 28 Jan 2024 23:52:38 -0800 From: Johannes Thumshirn Date: Sun, 28 Jan 2024 23:52:19 -0800 Subject: [PATCH v3 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 Message-Id: <20240128-zonefs_nofs-v3-4-ae3b7c8def61@wdc.com> References: <20240128-zonefs_nofs-v3-0-ae3b7c8def61@wdc.com> In-Reply-To: <20240128-zonefs_nofs-v3-0-ae3b7c8def61@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 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 X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1706514743; l=1916; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=jxy1iW5YBQpx2L/2XzM+MqzG0Ug1dnhtomAoOd2ZnbI=; b=WNhlN/WUiVsCIwNsWqvPqEUFWWkuiJG89IzBO1pf2asviyjGf9vbFRjhczVfFzZ0feh+zpKXW lyy5ndmQY+iB2Brlr6oHL1WocSEl93rc1te3zHZBE7MogUUIPxesD7d X-Developer-Key: i=johannes.thumshirn@wdc.com; a=ed25519; pk=TGmHKs78FdPi+QhrViEvjKIGwReUGCfa+3LEnGoR2KM= X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789410726196949155 X-GMAIL-MSGID: 1789410726196949155 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 Reviewed-by: Damien Le Moal Reviewed-by: Chao Yu --- 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),