|
@@ -194,7 +194,7 @@ struct cp_control {
|
|
|
};
|
|
|
|
|
|
/*
|
|
|
- * For CP/NAT/SIT/SSA readahead
|
|
|
+ * indicate meta/data type
|
|
|
*/
|
|
|
enum {
|
|
|
META_CP,
|
|
@@ -202,6 +202,8 @@ enum {
|
|
|
META_SIT,
|
|
|
META_SSA,
|
|
|
META_POR,
|
|
|
+ DATA_GENERIC,
|
|
|
+ META_GENERIC,
|
|
|
};
|
|
|
|
|
|
/* for the list of ino */
|
|
@@ -2666,13 +2668,36 @@ static inline void f2fs_update_iostat(struct f2fs_sb_info *sbi,
|
|
|
spin_unlock(&sbi->iostat_lock);
|
|
|
}
|
|
|
|
|
|
-static inline bool is_valid_blkaddr(block_t blkaddr)
|
|
|
+bool f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi,
|
|
|
+ block_t blkaddr, int type);
|
|
|
+void f2fs_msg(struct super_block *sb, const char *level, const char *fmt, ...);
|
|
|
+static inline void verify_blkaddr(struct f2fs_sb_info *sbi,
|
|
|
+ block_t blkaddr, int type)
|
|
|
+{
|
|
|
+ if (!f2fs_is_valid_blkaddr(sbi, blkaddr, type)) {
|
|
|
+ f2fs_msg(sbi->sb, KERN_ERR,
|
|
|
+ "invalid blkaddr: %u, type: %d, run fsck to fix.",
|
|
|
+ blkaddr, type);
|
|
|
+ f2fs_bug_on(sbi, 1);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+static inline bool __is_valid_data_blkaddr(block_t blkaddr)
|
|
|
{
|
|
|
if (blkaddr == NEW_ADDR || blkaddr == NULL_ADDR)
|
|
|
return false;
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+static inline bool is_valid_data_blkaddr(struct f2fs_sb_info *sbi,
|
|
|
+ block_t blkaddr)
|
|
|
+{
|
|
|
+ if (!__is_valid_data_blkaddr(blkaddr))
|
|
|
+ return false;
|
|
|
+ verify_blkaddr(sbi, blkaddr, DATA_GENERIC);
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
/*
|
|
|
* file.c
|
|
|
*/
|
|
@@ -2896,8 +2921,8 @@ void f2fs_stop_checkpoint(struct f2fs_sb_info *sbi, bool end_io);
|
|
|
struct page *f2fs_grab_meta_page(struct f2fs_sb_info *sbi, pgoff_t index);
|
|
|
struct page *f2fs_get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index);
|
|
|
struct page *f2fs_get_tmp_page(struct f2fs_sb_info *sbi, pgoff_t index);
|
|
|
-bool f2fs_is_valid_meta_blkaddr(struct f2fs_sb_info *sbi,
|
|
|
- block_t blkaddr, int type);
|
|
|
+bool f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi,
|
|
|
+ block_t blkaddr, int type);
|
|
|
int f2fs_ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages,
|
|
|
int type, bool sync);
|
|
|
void f2fs_ra_meta_pages_cond(struct f2fs_sb_info *sbi, pgoff_t index);
|