linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] fsck.f2fs: don't finish zones if it's not open
@ 2024-08-08 20:57 Jaegeuk Kim
  2024-08-12 18:30 ` Daeho Jeong
  2024-08-15  0:54 ` Chao Yu
  0 siblings, 2 replies; 5+ messages in thread
From: Jaegeuk Kim @ 2024-08-08 20:57 UTC (permalink / raw)
  To: linux-f2fs-devel; +Cc: Jaegeuk Kim

Should finish zones if they are open.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 include/f2fs_fs.h   | 2 ++
 lib/libf2fs_zoned.c | 5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
index 3f5583d18329..15a1c82ae18f 100644
--- a/include/f2fs_fs.h
+++ b/include/f2fs_fs.h
@@ -1742,6 +1742,8 @@ blk_zone_cond_str(struct blk_zone *blkz)
  * Handle kernel zone capacity support
  */
 #define blk_zone_empty(z)	(blk_zone_cond(z) == BLK_ZONE_COND_EMPTY)
+#define blk_zone_open(z)	(blk_zone_cond(z) == BLK_ZONE_COND_IMP_OPEN ||	\
+				 blk_zone_cond(z) == BLK_ZONE_COND_EXP_OPEN)
 #define blk_zone_sector(z)	(z)->start
 #define blk_zone_length(z)	(z)->len
 #define blk_zone_wp_sector(z)	(z)->wp
diff --git a/lib/libf2fs_zoned.c b/lib/libf2fs_zoned.c
index 221d7d1337c7..89ba5ad73a76 100644
--- a/lib/libf2fs_zoned.c
+++ b/lib/libf2fs_zoned.c
@@ -513,7 +513,7 @@ int f2fs_finish_zone(int i, void *blkzone)
 	struct blk_zone_range range;
 	int ret;
 
-	if (!blk_zone_seq(blkz) || blk_zone_empty(blkz))
+	if (!blk_zone_seq(blkz) || !blk_zone_open(blkz))
 		return 0;
 
 	/* Non empty sequential zone: finish */
@@ -522,7 +522,8 @@ int f2fs_finish_zone(int i, void *blkzone)
 	ret = ioctl(dev->fd, BLKFINISHZONE, &range);
 	if (ret != 0) {
 		ret = -errno;
-		ERR_MSG("ioctl BLKFINISHZONE failed: errno=%d\n", errno);
+		ERR_MSG("ioctl BLKFINISHZONE failed: errno=%d, status=%s\n",
+			errno, blk_zone_cond_str(blkz));
 	}
 
 	return ret;
-- 
2.46.0.76.ge559c4bf1a-goog



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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [f2fs-dev] [PATCH] fsck.f2fs: don't finish zones if it's not open
  2024-08-08 20:57 [f2fs-dev] [PATCH] fsck.f2fs: don't finish zones if it's not open Jaegeuk Kim
@ 2024-08-12 18:30 ` Daeho Jeong
  2024-08-12 19:53   ` Jaegeuk Kim
  2024-08-15  0:54 ` Chao Yu
  1 sibling, 1 reply; 5+ messages in thread
From: Daeho Jeong @ 2024-08-12 18:30 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: linux-f2fs-devel

On Thu, Aug 8, 2024 at 1:59 PM Jaegeuk Kim <jaegeuk@kernel.org> wrote:
>
> Should finish zones if they are open.
>
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>  include/f2fs_fs.h   | 2 ++
>  lib/libf2fs_zoned.c | 5 +++--
>  2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
> index 3f5583d18329..15a1c82ae18f 100644
> --- a/include/f2fs_fs.h
> +++ b/include/f2fs_fs.h
> @@ -1742,6 +1742,8 @@ blk_zone_cond_str(struct blk_zone *blkz)
>   * Handle kernel zone capacity support
>   */
>  #define blk_zone_empty(z)      (blk_zone_cond(z) == BLK_ZONE_COND_EMPTY)
> +#define blk_zone_open(z)       (blk_zone_cond(z) == BLK_ZONE_COND_IMP_OPEN ||  \
> +                                blk_zone_cond(z) == BLK_ZONE_COND_EXP_OPEN)
>  #define blk_zone_sector(z)     (z)->start
>  #define blk_zone_length(z)     (z)->len
>  #define blk_zone_wp_sector(z)  (z)->wp
> diff --git a/lib/libf2fs_zoned.c b/lib/libf2fs_zoned.c
> index 221d7d1337c7..89ba5ad73a76 100644
> --- a/lib/libf2fs_zoned.c
> +++ b/lib/libf2fs_zoned.c
> @@ -513,7 +513,7 @@ int f2fs_finish_zone(int i, void *blkzone)
>         struct blk_zone_range range;
>         int ret;
>
> -       if (!blk_zone_seq(blkz) || blk_zone_empty(blkz))
> +       if (!blk_zone_seq(blkz) || !blk_zone_open(blkz))

Don't we need to check blk_zone_empty() anymore?

>                 return 0;
>
>         /* Non empty sequential zone: finish */
> @@ -522,7 +522,8 @@ int f2fs_finish_zone(int i, void *blkzone)
>         ret = ioctl(dev->fd, BLKFINISHZONE, &range);
>         if (ret != 0) {
>                 ret = -errno;
> -               ERR_MSG("ioctl BLKFINISHZONE failed: errno=%d\n", errno);
> +               ERR_MSG("ioctl BLKFINISHZONE failed: errno=%d, status=%s\n",
> +                       errno, blk_zone_cond_str(blkz));
>         }
>
>         return ret;
> --
> 2.46.0.76.ge559c4bf1a-goog
>
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [f2fs-dev] [PATCH] fsck.f2fs: don't finish zones if it's not open
  2024-08-12 18:30 ` Daeho Jeong
@ 2024-08-12 19:53   ` Jaegeuk Kim
  2024-08-13 17:34     ` Daeho Jeong
  0 siblings, 1 reply; 5+ messages in thread
From: Jaegeuk Kim @ 2024-08-12 19:53 UTC (permalink / raw)
  To: Daeho Jeong; +Cc: linux-f2fs-devel

On 08/12, Daeho Jeong wrote:
> On Thu, Aug 8, 2024 at 1:59 PM Jaegeuk Kim <jaegeuk@kernel.org> wrote:
> >
> > Should finish zones if they are open.
> >
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> >  include/f2fs_fs.h   | 2 ++
> >  lib/libf2fs_zoned.c | 5 +++--
> >  2 files changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
> > index 3f5583d18329..15a1c82ae18f 100644
> > --- a/include/f2fs_fs.h
> > +++ b/include/f2fs_fs.h
> > @@ -1742,6 +1742,8 @@ blk_zone_cond_str(struct blk_zone *blkz)
> >   * Handle kernel zone capacity support
> >   */
> >  #define blk_zone_empty(z)      (blk_zone_cond(z) == BLK_ZONE_COND_EMPTY)
> > +#define blk_zone_open(z)       (blk_zone_cond(z) == BLK_ZONE_COND_IMP_OPEN ||  \
> > +                                blk_zone_cond(z) == BLK_ZONE_COND_EXP_OPEN)
> >  #define blk_zone_sector(z)     (z)->start
> >  #define blk_zone_length(z)     (z)->len
> >  #define blk_zone_wp_sector(z)  (z)->wp
> > diff --git a/lib/libf2fs_zoned.c b/lib/libf2fs_zoned.c
> > index 221d7d1337c7..89ba5ad73a76 100644
> > --- a/lib/libf2fs_zoned.c
> > +++ b/lib/libf2fs_zoned.c
> > @@ -513,7 +513,7 @@ int f2fs_finish_zone(int i, void *blkzone)
> >         struct blk_zone_range range;
> >         int ret;
> >
> > -       if (!blk_zone_seq(blkz) || blk_zone_empty(blkz))
> > +       if (!blk_zone_seq(blkz) || !blk_zone_open(blkz))
> 
> Don't we need to check blk_zone_empty() anymore?

I think the purpose of finishing a zone is to close any open zones. I expect
the empty|full zone will be reset by f2fs later before use.

> 
> >                 return 0;
> >
> >         /* Non empty sequential zone: finish */
> > @@ -522,7 +522,8 @@ int f2fs_finish_zone(int i, void *blkzone)
> >         ret = ioctl(dev->fd, BLKFINISHZONE, &range);
> >         if (ret != 0) {
> >                 ret = -errno;
> > -               ERR_MSG("ioctl BLKFINISHZONE failed: errno=%d\n", errno);
> > +               ERR_MSG("ioctl BLKFINISHZONE failed: errno=%d, status=%s\n",
> > +                       errno, blk_zone_cond_str(blkz));
> >         }
> >
> >         return ret;
> > --
> > 2.46.0.76.ge559c4bf1a-goog
> >
> >
> >
> > _______________________________________________
> > Linux-f2fs-devel mailing list
> > Linux-f2fs-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [f2fs-dev] [PATCH] fsck.f2fs: don't finish zones if it's not open
  2024-08-12 19:53   ` Jaegeuk Kim
@ 2024-08-13 17:34     ` Daeho Jeong
  0 siblings, 0 replies; 5+ messages in thread
From: Daeho Jeong @ 2024-08-13 17:34 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: linux-f2fs-devel

On Mon, Aug 12, 2024 at 12:53 PM Jaegeuk Kim <jaegeuk@kernel.org> wrote:
>
> On 08/12, Daeho Jeong wrote:
> > On Thu, Aug 8, 2024 at 1:59 PM Jaegeuk Kim <jaegeuk@kernel.org> wrote:
> > >
> > > Should finish zones if they are open.
> > >
> > > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > > ---
> > >  include/f2fs_fs.h   | 2 ++
> > >  lib/libf2fs_zoned.c | 5 +++--
> > >  2 files changed, 5 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
> > > index 3f5583d18329..15a1c82ae18f 100644
> > > --- a/include/f2fs_fs.h
> > > +++ b/include/f2fs_fs.h
> > > @@ -1742,6 +1742,8 @@ blk_zone_cond_str(struct blk_zone *blkz)
> > >   * Handle kernel zone capacity support
> > >   */
> > >  #define blk_zone_empty(z)      (blk_zone_cond(z) == BLK_ZONE_COND_EMPTY)
> > > +#define blk_zone_open(z)       (blk_zone_cond(z) == BLK_ZONE_COND_IMP_OPEN ||  \
> > > +                                blk_zone_cond(z) == BLK_ZONE_COND_EXP_OPEN)
> > >  #define blk_zone_sector(z)     (z)->start
> > >  #define blk_zone_length(z)     (z)->len
> > >  #define blk_zone_wp_sector(z)  (z)->wp
> > > diff --git a/lib/libf2fs_zoned.c b/lib/libf2fs_zoned.c
> > > index 221d7d1337c7..89ba5ad73a76 100644
> > > --- a/lib/libf2fs_zoned.c
> > > +++ b/lib/libf2fs_zoned.c
> > > @@ -513,7 +513,7 @@ int f2fs_finish_zone(int i, void *blkzone)
> > >         struct blk_zone_range range;
> > >         int ret;
> > >
> > > -       if (!blk_zone_seq(blkz) || blk_zone_empty(blkz))
> > > +       if (!blk_zone_seq(blkz) || !blk_zone_open(blkz))
> >
> > Don't we need to check blk_zone_empty() anymore?
>
> I think the purpose of finishing a zone is to close any open zones. I expect
> the empty|full zone will be reset by f2fs later before use.

makes sense.

Reviewed-by: Daeho Jeong <daehojeong@google.com>

Thanks,


>
> >
> > >                 return 0;
> > >
> > >         /* Non empty sequential zone: finish */
> > > @@ -522,7 +522,8 @@ int f2fs_finish_zone(int i, void *blkzone)
> > >         ret = ioctl(dev->fd, BLKFINISHZONE, &range);
> > >         if (ret != 0) {
> > >                 ret = -errno;
> > > -               ERR_MSG("ioctl BLKFINISHZONE failed: errno=%d\n", errno);
> > > +               ERR_MSG("ioctl BLKFINISHZONE failed: errno=%d, status=%s\n",
> > > +                       errno, blk_zone_cond_str(blkz));
> > >         }
> > >
> > >         return ret;
> > > --
> > > 2.46.0.76.ge559c4bf1a-goog
> > >
> > >
> > >
> > > _______________________________________________
> > > Linux-f2fs-devel mailing list
> > > Linux-f2fs-devel@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [f2fs-dev] [PATCH] fsck.f2fs: don't finish zones if it's not open
  2024-08-08 20:57 [f2fs-dev] [PATCH] fsck.f2fs: don't finish zones if it's not open Jaegeuk Kim
  2024-08-12 18:30 ` Daeho Jeong
@ 2024-08-15  0:54 ` Chao Yu
  1 sibling, 0 replies; 5+ messages in thread
From: Chao Yu @ 2024-08-15  0:54 UTC (permalink / raw)
  To: Jaegeuk Kim, linux-f2fs-devel

On 2024/8/9 4:57, Jaegeuk Kim wrote:
> Should finish zones if they are open.
> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-08-15  0:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-08 20:57 [f2fs-dev] [PATCH] fsck.f2fs: don't finish zones if it's not open Jaegeuk Kim
2024-08-12 18:30 ` Daeho Jeong
2024-08-12 19:53   ` Jaegeuk Kim
2024-08-13 17:34     ` Daeho Jeong
2024-08-15  0:54 ` Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).