Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1512171lqe; Mon, 8 Apr 2024 10:56:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUGo8WIoqCpP0TYlYV8W4O982FFdBQibXnjTdoWtLzg30wuI+rOoL+T1eHmFiwDMyD1JjReQIJU6y79MTIEIkycupJ5OS1/7Twh7tphlg== X-Google-Smtp-Source: AGHT+IH89yXwXmyHqSKnxPYr8r5oWINIb09g8oWs1xGK6EHkHh4R5HfAPR/q04lcVm6KoyodcSXx X-Received: by 2002:a19:9155:0:b0:515:e6bd:2f13 with SMTP id y21-20020a199155000000b00515e6bd2f13mr5121194lfj.15.1712599001641; Mon, 08 Apr 2024 10:56:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712599001; cv=pass; d=google.com; s=arc-20160816; b=hXi7TmwKWmopJcBj+FbfzQ1drCgAFOywefqKMHLOBDSRmMF/Xdb6yCUTlXDzd3D/Q2 jhyqK9m4KdsD8NAbosCLepKO+d7i3cQkE+zc9xJBU8nUoLlJd/GlCFaVM8ZV9Qaq9Xpc wILFKTv6P8i4ZTFGAEKsgNsrQOB5pDxs9aNkZ/YrcUKX7tenpKWPfOhVk/LZx8WIAhkz WGrLUw1Csmt8plpcxnCq/pt6PjVgVemipQcp1zGObnCxWyqrdsoMIx1qxtwfJyMFVlpp y3CV3FhJVep59J42bU8Yw5FArL6uDWTmJOcE3KiS6XbMrQh1krUC8x6ITqYdAu+bS3Fx uXAg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=2/dc4+cjV1nRvMlJvOrHmfnnqBQu1vw9EU5dHurwIFw=; fh=tihVe0fxDOGsjiZbAGdLK+dj3OwJ+YwPhutQSgXKhoA=; b=SfTnlgzRK1tZ+uTXD6EBPayVDKhTtlafxsYFNXvPyuRx3Sut4O5tOhjfUi6q+xDjWQ MFZb+e/vgzijs171flr1qgJ3Uc3JKuwe3OCEKM+Kulswbuj2d+KDOE/+oO7i7qMK2MHE 9Io4HD6uiG4s6Smcq+H4lyCEO5dRCywv8DHzyeDL7c1Cwf6wQtVIJPBC1fvHMTDi3fv5 97+rytBNNcuVLGdQLryWMGjM0RXHy1M7OCVMJFUhYRD1ktbYBZJDr7K5rzKF+ebuZicp e34bsZXv9sl9o6YCZiQfGhlnVluIwqhZrN/QLrL9kLDrd5muS6BH36ZGFvtCZoAlIdu2 wEQg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=am3NTPIK; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-135790-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135790-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id cw20-20020a170906479400b00a51d83c1af2si1078048ejc.119.2024.04.08.10.56.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 10:56:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135790-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=am3NTPIK; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-135790-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135790-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 am.mirrors.kernel.org (Postfix) with ESMTPS id E347B1F262C8 for ; Mon, 8 Apr 2024 17:56:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B9F21442F8; Mon, 8 Apr 2024 17:56:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="am3NTPIK" Received: from mail-vs1-f50.google.com (mail-vs1-f50.google.com [209.85.217.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D6D61E489 for ; Mon, 8 Apr 2024 17:56:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712598993; cv=none; b=DZ1KLvmvxCmqj9uSc/ksoyy6aeKgIUrSBcWkSKelYm96V82C6Xg1wGkY9dcRBr7bp+GK2JQ85aQ3+42mNR1+4RIXC+nLbXCxo12y5AM39cYTXC3tC2dCm2zqAkNbLmbbev5A8w7Kj9FlHNs1p6pxfOH0jGJlv9YM45wtg2F/H5M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712598993; c=relaxed/simple; bh=AjIP/aIjADY0dHfSZONVNpKc78h8ru+dlReyZG+LToY=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=st4oTdV8ga8MbOcPBjHMYxdJVRmsXm1Pr+bsZgsNWkj9xN8QuZc4s7clxRtJ4WTh7q7fKmLtU995Rvm/vXT4u+RyLgUdyZmGDKJEkU5auVVE0T2zSCUH8UTQcV8kf2BHDoBEGNrzIuyhKedZn1ZbBAS1hraHZz3z5aiDBPYyT1g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=am3NTPIK; arc=none smtp.client-ip=209.85.217.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-vs1-f50.google.com with SMTP id ada2fe7eead31-479c9c2d2b0so1399534137.0 for ; Mon, 08 Apr 2024 10:56:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712598989; x=1713203789; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=2/dc4+cjV1nRvMlJvOrHmfnnqBQu1vw9EU5dHurwIFw=; b=am3NTPIKO4olo0X1UtDGl5BwqUMVoFc2kVtIrZnm1w1uYzqih31DEAnfjBDbjtW/Ig hEbRaxxWZh8CLh2p1U1WUawAQwzrjQo03C2+oEHx2NnSTVPNFDXunDd+p9eW1jayFVmx ZU/OZPgDg7qAqcHtJ2bmmyvRUHRjfbSJQHWwH/9SK8fMrA3FWoEqNWV9jK/G9GVCU8OD zOLmemnPpVvS/W3OMVwEuV0qssmbw8IFDCZWYanNzvS+X5vwSJJiBai31szJAFU0ew6C IXB+Zr9uvqczdxbfNw/cnXZygtfgBPJdgRLbUJfJDNsOPXPPy91C3Nr+7L+ZRZAYZ/XM qRrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712598989; x=1713203789; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2/dc4+cjV1nRvMlJvOrHmfnnqBQu1vw9EU5dHurwIFw=; b=SFSKyvHVOAB32S28mXzGX+DmzDd/h3EjgHgzv/0e7mai7G4idWQ59gFzXxRg++Dicf wmJmNASNpi5Yi1F34SVLukjwAdJNvf0/476EBMjH4Kh/Vh+qlTpSgvCYAa7gC9ogMFhI zuuCDWkTnSb1Ps4vsBUjaUZWLnULg+LWwnrNSjd7RyfZn7auRP6q5X0yayvh8/RIHj8C M/AicF8PA2M6ygfZrouPAWsGL+zozm23inXZHr7ESBVVZ8viYsVs4tz3v9eO/8N4I/MG 52nTHF5Uyljhp+apX0RJDwTXTvtXwJFZDbgj25abHP6qPeM5joZU7HlH/rFSifgZsFnQ wrhw== X-Forwarded-Encrypted: i=1; AJvYcCWC+TRTXwC0ohLciXGguAPadPTPl0S9isdOX40glBYsgsbK9o5t7Ys/H10cZml3NenElKhyJhMZcGFWzeK5+8tC6JQTNrRqafPLuPsk X-Gm-Message-State: AOJu0Yx9+hdq/J0tVAcVyNNgDqdc5S7qzu6bQPUjKF2GreUSxeMn/5jV 2g7bGeLBNxaAjvSK0l/F0E1gYY7wJjP5s7VzlbOS6puqCO4h8dBNld9vxB8oGH4MTq5V8hSCUqh yfsH+kWZpKw7zWzl4n5CeD3oIZ88= X-Received: by 2002:a05:6102:c51:b0:47a:a6c:9e61 with SMTP id y17-20020a0561020c5100b0047a0a6c9e61mr2424671vss.16.1712598989527; Mon, 08 Apr 2024 10:56:29 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240407072123.3484300-1-chao@kernel.org> In-Reply-To: <20240407072123.3484300-1-chao@kernel.org> From: Daeho Jeong Date: Mon, 8 Apr 2024 10:56:18 -0700 Message-ID: Subject: Re: [f2fs-dev] [PATCH v7] f2fs: fix zoned block device information initialization To: Chao Yu Cc: jaegeuk@kernel.org, Wenjie Qi , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Apr 7, 2024 at 12:23=E2=80=AFAM Chao Yu wrote: > > From: Wenjie Qi > > If the max open zones of zoned devices are less than > the active logs of F2FS, the device may error due to > insufficient zone resources when multiple active logs > are being written at the same time. > > Signed-off-by: Wenjie Qi > Signed-off-by: Chao Yu > --- > v7: > - check f2fs_sb_has_blkzoned() instead of multiple-device condition > in f2fs_remount(). > fs/f2fs/f2fs.h | 1 + > fs/f2fs/super.c | 27 +++++++++++++++++++++++++++ > 2 files changed, 28 insertions(+) > > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h > index 0550929dc6e5..694f8a52cb84 100644 > --- a/fs/f2fs/f2fs.h > +++ b/fs/f2fs/f2fs.h > @@ -1559,6 +1559,7 @@ struct f2fs_sb_info { > > #ifdef CONFIG_BLK_DEV_ZONED > unsigned int blocks_per_blkz; /* F2FS blocks per zone *= / > + unsigned int max_open_zones; /* max open zone resource= s of the zoned device */ > #endif > > /* for node-related operations */ > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c > index ba6288e870c5..fdf358c7f808 100644 > --- a/fs/f2fs/super.c > +++ b/fs/f2fs/super.c > @@ -2324,6 +2324,17 @@ static int f2fs_remount(struct super_block *sb, in= t *flags, char *data) > if (err) > goto restore_opts; > > +#ifdef CONFIG_BLK_DEV_ZONED > + if (f2fs_sb_has_blkzoned(sbi) && > + sbi->max_open_zones < F2FS_OPTION(sbi).active_logs) { > + f2fs_err(sbi, > + "zoned: max open zones %u is too small, need at l= east %u open zones", > + sbi->max_open_zones, F2FS_OPTION(sbi).ac= tive_logs); > + err =3D -EINVAL; > + goto restore_opts; > + } > +#endif > + > /* flush outstanding errors before changing fs state */ > flush_work(&sbi->s_error_work); > > @@ -3866,11 +3877,24 @@ static int init_blkz_info(struct f2fs_sb_info *sb= i, int devi) > sector_t nr_sectors =3D bdev_nr_sectors(bdev); > struct f2fs_report_zones_args rep_zone_arg; > u64 zone_sectors; > + unsigned int max_open_zones; > int ret; > > if (!f2fs_sb_has_blkzoned(sbi)) > return 0; > > + if (bdev_is_zoned(FDEV(devi).bdev)) { > + max_open_zones =3D bdev_max_open_zones(bdev); > + if (max_open_zones && (max_open_zones < sbi->max_open_zon= es)) > + sbi->max_open_zones =3D max_open_zones; > + if (sbi->max_open_zones < F2FS_OPTION(sbi).active_logs) { > + f2fs_err(sbi, > + "zoned: max open zones %u is too small, n= eed at least %u open zones", > + sbi->max_open_zones, F2FS_OPTION(sbi).act= ive_logs); > + return -EINVAL; > + } > + } > + > zone_sectors =3D bdev_zone_sectors(bdev); > if (sbi->blocks_per_blkz && sbi->blocks_per_blkz !=3D > SECTOR_TO_BLOCK(zone_sectors)) > @@ -4191,6 +4215,9 @@ static int f2fs_scan_devices(struct f2fs_sb_info *s= bi) > > logical_blksize =3D bdev_logical_block_size(sbi->sb->s_bdev); > sbi->aligned_blksize =3D true; > +#ifdef CONFIG_BLK_DEV_ZONED > + sbi->max_open_zones =3D UINT_MAX; > +#endif > > for (i =3D 0; i < max_devices; i++) { > if (i =3D=3D 0) > -- > 2.40.1 > > Reviewed-by: Daeho Jeong > > _______________________________________________ > Linux-f2fs-devel mailing list > Linux-f2fs-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel