aboutsummaryrefslogtreecommitdiff
path: root/include/f2fs_fs.h
diff options
context:
space:
mode:
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>2019-11-28 16:59:23 +0900
committerJaegeuk Kim <jaegeuk@kernel.org>2019-12-09 17:23:19 -0800
commit512b8426acf1f146cf2f07cf680f1155d886ef94 (patch)
tree0bb53fafe81101ae97549d6b9d19681c46b2ee55 /include/f2fs_fs.h
parent05fee40110881bab81de649bdb8462dfbdd19220 (diff)
downloadf2fs-tools-512b8426acf1f146cf2f07cf680f1155d886ef94.tar.gz
libf2fs_zoned: Introduce f2fs_report_zones() helper function
To prepare for write pointer consistency check by fsck, add f2fs_report_zones() helper function which calls REPORT ZONE command to get write pointer status. The function is added to lib/libf2fs_zoned which gathers zoned block device related functions. To check write pointer consistency with f2fs meta data, fsck needs to refer both of reported zone information and f2fs super block structure "f2fs_sb_info". However, libf2fs_zoned does not import f2fs_sb_info. To keep f2fs_sb_info structure out of libf2fs_zoned, provide a callback function in fsck to f2fs_report_zones() and call it for each zone. Add SECTOR_SHIFT definition in include/f2fs_fs.h to avoid a magic number to convert bytes into 512B sectors. Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'include/f2fs_fs.h')
-rw-r--r--include/f2fs_fs.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
index 84f3f3e..a437379 100644
--- a/include/f2fs_fs.h
+++ b/include/f2fs_fs.h
@@ -279,6 +279,9 @@ static inline uint64_t bswap_64(uint64_t val)
#endif
#define PAGE_CACHE_SIZE 4096
#define BITS_PER_BYTE 8
+#ifndef SECTOR_SHIFT
+#define SECTOR_SHIFT 9
+#endif
#define F2FS_SUPER_MAGIC 0xF2F52010 /* F2FS Magic Number */
#define CP_CHKSUM_OFFSET 4092
#define SB_CHKSUM_OFFSET 3068
@@ -1296,6 +1299,8 @@ blk_zone_cond_str(struct blk_zone *blkz)
extern int f2fs_get_zoned_model(int);
extern int f2fs_get_zone_blocks(int);
+typedef int (report_zones_cb_t)(int i, void *, void *);
+extern int f2fs_report_zones(int, report_zones_cb_t *, void *);
extern int f2fs_check_zones(int);
extern int f2fs_reset_zones(int);