From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (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 EA2C930E85D for ; Tue, 25 Aug 2026 16:15:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=209.85.167.42 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787674513; cv=pass; b=uibMN1StuU2TxU4TZm5dlVFX32vVCCRaf7NBbnUjHFAcqwmNq85vimrxf7P1ddMq4JN2k99X5xVe0DYxfY5LOaS7BMnJKqzKwWa6U5vjUS4vm6n7U4ihp2H3wmQ+ODAk7l5jU0YbsNolnpII4WOuc+5JfNV5v5DvjrhvciIIic0= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787674513; c=relaxed/simple; bh=zMZpbLWTHkC0l18Fw0OJ7LvEkntSrEspjKES0BFBhOQ=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Q68dsOVrRmUrY8eu3/gYXLAdtLSe6PPWch8zYlL0yju73UPP2B0S8ojXVXFkizZTScgHmBNQrhy+BFj3kAqm4yVzKJT5GjSLDIlW/ROennrqdzmZk9inlyctaEzV2AZZT4UiN31kGQpxhVG/3NCgfgUzpe40bCeAIPfIeTKTybk= ARC-Authentication-Results:i=2; 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=pR1ehmlW; arc=pass smtp.client-ip=209.85.167.42 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="pR1ehmlW" Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-5b0231a3e86so1649001e87.0 for ; Tue, 25 Aug 2026 09:15:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1787674507; cv=none; d=google.com; s=arc-20260327; b=G92STeps0ZmFaOT/N45jMg4BDnAwvgZ16uI+32JoclDdEcx8Iw1rsahs927zaEhHMo 5aI1ASIP2wP6znHCM1fVSHVvLUSkuozvtEWAtWbdbF0VSLjsYuVgsRluphyFWW07SQYu 0LRY0dz31juYacARc8LZvc4nHKTME8fYs9P6PbOk5Y+2tbqy501hSzk+HH3T4l2+Hd8z aMulp+XvuS5EeF5lIJ1vyCX1GgQlzW5caN3acp2+CzFoKvtZL3fybBR0QhlvPDr9jfE7 RqMONUZ5BGdIa2j3k8hePdurz6NazF0lWwgsOUZrn/IAi3plNBHPrCAIt/bC4Vi2R17J v60Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=JcgPISHXGks9VIdirda4p9296SHUiZUuOtkw2wy+iAI=; fh=sPilOYAT4QfMgYxGH2LjRrcqbLUzvrQqMQUicHZMufQ=; b=G083tzcmROeTmgcu5qK2HXBRy0UDJpuA69LiLEUeHXpUBFpws1b99tmXvqbbnPTMcS W878D9pKM8nUrKgHPi3giKS9e3JbA8mG9WxysjEwa0D204UIS0h/c9rU3U+NlwCPmSLz Y1Y+ba6ky+OrVYh19JmTythHQZjD54w5z9jRduGCD0XtSatZwEtFLqi4q/LpPbruqP7e FAdTj8e+UduvpkGakyu5YuvOL/0n8unJ+8ki9G5Bf6qrhcWX4q6q+9Iqs+0HSJU4T3IM gujhywAh0xfz3/OVu2qlX3B6DOpglPpD2nihrYRxfbpT5bDPk97q/K0bW878keiTZ5Jv nc7w==; darn=vger.kernel.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787674507; x=1788279307; darn=vger.kernel.org; h=content-transfer-encoding:content-type:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:from:to:cc:subject :date:message-id:reply-to:content-type; bh=JcgPISHXGks9VIdirda4p9296SHUiZUuOtkw2wy+iAI=; b=pR1ehmlWQA0JlvoGHBO19CLzfWREawSchJv60aj2VSg5UPCK8rYJ3JN5EA+rSv31bE xUxbgsrJRehOCNlFYAYhcNjrSf6NcJBPcGCgS5b4zrzOhrbJxqhVvxeObiZp0DVeUG3w J+54TxK/LilruwMUdc53kC3QWFq+EvhheUOtPl05C7iBfQSyyb2kYoy0b9mfSwrEiO5Y siA2HVQoUS61H5DBjcygNXNhHz6IYpG8v74IzwMutbWgMZNDSGce5RKq9vbuFb/443+v HgaChcZsE0ja6piKzL9SzDs8blZyzfycFe9nySgxP44DUXT1b96CkBmW2TBSnO4KfkPY +F6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787674507; x=1788279307; h=content-transfer-encoding:content-type:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=JcgPISHXGks9VIdirda4p9296SHUiZUuOtkw2wy+iAI=; b=EDrQt2pdL3o8kTkz3Aor2ukG85fGlPXOV6rVlfGQymIxY36MmXqGdHwpnD+6n9pzLb edAnMu4kq5KfZ/bRyLDDzOWgl0n2pTl+C4CNZa2JtP1k3l7o+b6SlWuzSysoxbjSM3sG vR4hIcpBISSIsacJkL0CaLW/EM/5CAYUctxqzX/boqq05X6MbEw1w85lUZZvUh1j6qJU +zrRAvY0zZoCilkRcozFm2LL1CJfZN12zD9pZLl5q2wcHblb/4G3uQPwnKXxyTRvo+54 2XKDQSt6DfRn3gCpMvs6kABUeSajq0O5LVEUGxmP9dEwS9DTIwRYSBgorj9vaPNMOgAb m5jQ== X-Gm-Message-State: AFuF++kIGWkOhXjRIdu4yN3vg4F94w/DtyOIX0D8LNkkzZdYOPUto/rC HI0RT+Ji73j6NFz/LwV29ZgFb3jedJiI3ZY9wW3XxN6r443v1mpyKTkuLqMkfgP3tZpk3r3Uub9 pipFWHAA3APxszexmWAdVI/DdglHItW8= X-Gm-Gg: AR+sD10woQeldQGI6d0CnWYoOkwZUCeEHIjtLiivxGzLMgPrjZbTs1Vf+JDzS0HnNFE OKHUldi0PRTHEEVd9LOAJC4SHbkJiG5hdwMMpIw6EJiKKEMG1snuOnbsm4OwGGpKmje/ljwH/Ub AU4ivm87XiQgiPmUjAbBhcbx38iIo+/Y9CaRLWsuwRrBppH2WOsf/JMcZ9I2/STdYilrTXw5Q9W pASyd278TKYJEDcF1TxmRFPBr1c8eNicUSdBzM+f9+ZtTNfBwYdtz96J5gCZ4v7/otW8QtwVvjy 0Pv3wXw/5ZdXQJIwSj+/Nw8+mJPve6lVGW9u7Ti3RxU76hPFRgOnxMcwmUL0FU4a4cQhyLsZfNM T8MoPMQrMjTEP2D0PgXogx+Iun+xfqyM= X-Received: by 2002:ac2:51cc:0:b0:5b1:4cb2:e7ca with SMTP id 2adb3069b0e04-5b48b89e208mr9458049e87.18.1787674506992; Tue, 25 Aug 2026 09:15:06 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20260824191404.2558269-1-daeho43@gmail.com> <093eae1e-f533-404c-b8da-f5025d4e3db2@kernel.org> In-Reply-To: <093eae1e-f533-404c-b8da-f5025d4e3db2@kernel.org> From: Daeho Jeong Date: Tue, 25 Aug 2026 09:14:52 -0700 X-Gm-Features: AcwNN1X22482uqxmSsgvAqYleHA7IQ9Ro7nlH8ISnaxo1YVSAvwBxsuF-w4ntEw Message-ID: Subject: Re: [f2fs-dev] [PATCH] f2fs: support resizable tail section and unify pinned allocation To: Chao Yu Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com, Daeho Jeong Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Aug 24, 2026 at 8:16=E2=80=AFPM Chao Yu wrote: > > On 8/25/26 03:14, Daeho Jeong wrote: > > From: Daeho Jeong > > > > Currently, zoned block devices restrict pinned file allocations to > > conventional zones at the beginning of the storage (before > > first_seq_zone_segno), triggering range GC when conventional space is > > exhausted. > > > > On regular block devices, when preparing for future online filesystem > > resizing (e.g. partition shrinking), pinned files must not be allocated > > in the tail area that will be truncated, as pinned files cannot be > > relocated by GC. Specifying the resizable tail area size (in sections) > > allows uniform mount configuration across devices of different storage > > capacities. > > > > To support this, introduce a unified `pinned_area_max_secno` boundary > > abstraction in `f2fs_sb_info`: > > 1. Add `-o resizable_tail_secno=3D%u` mount option to specify the numbe= r > > of sections at the tail of the filesystem reserved for resizing. > > 2. In `f2fs_fill_super()`, initialize `sbi->pinned_area_max_secno` as: > > min(MAIN_SECS(sbi) - resizable_tail_sec, zoned_max_sec). > > 3. In `get_new_segment()`, restrict segment allocation for pinned files > > (`pinning =3D=3D true`) to `0 .. sbi->pinned_area_max_secno - 1`. I= f no > > free section is available in the pinned area, return -EAGAIN. > > 4. In `f2fs_allocate_pinning_section()`, unify the range GC trigger to > > run `f2fs_gc_range()` up to `sbi->pinned_area_max_secno` whenever > > `sbi->pinned_area_max_secno < MAIN_SECS(sbi)` and allocation > > returns -EAGAIN. > > 5. Expose `/sys/fs/f2fs//pinned_area_max_secno` as a read-only > > sysfs node. > > > > Signed-off-by: Daeho Jeong > > Signed-off-by: Sunmin Jeong > > --- > > Documentation/ABI/testing/sysfs-fs-f2fs | 7 +++++ > > Documentation/filesystems/f2fs.rst | 8 +++++- > > fs/f2fs/f2fs.h | 2 ++ > > fs/f2fs/segment.c | 33 ++++++++++++----------- > > fs/f2fs/segment.h | 1 + > > fs/f2fs/super.c | 36 ++++++++++++++++++++++++= + > > fs/f2fs/sysfs.c | 2 ++ > > 7 files changed, 72 insertions(+), 17 deletions(-) > > > > diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/AB= I/testing/sysfs-fs-f2fs > > index 85194e4c7f01..0cebc89799dd 100644 > > --- a/Documentation/ABI/testing/sysfs-fs-f2fs > > +++ b/Documentation/ABI/testing/sysfs-fs-f2fs > > @@ -1013,3 +1013,10 @@ Description: Every time a write operation comp= letes f2fs_write_end_io() is > > the maximum size of a write bio that is completed in atom= ic > > (atc) context. The default value for this attribute is UI= NT_MAX > > which means that this functionality is disabled by defaul= t. > > + > > +What: /sys/fs/f2fs//pinned_area_max_secno > > +Date: August 2026 > > +Contact: "Daeho Jeong" > > +Description: This is a read-only entry to show the upper bound section= number > > + for pinned files. Pinned files will only be allocated wit= hin > > + sections 0 to pinned_area_max_secno - 1. > > diff --git a/Documentation/filesystems/f2fs.rst b/Documentation/filesys= tems/f2fs.rst > > index 1a5fd4afe609..a3c3b6948734 100644 > > --- a/Documentation/filesystems/f2fs.rst > > +++ b/Documentation/filesystems/f2fs.rst > > @@ -417,7 +417,13 @@ lookup_mode=3D%s Control the directory = lookup behavior for casefolded > > auto F2FS determines the mode = based on the > > on-disk `SB_ENC_NO_COMPAT= _FALLBACK_FL` > > flag. > > - =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > +resizable_tail_secno=3D%u Control the number of sections at the tail = of the > > + filesystem reserved for online resizing. Pinned = files > > + will only be allocated within sections 0 to > > + (MAIN_SECS - resizable_tail_secno) - 1. If set t= o 0 > > + (default), there is no tail restriction unless r= unning > > + on a zoned block device where conventional zones= are > > + used. > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > > Debugfs Entries > > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h > > index b0a9c14de595..16720f1f0a9c 100644 > > --- a/fs/f2fs/f2fs.h > > +++ b/fs/f2fs/f2fs.h > > @@ -255,6 +255,7 @@ struct f2fs_mount_info { > > block_t unusable_cap; /* Amount of space allowed to be > > * unusable when disabling checkp= oint > > */ > > + unsigned int resizable_tail_secno; /* number of resizable ta= il sections */ > > > > /* For compression */ > > unsigned char compress_algorithm; /* algorithm type */ > > @@ -2005,6 +2006,7 @@ struct f2fs_sb_info { > > spinlock_t dev_lock; /* protect dirty_device *= / > > bool aligned_blksize; /* all devices has the sa= me logical blksize */ > > unsigned int first_seq_zone_segno; /* first segno in sequent= ial zone */ > > + unsigned int pinned_area_max_secno; /* upper bound section fo= r pinned files */ > > unsigned int bggc_io_aware; /* For adjust the BG_GC p= riority when pending IO */ > > unsigned int allocate_section_hint; /* the boundary position = between devices */ > > unsigned int allocate_section_policy; /* determine the section = writing priority */ > > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c > > index 56decf9c691c..ed6f2947210b 100644 > > --- a/fs/f2fs/segment.c > > +++ b/fs/f2fs/segment.c > > @@ -2877,6 +2877,7 @@ static int get_new_segment(struct f2fs_sb_info *s= bi, > > unsigned int old_zoneno =3D GET_ZONE_FROM_SEG(sbi, *newseg); > > unsigned int alloc_policy =3D sbi->allocate_section_policy; > > unsigned int alloc_hint =3D sbi->allocate_section_hint; > > + unsigned int max_secno =3D MAIN_SECS(sbi); > > bool init =3D true; > > bool looped =3D false; > > int i, devi; > > @@ -2908,7 +2909,7 @@ static int get_new_segment(struct f2fs_sb_info *s= bi, > > */ > > if (f2fs_sb_has_blkzoned(sbi)) { > > /* Prioritize writing to conventional zones */ > > - if (sbi->blkzone_alloc_policy =3D=3D BLKZONE_ALLOC_PRIOR_= CONV || pinning) > > + if (sbi->blkzone_alloc_policy =3D=3D BLKZONE_ALLOC_PRIOR_= CONV) > > segno =3D 0; > > else > > segno =3D max(sbi->first_seq_zone_segno, *newseg)= ; > > @@ -2924,19 +2925,24 @@ static int get_new_segment(struct f2fs_sb_info = *sbi, > > alloc_hint > MAIN_SECS(sbi)) > > alloc_hint =3D MAIN_SECS(sbi); > > > > - if (alloc_policy =3D=3D ALLOCATE_FORWARD_FROM_HINT && > > - hint < alloc_hint) > > + if (pinning) { > > + max_secno =3D sbi->pinned_area_max_secno; > > + hint =3D 0; > > + } else if (alloc_policy =3D=3D ALLOCATE_FORWARD_FROM_HINT && > > + hint < alloc_hint) { > > hint =3D alloc_hint; > > - else if (alloc_policy =3D=3D ALLOCATE_FORWARD_WITHIN_HINT && > > - hint >=3D alloc_hint) > > + } else if (alloc_policy =3D=3D ALLOCATE_FORWARD_WITHIN_HINT && > > + hint >=3D alloc_hint) { > > hint =3D 0; > > + } > > > > find_other_zone: > > - secno =3D find_next_zero_bit(free_i->free_secmap, MAIN_SECS(sbi),= hint); > > + secno =3D find_next_zero_bit(free_i->free_secmap, max_secno, hint= ); > > > > - if (secno >=3D MAIN_SECS(sbi)) { > > + if (secno >=3D max_secno) { > > if (looped) { > > - ret =3D -ENOSPC; > > + ret =3D (pinning && has_pinned_area(sbi)) ? > > + -EAGAIN : -ENOSPC; > > f2fs_bug_on(sbi, !pinning); > > goto out_unlock; > > } > > @@ -3001,12 +3007,6 @@ static int get_new_segment(struct f2fs_sb_info *= sbi, > > goto out_unlock; > > } > > > > - /* no free section in conventional device or conventional zone */ > > - if (new_sec && pinning && > > - f2fs_is_sequential_zone_area(sbi, START_BLOCK(sbi, segno)= )) { > > - ret =3D -EAGAIN; > > - goto out_unlock; > > - } > > __set_inuse(sbi, segno); > > *newseg =3D segno; > > out_unlock: > > @@ -3472,8 +3472,9 @@ int f2fs_allocate_pinning_section(struct f2fs_sb_= info *sbi) > > err =3D f2fs_allocate_new_section(sbi, CURSEG_COLD_DATA_PINNED, f= alse); > > f2fs_unlock_op(sbi, &lc); > > > > - if (f2fs_sb_has_blkzoned(sbi) && err =3D=3D -EAGAIN && gc_require= d) { > > - err =3D f2fs_gc_range(sbi, 0, sbi->first_seq_zone_segno -= 1, > > + if (has_pinned_area(sbi) && err =3D=3D -EAGAIN && gc_required) { > > + err =3D f2fs_gc_range(sbi, 0, > > + sbi->pinned_area_max_secno * SEGS_PER_SEC= (sbi) - 1, > > true, ZONED_PIN_SEC_REQUIRED_COUNT, true)= ; > > if (err) > > return err; > > diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h > > index db1079169a23..1dd8a2fa929d 100644 > > --- a/fs/f2fs/segment.h > > +++ b/fs/f2fs/segment.h > > @@ -43,6 +43,7 @@ static inline void sanity_check_seg_type(struct f2fs_= sb_info *sbi, > > > > #define MAIN_SEGS(sbi) (SM_I(sbi)->main_segments) > > #define MAIN_SECS(sbi) ((sbi)->total_sections) > > +#define has_pinned_area(sbi) ((sbi)->pinned_area_max_secno < MAIN_SECS= (sbi)) > > Looks more like has_unpinned_area(sbi), since we assign pinned_area_max_s= ecno > w/ MAIN_SECS(sbi) by default, and will decrease it only if there is conv = sections > or valid resizable_tail_secno. > > > > > #define TOTAL_SEGS(sbi) = \ > > (SM_I(sbi) ? SM_I(sbi)->segment_count : = \ > > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c > > index 3bdb0f891c35..c1e315282ec6 100644 > > --- a/fs/f2fs/super.c > > +++ b/fs/f2fs/super.c > > @@ -235,6 +235,7 @@ enum { > > Opt_jqfmt, > > Opt_checkpoint, > > Opt_lookup_mode, > > + Opt_resizable_tail_secno, > > Opt_err, > > }; > > > > @@ -366,6 +367,7 @@ static const struct fs_parameter_spec f2fs_param_sp= ecs[] =3D { > > fsparam_flag("age_extent_cache", Opt_age_extent_cache), > > fsparam_enum("errors", Opt_errors, f2fs_param_errors), > > fsparam_enum("lookup_mode", Opt_lookup_mode, f2fs_param_lookup_mo= de), > > + fsparam_u32("resizable_tail_secno", Opt_resizable_tail_secno), > > {} > > }; > > > > @@ -551,6 +553,17 @@ static inline void adjust_unusable_cap_perc(struct= f2fs_sb_info *sbi) > > F2FS_OPTION(sbi).unusable_cap_perc); > > } > > > > +static inline void adjust_pinned_area_boundary(struct f2fs_sb_info *sb= i) > > +{ > > + sbi->pinned_area_max_secno =3D MAIN_SECS(sbi); > > + if (f2fs_sb_has_blkzoned(sbi) && sbi->first_seq_zone_segno !=3D N= ULL_SEGNO) > > + sbi->pinned_area_max_secno =3D min(sbi->pinned_area_max_s= ecno, > > + GET_SEC_FROM_SEG(sbi, sbi->first_seq_zone= _segno)); > > + if (F2FS_OPTION(sbi).resizable_tail_secno) > > + sbi->pinned_area_max_secno =3D min(sbi->pinned_area_max_s= ecno, > > + MAIN_SECS(sbi) - F2FS_OPTION(sbi).resizab= le_tail_secno); > > +} > > + > > static void init_once(void *foo) > > { > > struct f2fs_inode_info *fi =3D (struct f2fs_inode_info *) foo; > > @@ -1235,6 +1248,9 @@ static int f2fs_parse_param(struct fs_context *fc= , struct fs_parameter *param) > > F2FS_CTX_INFO(ctx).lookup_mode =3D result.uint_32; > > ctx->spec_mask |=3D F2FS_SPEC_lookup_mode; > > break; > > + case Opt_resizable_tail_secno: > > + F2FS_CTX_INFO(ctx).resizable_tail_secno =3D result.uint_3= 2; > > + break; > > } > > return 0; > > } > > @@ -1771,6 +1787,12 @@ static void f2fs_apply_options(struct fs_context= *fc, struct super_block *sb) > > > > static int f2fs_sanity_check_options(struct f2fs_sb_info *sbi, bool r= emount) > > { > > + if (remount && > > + F2FS_OPTION(sbi).resizable_tail_secno >=3D MAIN_SECS(sbi)) { > > + f2fs_err(sbi, "Option resizable_tail_secno is larger than= or equal to total sections (%u >=3D %u)", > > + F2FS_OPTION(sbi).resizable_tail_secno, MA= IN_SECS(sbi)); > > + return -EINVAL; > > + } > > if (f2fs_sb_has_device_alias(sbi) && > > !test_opt(sbi, READ_EXTENT_CACHE)) { > > f2fs_err(sbi, "device aliasing requires extent cache"); > > @@ -2544,6 +2566,10 @@ static int f2fs_show_options(struct seq_file *se= q, struct dentry *root) > > else if (F2FS_OPTION(sbi).lookup_mode =3D=3D LOOKUP_AUTO) > > seq_show_option(seq, "lookup_mode", "auto"); > > > > + if (F2FS_OPTION(sbi).resizable_tail_secno) > > + seq_printf(seq, ",resizable_tail_secno=3D%u", > > + F2FS_OPTION(sbi).resizable_tail_secno); > > + > > return 0; > > } > > > > @@ -2586,6 +2612,7 @@ static void default_options(struct f2fs_sb_info *= sbi, bool remount) > > F2FS_OPTION(sbi).bggc_mode =3D BGGC_MODE_ON; > > F2FS_OPTION(sbi).memory_mode =3D MEMORY_MODE_NORMAL; > > F2FS_OPTION(sbi).errors =3D MOUNT_ERRORS_CONTINUE; > > + F2FS_OPTION(sbi).resizable_tail_secno =3D 0; > > > > set_opt(sbi, INLINE_XATTR); > > set_opt(sbi, INLINE_DATA); > > @@ -3045,6 +3072,7 @@ static int __f2fs_remount(struct fs_context *fc, = struct super_block *sb) > > sb->s_flags =3D (sb->s_flags & ~SB_POSIXACL) | > > (test_opt(sbi, POSIX_ACL) ? SB_POSIXACL : 0); > > > > + adjust_pinned_area_boundary(sbi); > > limit_reserve_root(sbi); > > fc->sb_flags =3D (flags & ~SB_LAZYTIME) | (sb->s_flags & SB_LAZYT= IME); > > > > @@ -5287,6 +5315,14 @@ static int f2fs_fill_super(struct super_block *s= b, struct fs_context *fc) > > /* get segno of first zoned block device */ > > sbi->first_seq_zone_segno =3D get_first_seq_zone_segno(sbi); > > > > + if (F2FS_OPTION(sbi).resizable_tail_secno >=3D MAIN_SECS(sbi)) { > > + f2fs_err(sbi, "Option resizable_tail_secno is larger than= or equal to total sections (%u >=3D %u)", > > + F2FS_OPTION(sbi).resizable_tail_secno, MA= IN_SECS(sbi)); > > + err =3D -EINVAL; > > + goto free_nm; > > + } > > How about merging this check into the one in f2fs_sanity_check_options()? The reason it was kept separate is that during the initial mount, f2fs_sanity_check_options(sbi, false) is called before init_sb_info(sbi). At that point, sbi->total_sections has not been initialized yet, so MAIN_SECS(sbi) is still 0. If we simply check `F2FS_OPTION(sbi).resizable_tail_secno >=3D MAIN_SECS(sb= i)` in f2fs_sanity_check_options(), it evaluates against 0 and causes the initi= al mount to unconditionally fail whenever resizable_tail_secno is specified. This is similar to how `max_open_zones` is checked only on remount in f2fs_sanity_check_options() and checked separately during the initial mount= . However, if you'd prefer to merge them into f2fs_sanity_check_options(), we can use le32_to_cpu(sbi->raw_super->section_count), since sbi->raw_super is already loaded in memory by then. Which one do you prefer? Thanks, > > Thanks, > > > + adjust_pinned_area_boundary(sbi); > > + > > sbi->reserved_pin_section =3D f2fs_sb_has_blkzoned(sbi) ? > > ZONED_PIN_SEC_REQUIRED_COUNT : > > GET_SEC_FROM_SEG(sbi, overprovision_segments(sbi)= ); > > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c > > index 3201e2185fea..811e350a1430 100644 > > --- a/fs/f2fs/sysfs.c > > +++ b/fs/f2fs/sysfs.c > > @@ -1313,6 +1313,7 @@ F2FS_SBI_GENERAL_RW_ATTR(blkzone_alloc_policy); > > #endif > > F2FS_SBI_GENERAL_RW_ATTR(carve_out); > > F2FS_SBI_GENERAL_RW_ATTR(reserved_pin_section); > > +F2FS_SBI_GENERAL_RO_ATTR(pinned_area_max_secno); > > F2FS_SBI_GENERAL_RW_ATTR(bggc_io_aware); > > F2FS_SBI_GENERAL_RW_ATTR(max_lock_elapsed_time); > > F2FS_SBI_GENERAL_RW_ATTR(lock_duration_priority); > > @@ -1525,6 +1526,7 @@ static struct attribute *f2fs_attrs[] =3D { > > ATTR_LIST(max_read_extent_count), > > ATTR_LIST(carve_out), > > ATTR_LIST(reserved_pin_section), > > + ATTR_LIST(pinned_area_max_secno), > > ATTR_LIST(allocate_section_hint), > > ATTR_LIST(allocate_section_policy), > > ATTR_LIST(max_lock_elapsed_time), >