Commit f2220c7f authored by Qiuyang Sun's avatar Qiuyang Sun Committed by Jaegeuk Kim

f2fs: merge equivalent flags F2FS_GET_BLOCK_[READ|DIO]

Currently, the two flags F2FS_GET_BLOCK_[READ|DIO] are totally equivalent
and can be used interchangably in all scenarios they are involved in.
Neither of the flags is referenced in f2fs_map_blocks(), making them both
the default case. To remove the ambiguity, this patch merges both flags
into F2FS_GET_BLOCK_DEFAULT, and introduces an enum for all distinct flags.
Signed-off-by: default avatarQiuyang Sun <sunqiuyang@huawei.com>
Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 4b2414d0
...@@ -1044,7 +1044,7 @@ static int get_data_block_dio(struct inode *inode, sector_t iblock, ...@@ -1044,7 +1044,7 @@ static int get_data_block_dio(struct inode *inode, sector_t iblock,
struct buffer_head *bh_result, int create) struct buffer_head *bh_result, int create)
{ {
return __get_data_block(inode, iblock, bh_result, create, return __get_data_block(inode, iblock, bh_result, create,
F2FS_GET_BLOCK_DIO, NULL); F2FS_GET_BLOCK_DEFAULT, NULL);
} }
static int get_data_block_bmap(struct inode *inode, sector_t iblock, static int get_data_block_bmap(struct inode *inode, sector_t iblock,
...@@ -1244,7 +1244,7 @@ static int f2fs_mpage_readpages(struct address_space *mapping, ...@@ -1244,7 +1244,7 @@ static int f2fs_mpage_readpages(struct address_space *mapping,
map.m_len = last_block - block_in_file; map.m_len = last_block - block_in_file;
if (f2fs_map_blocks(inode, &map, 0, if (f2fs_map_blocks(inode, &map, 0,
F2FS_GET_BLOCK_READ)) F2FS_GET_BLOCK_DEFAULT))
goto set_error_page; goto set_error_page;
} }
got_it: got_it:
......
...@@ -510,12 +510,13 @@ struct f2fs_map_blocks { ...@@ -510,12 +510,13 @@ struct f2fs_map_blocks {
}; };
/* for flag in get_data_block */ /* for flag in get_data_block */
#define F2FS_GET_BLOCK_READ 0 enum {
#define F2FS_GET_BLOCK_DIO 1 F2FS_GET_BLOCK_DEFAULT,
#define F2FS_GET_BLOCK_FIEMAP 2 F2FS_GET_BLOCK_FIEMAP,
#define F2FS_GET_BLOCK_BMAP 3 F2FS_GET_BLOCK_BMAP,
#define F2FS_GET_BLOCK_PRE_DIO 4 F2FS_GET_BLOCK_PRE_DIO,
#define F2FS_GET_BLOCK_PRE_AIO 5 F2FS_GET_BLOCK_PRE_AIO,
};
/* /*
* i_advise uses FADVISE_XXX_BIT. We can add additional hints later. * i_advise uses FADVISE_XXX_BIT. We can add additional hints later.
......
...@@ -2074,7 +2074,7 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi, ...@@ -2074,7 +2074,7 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi,
*/ */
while (map.m_lblk < pg_end) { while (map.m_lblk < pg_end) {
map.m_len = pg_end - map.m_lblk; map.m_len = pg_end - map.m_lblk;
err = f2fs_map_blocks(inode, &map, 0, F2FS_GET_BLOCK_READ); err = f2fs_map_blocks(inode, &map, 0, F2FS_GET_BLOCK_DEFAULT);
if (err) if (err)
goto out; goto out;
...@@ -2116,7 +2116,7 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi, ...@@ -2116,7 +2116,7 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi,
do_map: do_map:
map.m_len = pg_end - map.m_lblk; map.m_len = pg_end - map.m_lblk;
err = f2fs_map_blocks(inode, &map, 0, F2FS_GET_BLOCK_READ); err = f2fs_map_blocks(inode, &map, 0, F2FS_GET_BLOCK_DEFAULT);
if (err) if (err)
goto clear_out; goto clear_out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment