On 12/25/2025 4:44 AM, Sergey Shtylyov wrote:
In __is_valid_data_blkaddr(), an *if* statement is used where a *switch*
statement clearly fits better...

I think previous version is clear to understand, unless we add more *_ADDR. :)

Thanks,


Signed-off-by: Sergey Shtylyov <[email protected]>
---
This patch is against the dev branch of Jaegeuk Kim's f2fs.git repo.

  fs/f2fs/f2fs.h | 10 +++++++---
  1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 53cbce96f126..ea2b224150ce 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -3680,10 +3680,14 @@ static inline void verify_blkaddr(struct f2fs_sb_info 
*sbi,
static inline bool __is_valid_data_blkaddr(block_t blkaddr)
  {
-       if (blkaddr == NEW_ADDR || blkaddr == NULL_ADDR ||
-                       blkaddr == COMPRESS_ADDR)
+       switch (blkaddr) {
+       case NEW_ADDR:
+       case NULL_ADDR:
+       case COMPRESS_ADDR:
                return false;
-       return true;
+       default:
+               return true;
+       }
  }
/*



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to