forked from luck/tmp_suning_uos_patched
btrfs: make btrfs_find_ordered_sum take btrfs_inode
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
f1bbde8d5f
commit
3c5641a83a
|
@ -318,8 +318,8 @@ blk_status_t btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio,
|
|||
|
||||
if (page_offsets)
|
||||
offset = page_offset(bvec.bv_page) + bvec.bv_offset;
|
||||
count = btrfs_find_ordered_sum(inode, offset, disk_bytenr,
|
||||
csum, nblocks);
|
||||
count = btrfs_find_ordered_sum(BTRFS_I(inode), offset,
|
||||
disk_bytenr, csum, nblocks);
|
||||
if (count)
|
||||
goto found;
|
||||
|
||||
|
|
|
@ -861,20 +861,21 @@ btrfs_lookup_first_ordered_extent(struct btrfs_inode *inode, u64 file_offset)
|
|||
* try to find a checksum. This is used because we allow pages to
|
||||
* be reclaimed before their checksum is actually put into the btree
|
||||
*/
|
||||
int btrfs_find_ordered_sum(struct inode *inode, u64 offset, u64 disk_bytenr,
|
||||
u8 *sum, int len)
|
||||
int btrfs_find_ordered_sum(struct btrfs_inode *inode, u64 offset,
|
||||
u64 disk_bytenr, u8 *sum, int len)
|
||||
{
|
||||
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
|
||||
struct btrfs_fs_info *fs_info = inode->root->fs_info;
|
||||
struct btrfs_ordered_sum *ordered_sum;
|
||||
struct btrfs_ordered_extent *ordered;
|
||||
struct btrfs_ordered_inode_tree *tree = &BTRFS_I(inode)->ordered_tree;
|
||||
struct btrfs_ordered_inode_tree *tree = &inode->ordered_tree;
|
||||
unsigned long num_sectors;
|
||||
unsigned long i;
|
||||
u32 sectorsize = btrfs_inode_sectorsize(BTRFS_I(inode));
|
||||
u32 sectorsize = btrfs_inode_sectorsize(inode);
|
||||
const u8 blocksize_bits = inode->vfs_inode.i_sb->s_blocksize_bits;
|
||||
const u16 csum_size = btrfs_super_csum_size(fs_info->super_copy);
|
||||
int index = 0;
|
||||
|
||||
ordered = btrfs_lookup_ordered_extent(BTRFS_I(inode), offset);
|
||||
ordered = btrfs_lookup_ordered_extent(inode, offset);
|
||||
if (!ordered)
|
||||
return 0;
|
||||
|
||||
|
@ -882,10 +883,8 @@ int btrfs_find_ordered_sum(struct inode *inode, u64 offset, u64 disk_bytenr,
|
|||
list_for_each_entry_reverse(ordered_sum, &ordered->list, list) {
|
||||
if (disk_bytenr >= ordered_sum->bytenr &&
|
||||
disk_bytenr < ordered_sum->bytenr + ordered_sum->len) {
|
||||
i = (disk_bytenr - ordered_sum->bytenr) >>
|
||||
inode->i_sb->s_blocksize_bits;
|
||||
num_sectors = ordered_sum->len >>
|
||||
inode->i_sb->s_blocksize_bits;
|
||||
i = (disk_bytenr - ordered_sum->bytenr) >> blocksize_bits;
|
||||
num_sectors = ordered_sum->len >> blocksize_bits;
|
||||
num_sectors = min_t(int, len - index, num_sectors - i);
|
||||
memcpy(sum + index, ordered_sum->sums + i * csum_size,
|
||||
num_sectors * csum_size);
|
||||
|
|
|
@ -185,8 +185,8 @@ struct btrfs_ordered_extent *btrfs_lookup_ordered_range(
|
|||
u64 len);
|
||||
void btrfs_get_ordered_extents_for_logging(struct btrfs_inode *inode,
|
||||
struct list_head *list);
|
||||
int btrfs_find_ordered_sum(struct inode *inode, u64 offset, u64 disk_bytenr,
|
||||
u8 *sum, int len);
|
||||
int btrfs_find_ordered_sum(struct btrfs_inode *inode, u64 offset,
|
||||
u64 disk_bytenr, u8 *sum, int len);
|
||||
u64 btrfs_wait_ordered_extents(struct btrfs_root *root, u64 nr,
|
||||
const u64 range_start, const u64 range_len);
|
||||
void btrfs_wait_ordered_roots(struct btrfs_fs_info *fs_info, u64 nr,
|
||||
|
|
Loading…
Reference in New Issue
Block a user