From patchwork Tue Jan 23 09:43:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 190808 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp222639dyi; Tue, 23 Jan 2024 01:46:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IGi/1UQVBgoousBoz69QaOHczSeYQ2HA43wjGdzCTj9DbWp1nz2+yTxI6+kv9ANF9j6QyoC X-Received: by 2002:a92:d303:0:b0:35f:fcb2:d57b with SMTP id x3-20020a92d303000000b0035ffcb2d57bmr4004693ila.128.1706003171462; Tue, 23 Jan 2024 01:46:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706003171; cv=pass; d=google.com; s=arc-20160816; b=yRKbcd7j5Ldgi0888i1RlHscb0Se9oplQbpUuKrrm1ajBp8toebWgYuBDFXTjHWNXD sKWIXLunXuMm8TCn3bPeB3dT7HIobf2J5x2/w0civ1oeCXXHUrq2W7jbHhX6Ro9a23/w gEuQQETRYRp3Ksw7OiA+gk9HtB7uxUXVdwYeRAXrUwhUpnXdlVoTuOcBbk10zZPj5nJK lLQfzUjXBLZfLUehoD+NC3ChaNlVLRLN2sHtmCC9d7vS7rph4H2O+C97zCrFr1jOzS4P pMMHcvN/EIZ4+PzjJt1wDh0QJ0sjwQ8FaRbn4hLw0l2PseVQB10vbNBYu14m0Sh/WEar QZgQ== 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35019-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wdc.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id s123-20020a632c81000000b005cec620c36esi9561776pgs.460.2024.01.23.01.46.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 01:46:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35019-ouuuleilei=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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35019-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 34A77288FDB for ; Tue, 23 Jan 2024 09:46:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EF3255EE62; Tue, 23 Jan 2024 09:44:10 +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 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= X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788873981476408224 X-GMAIL-MSGID: 1788873981476408224 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),