Skip to content

Commit 0d49543

Browse files
Christoph Hellwigkdave
authored andcommitted
btrfs: set bbio->file_offset in alloc_new_bio
Instead of digging into the bio_vec in submit_one_bio, set file_offset at bio allocation time from the provided parameter. This also ensures that the file_offset is available all the time when building up the bio payload. Reviewed-by: Josef Bacik <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 72fcf1a commit 0d49543

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

fs/btrfs/extent_io.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,6 @@ static void submit_one_bio(struct btrfs_bio_ctrl *bio_ctrl)
140140
/* Caller should ensure the bio has at least some range added */
141141
ASSERT(bio->bi_iter.bi_size);
142142

143-
btrfs_bio(bio)->file_offset = page_offset(bv->bv_page) + bv->bv_offset;
144-
145143
if (!is_data_inode(inode)) {
146144
if (btrfs_op(bio) != BTRFS_MAP_WRITE) {
147145
/*
@@ -993,6 +991,7 @@ static void alloc_new_bio(struct btrfs_inode *inode,
993991
bio->bi_iter.bi_sector = disk_bytenr >> SECTOR_SHIFT;
994992
else
995993
bio->bi_iter.bi_sector = (disk_bytenr + offset) >> SECTOR_SHIFT;
994+
btrfs_bio(bio)->file_offset = file_offset;
996995
bio_ctrl->bio = bio;
997996
bio_ctrl->compress_type = compress_type;
998997
calc_bio_boundaries(bio_ctrl, inode, file_offset);

0 commit comments

Comments
 (0)