diff options
Diffstat (limited to 'fs/f2fs/data.c')
-rw-r--r-- | fs/f2fs/data.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 0924521306b4..f8cf619edb5f 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c | |||
@@ -608,8 +608,8 @@ static int __allocate_data_block(struct dnode_of_data *dn) | |||
608 | * b. do not use extent cache for better performance | 608 | * b. do not use extent cache for better performance |
609 | * c. give the block addresses to blockdev | 609 | * c. give the block addresses to blockdev |
610 | */ | 610 | */ |
611 | static int get_data_block(struct inode *inode, sector_t iblock, | 611 | static int __get_data_block(struct inode *inode, sector_t iblock, |
612 | struct buffer_head *bh_result, int create) | 612 | struct buffer_head *bh_result, int create, bool fiemap) |
613 | { | 613 | { |
614 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); | 614 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
615 | unsigned int blkbits = inode->i_sb->s_blocksize_bits; | 615 | unsigned int blkbits = inode->i_sb->s_blocksize_bits; |
@@ -637,7 +637,7 @@ static int get_data_block(struct inode *inode, sector_t iblock, | |||
637 | err = 0; | 637 | err = 0; |
638 | goto unlock_out; | 638 | goto unlock_out; |
639 | } | 639 | } |
640 | if (dn.data_blkaddr == NEW_ADDR) | 640 | if (dn.data_blkaddr == NEW_ADDR && !fiemap) |
641 | goto put_out; | 641 | goto put_out; |
642 | 642 | ||
643 | if (dn.data_blkaddr != NULL_ADDR) { | 643 | if (dn.data_blkaddr != NULL_ADDR) { |
@@ -671,7 +671,7 @@ get_next: | |||
671 | err = 0; | 671 | err = 0; |
672 | goto unlock_out; | 672 | goto unlock_out; |
673 | } | 673 | } |
674 | if (dn.data_blkaddr == NEW_ADDR) | 674 | if (dn.data_blkaddr == NEW_ADDR && !fiemap) |
675 | goto put_out; | 675 | goto put_out; |
676 | 676 | ||
677 | end_offset = ADDRS_PER_PAGE(dn.node_page, F2FS_I(inode)); | 677 | end_offset = ADDRS_PER_PAGE(dn.node_page, F2FS_I(inode)); |
@@ -708,10 +708,23 @@ out: | |||
708 | return err; | 708 | return err; |
709 | } | 709 | } |
710 | 710 | ||
711 | static int get_data_block(struct inode *inode, sector_t iblock, | ||
712 | struct buffer_head *bh_result, int create) | ||
713 | { | ||
714 | return __get_data_block(inode, iblock, bh_result, create, false); | ||
715 | } | ||
716 | |||
717 | static int get_data_block_fiemap(struct inode *inode, sector_t iblock, | ||
718 | struct buffer_head *bh_result, int create) | ||
719 | { | ||
720 | return __get_data_block(inode, iblock, bh_result, create, true); | ||
721 | } | ||
722 | |||
711 | int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | 723 | int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, |
712 | u64 start, u64 len) | 724 | u64 start, u64 len) |
713 | { | 725 | { |
714 | return generic_block_fiemap(inode, fieinfo, start, len, get_data_block); | 726 | return generic_block_fiemap(inode, fieinfo, |
727 | start, len, get_data_block_fiemap); | ||
715 | } | 728 | } |
716 | 729 | ||
717 | static int f2fs_read_data_page(struct file *file, struct page *page) | 730 | static int f2fs_read_data_page(struct file *file, struct page *page) |