Re: [f2fs-dev] [PATCH 3/3 v2] f2fs: kill zone-capacity support

2024-02-23 Thread Jaegeuk Kim
On 02/22, Matias Bjørling wrote:
> On 21-02-2024 18:27, Jaegeuk Kim wrote:
> 
> > > Doesn't this break practically all ZNS NVMe devices?
> > 
> > Yes, so here I'm in questioning who is really using w/ zone capacity. If 
> > there's
> > no user complaining, I'd like to deprecate this, since this adds code 
> > complexity
> > and unnecessary checks.
> > 
> 
> Hi Jaegeuk,
> 
> I like to make a couple of points to hopefully keep the support in a little
> while longer.
> 
> - NVMe-based zone devices continue to be developed with the pow2 zone size
> and zone size != zone cap features. There was some divergence in the
> first-gen drives. However, all the second-gen drives I know of are
> implemented with those features in mind.
> 
> - A very active community is doing work using f2fs, and many of those
> members are working with the ZN540s device (which exposes a pow2 zone size).
> 
> - For drives with a capacity of less than 16TiB, f2fs is an excellent file
> system to use and is really useful for various use cases. We're using the
> f2fs daily for a couple of our workloads.
> 
> Work is ongoing on btrfs and XFS to support zoned storage devices, but they
> have yet to be through the trenches as much as f2fs has been with its zone
> support. So it would be great to have f2fs continue to support the pow2 zone
> sizes, as it is a valuable feature for the currently used and second-gen
> drives that have been released or are soon becoming available.
> 
> If there is a performance concern with the feature re: ZUFS, maybe the pow2
> implementation could be slightly more computationally expensive, as the
> feature, anyway, typically is used on more beefy systems.

Thanks, Matias for the background. It seems to be fair for keeping this for a
while tho, IMO, non-pow2 could address both parties.

> 
> Regards,
> Matias


___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH 3/3 v2] f2fs: kill zone-capacity support

2024-02-22 Thread Matias Bjørling

On 21-02-2024 18:27, Jaegeuk Kim wrote:


Doesn't this break practically all ZNS NVMe devices?


Yes, so here I'm in questioning who is really using w/ zone capacity. If there's
no user complaining, I'd like to deprecate this, since this adds code complexity
and unnecessary checks.



Hi Jaegeuk,

I like to make a couple of points to hopefully keep the support in a 
little while longer.


- NVMe-based zone devices continue to be developed with the pow2 zone 
size and zone size != zone cap features. There was some divergence in 
the first-gen drives. However, all the second-gen drives I know of are 
implemented with those features in mind.


- A very active community is doing work using f2fs, and many of those 
members are working with the ZN540s device (which exposes a pow2 zone size).


- For drives with a capacity of less than 16TiB, f2fs is an excellent 
file system to use and is really useful for various use cases. We're 
using the f2fs daily for a couple of our workloads.


Work is ongoing on btrfs and XFS to support zoned storage devices, but 
they have yet to be through the trenches as much as f2fs has been with 
its zone support. So it would be great to have f2fs continue to support 
the pow2 zone sizes, as it is a valuable feature for the currently used 
and second-gen drives that have been released or are soon becoming 
available.


If there is a performance concern with the feature re: ZUFS, maybe the 
pow2 implementation could be slightly more computationally expensive, as 
the feature, anyway, typically is used on more beefy systems.


Regards,
Matias


___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH 3/3 v2] f2fs: kill zone-capacity support

2024-02-21 Thread Jaegeuk Kim
On 02/21, Juhyung Park wrote:
> On Wed, Feb 21, 2024 at 4:03 AM Jaegeuk Kim  wrote:
> >
> > On 02/20, Chao Yu wrote:
> > > Jaegeuk, Daeho,
> > >
> > > Do we need Cc WD guys? Not sure whether they need this feature...
> >
> > CC'ed WDC folks.
> >
> > >
> > > For ZUFS: 1) will it only exports 2MB-aligned zone size, and 2) its zone
> > > capacity equals zone size?
> >
> > Yeah, I think f2fs just needs to check 2MB alignment only.
> >
> 
> Doesn't this break practically all ZNS NVMe devices?

Yes, so here I'm in questioning who is really using w/ zone capacity. If there's
no user complaining, I'd like to deprecate this, since this adds code complexity
and unnecessary checks.

> 
> dm-po2zoned isn't merged yet, and PO2 is still enforced on NVMe's
> side, and afaik vendors are doing capacity != size to comply with PO2
> requirements on the ZNS-side.
> 
> > >
> > > Thanks,
> > >
> > > On 2024/2/8 7:29, Jaegeuk Kim wrote:
> > > > Since we don't see any user, let's kill.
> > > >
> > > > Signed-off-by: Jaegeuk Kim 
> > > > ---
> > > >
> > > >   from v1:
> > > >- keep setting the seq bit
> > > >
> > > >   Documentation/ABI/testing/sysfs-fs-f2fs |  6 --
> > > >   fs/f2fs/debug.c |  7 +-
> > > >   fs/f2fs/f2fs.h  |  5 --
> > > >   fs/f2fs/file.c  |  6 +-
> > > >   fs/f2fs/gc.c| 33 +++--
> > > >   fs/f2fs/gc.h| 26 ---
> > > >   fs/f2fs/segment.c   | 93 +++--
> > > >   fs/f2fs/segment.h   | 41 ---
> > > >   fs/f2fs/super.c | 16 ++---
> > > >   fs/f2fs/sysfs.c |  6 --
> > > >   10 files changed, 44 insertions(+), 195 deletions(-)
> > > >
> > > > diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs 
> > > > b/Documentation/ABI/testing/sysfs-fs-f2fs
> > > > index 48c135e24eb5..dff8c87d87dd 100644
> > > > --- a/Documentation/ABI/testing/sysfs-fs-f2fs
> > > > +++ b/Documentation/ABI/testing/sysfs-fs-f2fs
> > > > @@ -628,12 +628,6 @@ Contact:   "Jaegeuk Kim" 
> > > >   Description:  Controls max # of node block writes to be used for 
> > > > roll forward
> > > > recovery. This can limit the roll forward recovery time.
> > > > -What:  /sys/fs/f2fs//unusable_blocks_per_sec
> > > > -Date:  June 2022
> > > > -Contact:   "Jaegeuk Kim" 
> > > > -Description:   Shows the number of unusable blocks in a section 
> > > > which was defined by
> > > > -   the zone capacity reported by underlying zoned device.
> > > > -
> > > >   What: /sys/fs/f2fs//current_atomic_write
> > > >   Date: July 2022
> > > >   Contact:  "Daeho Jeong" 
> > > > diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
> > > > index 0d02224b99b7..6617195bd27e 100644
> > > > --- a/fs/f2fs/debug.c
> > > > +++ b/fs/f2fs/debug.c
> > > > @@ -32,21 +32,20 @@ static struct dentry *f2fs_debugfs_root;
> > > >   void f2fs_update_sit_info(struct f2fs_sb_info *sbi)
> > > >   {
> > > > struct f2fs_stat_info *si = F2FS_STAT(sbi);
> > > > -   unsigned long long blks_per_sec, hblks_per_sec, total_vblocks;
> > > > +   unsigned long long hblks_per_sec, total_vblocks;
> > > > unsigned long long bimodal, dist;
> > > > unsigned int segno, vblocks;
> > > > int ndirty = 0;
> > > > bimodal = 0;
> > > > total_vblocks = 0;
> > > > -   blks_per_sec = CAP_BLKS_PER_SEC(sbi);
> > > > -   hblks_per_sec = blks_per_sec / 2;
> > > > +   hblks_per_sec = BLKS_PER_SEC(sbi) / 2;
> > > > for (segno = 0; segno < MAIN_SEGS(sbi); segno += SEGS_PER_SEC(sbi)) 
> > > > {
> > > > vblocks = get_valid_blocks(sbi, segno, true);
> > > > dist = abs(vblocks - hblks_per_sec);
> > > > bimodal += dist * dist;
> > > > -   if (vblocks > 0 && vblocks < blks_per_sec) {
> > > > +   if (vblocks > 0 && vblocks < BLKS_PER_SEC(sbi)) {
> > > > total_vblocks += vblocks;
> > > > ndirty++;
> > > > }
> > > > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> > > > index 9a9e858083af..34d718301392 100644
> > > > --- a/fs/f2fs/f2fs.h
> > > > +++ b/fs/f2fs/f2fs.h
> > > > @@ -1618,7 +1618,6 @@ struct f2fs_sb_info {
> > > > unsigned int meta_ino_num;  /* meta inode number*/
> > > > unsigned int log_blocks_per_seg;/* log2 blocks per segment 
> > > > */
> > > > unsigned int blocks_per_seg;/* blocks per segment */
> > > > -   unsigned int unusable_blocks_per_sec;   /* unusable blocks per 
> > > > section */
> > > > unsigned int segs_per_sec;  /* segments per section */
> > > > unsigned int secs_per_zone; /* sections per zone */
> > > > unsigned int total_sections;/* total section count */
> > > > @@ -3743,10 +3742,6 @@ void f2fs_destroy_segment_manager(struct 
> > > > f2fs_sb_info *sbi);
> > > >   int 

Re: [f2fs-dev] [PATCH 3/3 v2] f2fs: kill zone-capacity support

2024-02-21 Thread Juhyung Park
On Wed, Feb 21, 2024 at 4:03 AM Jaegeuk Kim  wrote:
>
> On 02/20, Chao Yu wrote:
> > Jaegeuk, Daeho,
> >
> > Do we need Cc WD guys? Not sure whether they need this feature...
>
> CC'ed WDC folks.
>
> >
> > For ZUFS: 1) will it only exports 2MB-aligned zone size, and 2) its zone
> > capacity equals zone size?
>
> Yeah, I think f2fs just needs to check 2MB alignment only.
>

Doesn't this break practically all ZNS NVMe devices?

dm-po2zoned isn't merged yet, and PO2 is still enforced on NVMe's
side, and afaik vendors are doing capacity != size to comply with PO2
requirements on the ZNS-side.

> >
> > Thanks,
> >
> > On 2024/2/8 7:29, Jaegeuk Kim wrote:
> > > Since we don't see any user, let's kill.
> > >
> > > Signed-off-by: Jaegeuk Kim 
> > > ---
> > >
> > >   from v1:
> > >- keep setting the seq bit
> > >
> > >   Documentation/ABI/testing/sysfs-fs-f2fs |  6 --
> > >   fs/f2fs/debug.c |  7 +-
> > >   fs/f2fs/f2fs.h  |  5 --
> > >   fs/f2fs/file.c  |  6 +-
> > >   fs/f2fs/gc.c| 33 +++--
> > >   fs/f2fs/gc.h| 26 ---
> > >   fs/f2fs/segment.c   | 93 +++--
> > >   fs/f2fs/segment.h   | 41 ---
> > >   fs/f2fs/super.c | 16 ++---
> > >   fs/f2fs/sysfs.c |  6 --
> > >   10 files changed, 44 insertions(+), 195 deletions(-)
> > >
> > > diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs 
> > > b/Documentation/ABI/testing/sysfs-fs-f2fs
> > > index 48c135e24eb5..dff8c87d87dd 100644
> > > --- a/Documentation/ABI/testing/sysfs-fs-f2fs
> > > +++ b/Documentation/ABI/testing/sysfs-fs-f2fs
> > > @@ -628,12 +628,6 @@ Contact:   "Jaegeuk Kim" 
> > >   Description:  Controls max # of node block writes to be used for 
> > > roll forward
> > > recovery. This can limit the roll forward recovery time.
> > > -What:  /sys/fs/f2fs//unusable_blocks_per_sec
> > > -Date:  June 2022
> > > -Contact:   "Jaegeuk Kim" 
> > > -Description:   Shows the number of unusable blocks in a section 
> > > which was defined by
> > > -   the zone capacity reported by underlying zoned device.
> > > -
> > >   What: /sys/fs/f2fs//current_atomic_write
> > >   Date: July 2022
> > >   Contact:  "Daeho Jeong" 
> > > diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
> > > index 0d02224b99b7..6617195bd27e 100644
> > > --- a/fs/f2fs/debug.c
> > > +++ b/fs/f2fs/debug.c
> > > @@ -32,21 +32,20 @@ static struct dentry *f2fs_debugfs_root;
> > >   void f2fs_update_sit_info(struct f2fs_sb_info *sbi)
> > >   {
> > > struct f2fs_stat_info *si = F2FS_STAT(sbi);
> > > -   unsigned long long blks_per_sec, hblks_per_sec, total_vblocks;
> > > +   unsigned long long hblks_per_sec, total_vblocks;
> > > unsigned long long bimodal, dist;
> > > unsigned int segno, vblocks;
> > > int ndirty = 0;
> > > bimodal = 0;
> > > total_vblocks = 0;
> > > -   blks_per_sec = CAP_BLKS_PER_SEC(sbi);
> > > -   hblks_per_sec = blks_per_sec / 2;
> > > +   hblks_per_sec = BLKS_PER_SEC(sbi) / 2;
> > > for (segno = 0; segno < MAIN_SEGS(sbi); segno += SEGS_PER_SEC(sbi)) {
> > > vblocks = get_valid_blocks(sbi, segno, true);
> > > dist = abs(vblocks - hblks_per_sec);
> > > bimodal += dist * dist;
> > > -   if (vblocks > 0 && vblocks < blks_per_sec) {
> > > +   if (vblocks > 0 && vblocks < BLKS_PER_SEC(sbi)) {
> > > total_vblocks += vblocks;
> > > ndirty++;
> > > }
> > > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> > > index 9a9e858083af..34d718301392 100644
> > > --- a/fs/f2fs/f2fs.h
> > > +++ b/fs/f2fs/f2fs.h
> > > @@ -1618,7 +1618,6 @@ struct f2fs_sb_info {
> > > unsigned int meta_ino_num;  /* meta inode number*/
> > > unsigned int log_blocks_per_seg;/* log2 blocks per segment */
> > > unsigned int blocks_per_seg;/* blocks per segment */
> > > -   unsigned int unusable_blocks_per_sec;   /* unusable blocks per 
> > > section */
> > > unsigned int segs_per_sec;  /* segments per section */
> > > unsigned int secs_per_zone; /* sections per zone */
> > > unsigned int total_sections;/* total section count */
> > > @@ -3743,10 +3742,6 @@ void f2fs_destroy_segment_manager(struct 
> > > f2fs_sb_info *sbi);
> > >   int __init f2fs_create_segment_manager_caches(void);
> > >   void f2fs_destroy_segment_manager_caches(void);
> > >   int f2fs_rw_hint_to_seg_type(enum rw_hint hint);
> > > -unsigned int f2fs_usable_segs_in_sec(struct f2fs_sb_info *sbi,
> > > -   unsigned int segno);
> > > -unsigned int f2fs_usable_blks_in_seg(struct f2fs_sb_info *sbi,
> > > -   unsigned int segno);
> > >   #define DEF_FRAGMENT_SIZE 4
> > >   #define 

Re: [f2fs-dev] [PATCH 3/3 v2] f2fs: kill zone-capacity support

2024-02-20 Thread Jaegeuk Kim
On 02/20, Chao Yu wrote:
> Jaegeuk, Daeho,
> 
> Do we need Cc WD guys? Not sure whether they need this feature...

CC'ed WDC folks.

> 
> For ZUFS: 1) will it only exports 2MB-aligned zone size, and 2) its zone
> capacity equals zone size?

Yeah, I think f2fs just needs to check 2MB alignment only.

> 
> Thanks,
> 
> On 2024/2/8 7:29, Jaegeuk Kim wrote:
> > Since we don't see any user, let's kill.
> > 
> > Signed-off-by: Jaegeuk Kim 
> > ---
> > 
> >   from v1:
> >- keep setting the seq bit
> > 
> >   Documentation/ABI/testing/sysfs-fs-f2fs |  6 --
> >   fs/f2fs/debug.c |  7 +-
> >   fs/f2fs/f2fs.h  |  5 --
> >   fs/f2fs/file.c  |  6 +-
> >   fs/f2fs/gc.c| 33 +++--
> >   fs/f2fs/gc.h| 26 ---
> >   fs/f2fs/segment.c   | 93 +++--
> >   fs/f2fs/segment.h   | 41 ---
> >   fs/f2fs/super.c | 16 ++---
> >   fs/f2fs/sysfs.c |  6 --
> >   10 files changed, 44 insertions(+), 195 deletions(-)
> > 
> > diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs 
> > b/Documentation/ABI/testing/sysfs-fs-f2fs
> > index 48c135e24eb5..dff8c87d87dd 100644
> > --- a/Documentation/ABI/testing/sysfs-fs-f2fs
> > +++ b/Documentation/ABI/testing/sysfs-fs-f2fs
> > @@ -628,12 +628,6 @@ Contact:   "Jaegeuk Kim" 
> >   Description:  Controls max # of node block writes to be used for roll 
> > forward
> > recovery. This can limit the roll forward recovery time.
> > -What:  /sys/fs/f2fs//unusable_blocks_per_sec
> > -Date:  June 2022
> > -Contact:   "Jaegeuk Kim" 
> > -Description:   Shows the number of unusable blocks in a section which 
> > was defined by
> > -   the zone capacity reported by underlying zoned device.
> > -
> >   What: /sys/fs/f2fs//current_atomic_write
> >   Date: July 2022
> >   Contact:  "Daeho Jeong" 
> > diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
> > index 0d02224b99b7..6617195bd27e 100644
> > --- a/fs/f2fs/debug.c
> > +++ b/fs/f2fs/debug.c
> > @@ -32,21 +32,20 @@ static struct dentry *f2fs_debugfs_root;
> >   void f2fs_update_sit_info(struct f2fs_sb_info *sbi)
> >   {
> > struct f2fs_stat_info *si = F2FS_STAT(sbi);
> > -   unsigned long long blks_per_sec, hblks_per_sec, total_vblocks;
> > +   unsigned long long hblks_per_sec, total_vblocks;
> > unsigned long long bimodal, dist;
> > unsigned int segno, vblocks;
> > int ndirty = 0;
> > bimodal = 0;
> > total_vblocks = 0;
> > -   blks_per_sec = CAP_BLKS_PER_SEC(sbi);
> > -   hblks_per_sec = blks_per_sec / 2;
> > +   hblks_per_sec = BLKS_PER_SEC(sbi) / 2;
> > for (segno = 0; segno < MAIN_SEGS(sbi); segno += SEGS_PER_SEC(sbi)) {
> > vblocks = get_valid_blocks(sbi, segno, true);
> > dist = abs(vblocks - hblks_per_sec);
> > bimodal += dist * dist;
> > -   if (vblocks > 0 && vblocks < blks_per_sec) {
> > +   if (vblocks > 0 && vblocks < BLKS_PER_SEC(sbi)) {
> > total_vblocks += vblocks;
> > ndirty++;
> > }
> > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> > index 9a9e858083af..34d718301392 100644
> > --- a/fs/f2fs/f2fs.h
> > +++ b/fs/f2fs/f2fs.h
> > @@ -1618,7 +1618,6 @@ struct f2fs_sb_info {
> > unsigned int meta_ino_num;  /* meta inode number*/
> > unsigned int log_blocks_per_seg;/* log2 blocks per segment */
> > unsigned int blocks_per_seg;/* blocks per segment */
> > -   unsigned int unusable_blocks_per_sec;   /* unusable blocks per section 
> > */
> > unsigned int segs_per_sec;  /* segments per section */
> > unsigned int secs_per_zone; /* sections per zone */
> > unsigned int total_sections;/* total section count */
> > @@ -3743,10 +3742,6 @@ void f2fs_destroy_segment_manager(struct 
> > f2fs_sb_info *sbi);
> >   int __init f2fs_create_segment_manager_caches(void);
> >   void f2fs_destroy_segment_manager_caches(void);
> >   int f2fs_rw_hint_to_seg_type(enum rw_hint hint);
> > -unsigned int f2fs_usable_segs_in_sec(struct f2fs_sb_info *sbi,
> > -   unsigned int segno);
> > -unsigned int f2fs_usable_blks_in_seg(struct f2fs_sb_info *sbi,
> > -   unsigned int segno);
> >   #define DEF_FRAGMENT_SIZE 4
> >   #define MIN_FRAGMENT_SIZE 1
> > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> > index b0be576b2090..2c13b340c8a0 100644
> > --- a/fs/f2fs/file.c
> > +++ b/fs/f2fs/file.c
> > @@ -1717,7 +1717,7 @@ static int f2fs_expand_inode_data(struct inode 
> > *inode, loff_t offset,
> > return 0;
> > if (f2fs_is_pinned_file(inode)) {
> > -   block_t sec_blks = CAP_BLKS_PER_SEC(sbi);
> > +   block_t sec_blks = BLKS_PER_SEC(sbi);
> > block_t sec_len = 

Re: [f2fs-dev] [PATCH 3/3 v2] f2fs: kill zone-capacity support

2024-02-20 Thread Chao Yu

Jaegeuk, Daeho,

Do we need Cc WD guys? Not sure whether they need this feature...

For ZUFS: 1) will it only exports 2MB-aligned zone size, and 2) its zone
capacity equals zone size?

Thanks,

On 2024/2/8 7:29, Jaegeuk Kim wrote:

Since we don't see any user, let's kill.

Signed-off-by: Jaegeuk Kim 
---

  from v1:
   - keep setting the seq bit

  Documentation/ABI/testing/sysfs-fs-f2fs |  6 --
  fs/f2fs/debug.c |  7 +-
  fs/f2fs/f2fs.h  |  5 --
  fs/f2fs/file.c  |  6 +-
  fs/f2fs/gc.c| 33 +++--
  fs/f2fs/gc.h| 26 ---
  fs/f2fs/segment.c   | 93 +++--
  fs/f2fs/segment.h   | 41 ---
  fs/f2fs/super.c | 16 ++---
  fs/f2fs/sysfs.c |  6 --
  10 files changed, 44 insertions(+), 195 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs 
b/Documentation/ABI/testing/sysfs-fs-f2fs
index 48c135e24eb5..dff8c87d87dd 100644
--- a/Documentation/ABI/testing/sysfs-fs-f2fs
+++ b/Documentation/ABI/testing/sysfs-fs-f2fs
@@ -628,12 +628,6 @@ Contact:   "Jaegeuk Kim" 
  Description:  Controls max # of node block writes to be used for roll forward
recovery. This can limit the roll forward recovery time.
  
-What:		/sys/fs/f2fs//unusable_blocks_per_sec

-Date:  June 2022
-Contact:   "Jaegeuk Kim" 
-Description:   Shows the number of unusable blocks in a section which was 
defined by
-   the zone capacity reported by underlying zoned device.
-
  What: /sys/fs/f2fs//current_atomic_write
  Date: July 2022
  Contact:  "Daeho Jeong" 
diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
index 0d02224b99b7..6617195bd27e 100644
--- a/fs/f2fs/debug.c
+++ b/fs/f2fs/debug.c
@@ -32,21 +32,20 @@ static struct dentry *f2fs_debugfs_root;
  void f2fs_update_sit_info(struct f2fs_sb_info *sbi)
  {
struct f2fs_stat_info *si = F2FS_STAT(sbi);
-   unsigned long long blks_per_sec, hblks_per_sec, total_vblocks;
+   unsigned long long hblks_per_sec, total_vblocks;
unsigned long long bimodal, dist;
unsigned int segno, vblocks;
int ndirty = 0;
  
  	bimodal = 0;

total_vblocks = 0;
-   blks_per_sec = CAP_BLKS_PER_SEC(sbi);
-   hblks_per_sec = blks_per_sec / 2;
+   hblks_per_sec = BLKS_PER_SEC(sbi) / 2;
for (segno = 0; segno < MAIN_SEGS(sbi); segno += SEGS_PER_SEC(sbi)) {
vblocks = get_valid_blocks(sbi, segno, true);
dist = abs(vblocks - hblks_per_sec);
bimodal += dist * dist;
  
-		if (vblocks > 0 && vblocks < blks_per_sec) {

+   if (vblocks > 0 && vblocks < BLKS_PER_SEC(sbi)) {
total_vblocks += vblocks;
ndirty++;
}
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 9a9e858083af..34d718301392 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1618,7 +1618,6 @@ struct f2fs_sb_info {
unsigned int meta_ino_num;  /* meta inode number*/
unsigned int log_blocks_per_seg;/* log2 blocks per segment */
unsigned int blocks_per_seg;/* blocks per segment */
-   unsigned int unusable_blocks_per_sec;   /* unusable blocks per section 
*/
unsigned int segs_per_sec;  /* segments per section */
unsigned int secs_per_zone; /* sections per zone */
unsigned int total_sections;/* total section count */
@@ -3743,10 +3742,6 @@ void f2fs_destroy_segment_manager(struct f2fs_sb_info 
*sbi);
  int __init f2fs_create_segment_manager_caches(void);
  void f2fs_destroy_segment_manager_caches(void);
  int f2fs_rw_hint_to_seg_type(enum rw_hint hint);
-unsigned int f2fs_usable_segs_in_sec(struct f2fs_sb_info *sbi,
-   unsigned int segno);
-unsigned int f2fs_usable_blks_in_seg(struct f2fs_sb_info *sbi,
-   unsigned int segno);
  
  #define DEF_FRAGMENT_SIZE	4

  #define MIN_FRAGMENT_SIZE 1
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index b0be576b2090..2c13b340c8a0 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1717,7 +1717,7 @@ static int f2fs_expand_inode_data(struct inode *inode, 
loff_t offset,
return 0;
  
  	if (f2fs_is_pinned_file(inode)) {

-   block_t sec_blks = CAP_BLKS_PER_SEC(sbi);
+   block_t sec_blks = BLKS_PER_SEC(sbi);
block_t sec_len = roundup(map.m_len, sec_blks);
  
  		map.m_len = sec_blks;

@@ -2525,7 +2525,7 @@ static int __f2fs_ioc_gc_range(struct file *filp, struct 
f2fs_gc_range *range)
ret = -EAGAIN;
goto out;
}
-   range->start += CAP_BLKS_PER_SEC(sbi);
+   range->start += BLKS_PER_SEC(sbi);
if (range->start <= end)
goto do_more;
  out:
@@ -2654,7 +2654,7 

Re: [f2fs-dev] [PATCH 3/3 v2] f2fs: kill zone-capacity support

2024-02-07 Thread Daeho Jeong
Reviewed-by: Daeho Jeong 

On Wed, Feb 7, 2024 at 3:31 PM Jaegeuk Kim  wrote:
>
> Since we don't see any user, let's kill.
>
> Signed-off-by: Jaegeuk Kim 
> ---
>
>  from v1:
>   - keep setting the seq bit
>
>  Documentation/ABI/testing/sysfs-fs-f2fs |  6 --
>  fs/f2fs/debug.c |  7 +-
>  fs/f2fs/f2fs.h  |  5 --
>  fs/f2fs/file.c  |  6 +-
>  fs/f2fs/gc.c| 33 +++--
>  fs/f2fs/gc.h| 26 ---
>  fs/f2fs/segment.c   | 93 +++--
>  fs/f2fs/segment.h   | 41 ---
>  fs/f2fs/super.c | 16 ++---
>  fs/f2fs/sysfs.c |  6 --
>  10 files changed, 44 insertions(+), 195 deletions(-)
>
> diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs 
> b/Documentation/ABI/testing/sysfs-fs-f2fs
> index 48c135e24eb5..dff8c87d87dd 100644
> --- a/Documentation/ABI/testing/sysfs-fs-f2fs
> +++ b/Documentation/ABI/testing/sysfs-fs-f2fs
> @@ -628,12 +628,6 @@ Contact:   "Jaegeuk Kim" 
>  Description:   Controls max # of node block writes to be used for roll 
> forward
> recovery. This can limit the roll forward recovery time.
>
> -What:  /sys/fs/f2fs//unusable_blocks_per_sec
> -Date:  June 2022
> -Contact:   "Jaegeuk Kim" 
> -Description:   Shows the number of unusable blocks in a section which was 
> defined by
> -   the zone capacity reported by underlying zoned device.
> -
>  What:  /sys/fs/f2fs//current_atomic_write
>  Date:  July 2022
>  Contact:   "Daeho Jeong" 
> diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
> index 0d02224b99b7..6617195bd27e 100644
> --- a/fs/f2fs/debug.c
> +++ b/fs/f2fs/debug.c
> @@ -32,21 +32,20 @@ static struct dentry *f2fs_debugfs_root;
>  void f2fs_update_sit_info(struct f2fs_sb_info *sbi)
>  {
> struct f2fs_stat_info *si = F2FS_STAT(sbi);
> -   unsigned long long blks_per_sec, hblks_per_sec, total_vblocks;
> +   unsigned long long hblks_per_sec, total_vblocks;
> unsigned long long bimodal, dist;
> unsigned int segno, vblocks;
> int ndirty = 0;
>
> bimodal = 0;
> total_vblocks = 0;
> -   blks_per_sec = CAP_BLKS_PER_SEC(sbi);
> -   hblks_per_sec = blks_per_sec / 2;
> +   hblks_per_sec = BLKS_PER_SEC(sbi) / 2;
> for (segno = 0; segno < MAIN_SEGS(sbi); segno += SEGS_PER_SEC(sbi)) {
> vblocks = get_valid_blocks(sbi, segno, true);
> dist = abs(vblocks - hblks_per_sec);
> bimodal += dist * dist;
>
> -   if (vblocks > 0 && vblocks < blks_per_sec) {
> +   if (vblocks > 0 && vblocks < BLKS_PER_SEC(sbi)) {
> total_vblocks += vblocks;
> ndirty++;
> }
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index 9a9e858083af..34d718301392 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -1618,7 +1618,6 @@ struct f2fs_sb_info {
> unsigned int meta_ino_num;  /* meta inode number*/
> unsigned int log_blocks_per_seg;/* log2 blocks per segment */
> unsigned int blocks_per_seg;/* blocks per segment */
> -   unsigned int unusable_blocks_per_sec;   /* unusable blocks per 
> section */
> unsigned int segs_per_sec;  /* segments per section */
> unsigned int secs_per_zone; /* sections per zone */
> unsigned int total_sections;/* total section count */
> @@ -3743,10 +3742,6 @@ void f2fs_destroy_segment_manager(struct f2fs_sb_info 
> *sbi);
>  int __init f2fs_create_segment_manager_caches(void);
>  void f2fs_destroy_segment_manager_caches(void);
>  int f2fs_rw_hint_to_seg_type(enum rw_hint hint);
> -unsigned int f2fs_usable_segs_in_sec(struct f2fs_sb_info *sbi,
> -   unsigned int segno);
> -unsigned int f2fs_usable_blks_in_seg(struct f2fs_sb_info *sbi,
> -   unsigned int segno);
>
>  #define DEF_FRAGMENT_SIZE  4
>  #define MIN_FRAGMENT_SIZE  1
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index b0be576b2090..2c13b340c8a0 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -1717,7 +1717,7 @@ static int f2fs_expand_inode_data(struct inode *inode, 
> loff_t offset,
> return 0;
>
> if (f2fs_is_pinned_file(inode)) {
> -   block_t sec_blks = CAP_BLKS_PER_SEC(sbi);
> +   block_t sec_blks = BLKS_PER_SEC(sbi);
> block_t sec_len = roundup(map.m_len, sec_blks);
>
> map.m_len = sec_blks;
> @@ -2525,7 +2525,7 @@ static int __f2fs_ioc_gc_range(struct file *filp, 
> struct f2fs_gc_range *range)
> ret = -EAGAIN;
> goto out;
> }
> -   range->start += CAP_BLKS_PER_SEC(sbi);
> +   range->start += BLKS_PER_SEC(sbi);
> 

Re: [f2fs-dev] [PATCH 3/3 v2] f2fs: kill zone-capacity support

2024-02-07 Thread Jaegeuk Kim
Since we don't see any user, let's kill.

Signed-off-by: Jaegeuk Kim 
---

 from v1:
  - keep setting the seq bit

 Documentation/ABI/testing/sysfs-fs-f2fs |  6 --
 fs/f2fs/debug.c |  7 +-
 fs/f2fs/f2fs.h  |  5 --
 fs/f2fs/file.c  |  6 +-
 fs/f2fs/gc.c| 33 +++--
 fs/f2fs/gc.h| 26 ---
 fs/f2fs/segment.c   | 93 +++--
 fs/f2fs/segment.h   | 41 ---
 fs/f2fs/super.c | 16 ++---
 fs/f2fs/sysfs.c |  6 --
 10 files changed, 44 insertions(+), 195 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs 
b/Documentation/ABI/testing/sysfs-fs-f2fs
index 48c135e24eb5..dff8c87d87dd 100644
--- a/Documentation/ABI/testing/sysfs-fs-f2fs
+++ b/Documentation/ABI/testing/sysfs-fs-f2fs
@@ -628,12 +628,6 @@ Contact:   "Jaegeuk Kim" 
 Description:   Controls max # of node block writes to be used for roll forward
recovery. This can limit the roll forward recovery time.
 
-What:  /sys/fs/f2fs//unusable_blocks_per_sec
-Date:  June 2022
-Contact:   "Jaegeuk Kim" 
-Description:   Shows the number of unusable blocks in a section which was 
defined by
-   the zone capacity reported by underlying zoned device.
-
 What:  /sys/fs/f2fs//current_atomic_write
 Date:  July 2022
 Contact:   "Daeho Jeong" 
diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
index 0d02224b99b7..6617195bd27e 100644
--- a/fs/f2fs/debug.c
+++ b/fs/f2fs/debug.c
@@ -32,21 +32,20 @@ static struct dentry *f2fs_debugfs_root;
 void f2fs_update_sit_info(struct f2fs_sb_info *sbi)
 {
struct f2fs_stat_info *si = F2FS_STAT(sbi);
-   unsigned long long blks_per_sec, hblks_per_sec, total_vblocks;
+   unsigned long long hblks_per_sec, total_vblocks;
unsigned long long bimodal, dist;
unsigned int segno, vblocks;
int ndirty = 0;
 
bimodal = 0;
total_vblocks = 0;
-   blks_per_sec = CAP_BLKS_PER_SEC(sbi);
-   hblks_per_sec = blks_per_sec / 2;
+   hblks_per_sec = BLKS_PER_SEC(sbi) / 2;
for (segno = 0; segno < MAIN_SEGS(sbi); segno += SEGS_PER_SEC(sbi)) {
vblocks = get_valid_blocks(sbi, segno, true);
dist = abs(vblocks - hblks_per_sec);
bimodal += dist * dist;
 
-   if (vblocks > 0 && vblocks < blks_per_sec) {
+   if (vblocks > 0 && vblocks < BLKS_PER_SEC(sbi)) {
total_vblocks += vblocks;
ndirty++;
}
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 9a9e858083af..34d718301392 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1618,7 +1618,6 @@ struct f2fs_sb_info {
unsigned int meta_ino_num;  /* meta inode number*/
unsigned int log_blocks_per_seg;/* log2 blocks per segment */
unsigned int blocks_per_seg;/* blocks per segment */
-   unsigned int unusable_blocks_per_sec;   /* unusable blocks per section 
*/
unsigned int segs_per_sec;  /* segments per section */
unsigned int secs_per_zone; /* sections per zone */
unsigned int total_sections;/* total section count */
@@ -3743,10 +3742,6 @@ void f2fs_destroy_segment_manager(struct f2fs_sb_info 
*sbi);
 int __init f2fs_create_segment_manager_caches(void);
 void f2fs_destroy_segment_manager_caches(void);
 int f2fs_rw_hint_to_seg_type(enum rw_hint hint);
-unsigned int f2fs_usable_segs_in_sec(struct f2fs_sb_info *sbi,
-   unsigned int segno);
-unsigned int f2fs_usable_blks_in_seg(struct f2fs_sb_info *sbi,
-   unsigned int segno);
 
 #define DEF_FRAGMENT_SIZE  4
 #define MIN_FRAGMENT_SIZE  1
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index b0be576b2090..2c13b340c8a0 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1717,7 +1717,7 @@ static int f2fs_expand_inode_data(struct inode *inode, 
loff_t offset,
return 0;
 
if (f2fs_is_pinned_file(inode)) {
-   block_t sec_blks = CAP_BLKS_PER_SEC(sbi);
+   block_t sec_blks = BLKS_PER_SEC(sbi);
block_t sec_len = roundup(map.m_len, sec_blks);
 
map.m_len = sec_blks;
@@ -2525,7 +2525,7 @@ static int __f2fs_ioc_gc_range(struct file *filp, struct 
f2fs_gc_range *range)
ret = -EAGAIN;
goto out;
}
-   range->start += CAP_BLKS_PER_SEC(sbi);
+   range->start += BLKS_PER_SEC(sbi);
if (range->start <= end)
goto do_more;
 out:
@@ -2654,7 +2654,7 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi,
goto out;
}
 
-   sec_num = DIV_ROUND_UP(total, CAP_BLKS_PER_SEC(sbi));
+   sec_num = DIV_ROUND_UP(total,