|
@@ -608,8 +608,8 @@ static int __allocate_data_block(struct dnode_of_data *dn)
|
|
* b. do not use extent cache for better performance
|
|
* b. do not use extent cache for better performance
|
|
* c. give the block addresses to blockdev
|
|
* c. give the block addresses to blockdev
|
|
*/
|
|
*/
|
|
-static int get_data_block(struct inode *inode, sector_t iblock,
|
|
|
|
- struct buffer_head *bh_result, int create)
|
|
|
|
|
|
+static int __get_data_block(struct inode *inode, sector_t iblock,
|
|
|
|
+ struct buffer_head *bh_result, int create, bool fiemap)
|
|
{
|
|
{
|
|
struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
|
|
struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
|
|
unsigned int blkbits = inode->i_sb->s_blocksize_bits;
|
|
unsigned int blkbits = inode->i_sb->s_blocksize_bits;
|
|
@@ -637,7 +637,7 @@ static int get_data_block(struct inode *inode, sector_t iblock,
|
|
err = 0;
|
|
err = 0;
|
|
goto unlock_out;
|
|
goto unlock_out;
|
|
}
|
|
}
|
|
- if (dn.data_blkaddr == NEW_ADDR)
|
|
|
|
|
|
+ if (dn.data_blkaddr == NEW_ADDR && !fiemap)
|
|
goto put_out;
|
|
goto put_out;
|
|
|
|
|
|
if (dn.data_blkaddr != NULL_ADDR) {
|
|
if (dn.data_blkaddr != NULL_ADDR) {
|
|
@@ -671,7 +671,7 @@ get_next:
|
|
err = 0;
|
|
err = 0;
|
|
goto unlock_out;
|
|
goto unlock_out;
|
|
}
|
|
}
|
|
- if (dn.data_blkaddr == NEW_ADDR)
|
|
|
|
|
|
+ if (dn.data_blkaddr == NEW_ADDR && !fiemap)
|
|
goto put_out;
|
|
goto put_out;
|
|
|
|
|
|
end_offset = ADDRS_PER_PAGE(dn.node_page, F2FS_I(inode));
|
|
end_offset = ADDRS_PER_PAGE(dn.node_page, F2FS_I(inode));
|
|
@@ -708,10 +708,23 @@ out:
|
|
return err;
|
|
return err;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static int get_data_block(struct inode *inode, sector_t iblock,
|
|
|
|
+ struct buffer_head *bh_result, int create)
|
|
|
|
+{
|
|
|
|
+ return __get_data_block(inode, iblock, bh_result, create, false);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int get_data_block_fiemap(struct inode *inode, sector_t iblock,
|
|
|
|
+ struct buffer_head *bh_result, int create)
|
|
|
|
+{
|
|
|
|
+ return __get_data_block(inode, iblock, bh_result, create, true);
|
|
|
|
+}
|
|
|
|
+
|
|
int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
|
|
int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
|
|
u64 start, u64 len)
|
|
u64 start, u64 len)
|
|
{
|
|
{
|
|
- return generic_block_fiemap(inode, fieinfo, start, len, get_data_block);
|
|
|
|
|
|
+ return generic_block_fiemap(inode, fieinfo,
|
|
|
|
+ start, len, get_data_block_fiemap);
|
|
}
|
|
}
|
|
|
|
|
|
static int f2fs_read_data_page(struct file *file, struct page *page)
|
|
static int f2fs_read_data_page(struct file *file, struct page *page)
|