mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-08 15:04:45 +00:00
btrfs: remove extent_map::orig_start member
Since we have extent_map::offset, the old extent_map::orig_start is just extent_map::start - extent_map::offset for non-hole/inline extents. And since the new extent_map::offset is already verified by validate_extent_map() while the old orig_start is not, let's just remove the old member from all call sites. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
3f255ece2f
commit
4aa7b5d178
@ -528,7 +528,7 @@ struct btrfs_file_extent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
|
noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
|
||||||
u64 *orig_start, u64 *orig_block_len,
|
u64 *orig_block_len,
|
||||||
u64 *ram_bytes, struct btrfs_file_extent *file_extent,
|
u64 *ram_bytes, struct btrfs_file_extent *file_extent,
|
||||||
bool nowait, bool strict);
|
bool nowait, bool strict);
|
||||||
|
|
||||||
|
@ -590,7 +590,7 @@ void btrfs_submit_compressed_read(struct btrfs_bio *bbio)
|
|||||||
cb = alloc_compressed_bio(inode, file_offset, REQ_OP_READ,
|
cb = alloc_compressed_bio(inode, file_offset, REQ_OP_READ,
|
||||||
end_bbio_compressed_read);
|
end_bbio_compressed_read);
|
||||||
|
|
||||||
cb->start = em->orig_start;
|
cb->start = em->start - em->offset;
|
||||||
em_len = em->len;
|
em_len = em->len;
|
||||||
em_start = em->start;
|
em_start = em->start;
|
||||||
|
|
||||||
|
@ -707,7 +707,6 @@ static struct extent_map *defrag_get_extent(struct btrfs_inode *inode,
|
|||||||
*/
|
*/
|
||||||
if (key.offset > start) {
|
if (key.offset > start) {
|
||||||
em->start = start;
|
em->start = start;
|
||||||
em->orig_start = start;
|
|
||||||
em->block_start = EXTENT_MAP_HOLE;
|
em->block_start = EXTENT_MAP_HOLE;
|
||||||
em->disk_bytenr = EXTENT_MAP_HOLE;
|
em->disk_bytenr = EXTENT_MAP_HOLE;
|
||||||
em->disk_num_bytes = 0;
|
em->disk_num_bytes = 0;
|
||||||
|
@ -290,9 +290,9 @@ static void dump_extent_map(struct btrfs_fs_info *fs_info, const char *prefix,
|
|||||||
if (!IS_ENABLED(CONFIG_BTRFS_DEBUG))
|
if (!IS_ENABLED(CONFIG_BTRFS_DEBUG))
|
||||||
return;
|
return;
|
||||||
btrfs_crit(fs_info,
|
btrfs_crit(fs_info,
|
||||||
"%s, start=%llu len=%llu disk_bytenr=%llu disk_num_bytes=%llu ram_bytes=%llu offset=%llu orig_start=%llu block_start=%llu block_len=%llu flags=0x%x",
|
"%s, start=%llu len=%llu disk_bytenr=%llu disk_num_bytes=%llu ram_bytes=%llu offset=%llu block_start=%llu block_len=%llu flags=0x%x",
|
||||||
prefix, em->start, em->len, em->disk_bytenr, em->disk_num_bytes,
|
prefix, em->start, em->len, em->disk_bytenr, em->disk_num_bytes,
|
||||||
em->ram_bytes, em->offset, em->orig_start, em->block_start,
|
em->ram_bytes, em->offset, em->block_start,
|
||||||
em->block_len, em->flags);
|
em->block_len, em->flags);
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
@ -318,15 +318,6 @@ static void validate_extent_map(struct btrfs_fs_info *fs_info, struct extent_map
|
|||||||
if (em->disk_num_bytes != em->block_len)
|
if (em->disk_num_bytes != em->block_len)
|
||||||
dump_extent_map(fs_info,
|
dump_extent_map(fs_info,
|
||||||
"mismatch disk_num_bytes/block_len", em);
|
"mismatch disk_num_bytes/block_len", em);
|
||||||
/*
|
|
||||||
* Here we only check the start/orig_start/offset for
|
|
||||||
* compressed extents as that's the only case where
|
|
||||||
* orig_start is utilized.
|
|
||||||
*/
|
|
||||||
if (em->orig_start != em->start - em->offset)
|
|
||||||
dump_extent_map(fs_info,
|
|
||||||
"mismatch orig_start/offset/start", em);
|
|
||||||
|
|
||||||
} else if (em->block_start != em->disk_bytenr + em->offset) {
|
} else if (em->block_start != em->disk_bytenr + em->offset) {
|
||||||
dump_extent_map(fs_info,
|
dump_extent_map(fs_info,
|
||||||
"mismatch block_start/disk_bytenr/offset", em);
|
"mismatch block_start/disk_bytenr/offset", em);
|
||||||
@ -363,7 +354,6 @@ static void try_merge_map(struct btrfs_inode *inode, struct extent_map *em)
|
|||||||
merge = rb_entry(rb, struct extent_map, rb_node);
|
merge = rb_entry(rb, struct extent_map, rb_node);
|
||||||
if (rb && can_merge_extent_map(merge) && mergeable_maps(merge, em)) {
|
if (rb && can_merge_extent_map(merge) && mergeable_maps(merge, em)) {
|
||||||
em->start = merge->start;
|
em->start = merge->start;
|
||||||
em->orig_start = merge->orig_start;
|
|
||||||
em->len += merge->len;
|
em->len += merge->len;
|
||||||
em->block_len += merge->block_len;
|
em->block_len += merge->block_len;
|
||||||
em->block_start = merge->block_start;
|
em->block_start = merge->block_start;
|
||||||
@ -898,7 +888,6 @@ void btrfs_drop_extent_map_range(struct btrfs_inode *inode, u64 start, u64 end,
|
|||||||
split->len = start - em->start;
|
split->len = start - em->start;
|
||||||
|
|
||||||
if (em->block_start < EXTENT_MAP_LAST_BYTE) {
|
if (em->block_start < EXTENT_MAP_LAST_BYTE) {
|
||||||
split->orig_start = em->orig_start;
|
|
||||||
split->block_start = em->block_start;
|
split->block_start = em->block_start;
|
||||||
|
|
||||||
if (compressed)
|
if (compressed)
|
||||||
@ -911,7 +900,6 @@ void btrfs_drop_extent_map_range(struct btrfs_inode *inode, u64 start, u64 end,
|
|||||||
split->offset = em->offset;
|
split->offset = em->offset;
|
||||||
split->ram_bytes = em->ram_bytes;
|
split->ram_bytes = em->ram_bytes;
|
||||||
} else {
|
} else {
|
||||||
split->orig_start = split->start;
|
|
||||||
split->block_len = 0;
|
split->block_len = 0;
|
||||||
split->block_start = em->block_start;
|
split->block_start = em->block_start;
|
||||||
split->disk_bytenr = em->disk_bytenr;
|
split->disk_bytenr = em->disk_bytenr;
|
||||||
@ -948,19 +936,16 @@ void btrfs_drop_extent_map_range(struct btrfs_inode *inode, u64 start, u64 end,
|
|||||||
split->ram_bytes = em->ram_bytes;
|
split->ram_bytes = em->ram_bytes;
|
||||||
if (compressed) {
|
if (compressed) {
|
||||||
split->block_len = em->block_len;
|
split->block_len = em->block_len;
|
||||||
split->orig_start = em->orig_start;
|
|
||||||
} else {
|
} else {
|
||||||
const u64 diff = end - em->start;
|
const u64 diff = end - em->start;
|
||||||
|
|
||||||
split->block_len = split->len;
|
split->block_len = split->len;
|
||||||
split->block_start += diff;
|
split->block_start += diff;
|
||||||
split->orig_start = em->orig_start;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
split->disk_num_bytes = 0;
|
split->disk_num_bytes = 0;
|
||||||
split->offset = 0;
|
split->offset = 0;
|
||||||
split->ram_bytes = split->len;
|
split->ram_bytes = split->len;
|
||||||
split->orig_start = split->start;
|
|
||||||
split->block_len = 0;
|
split->block_len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1118,7 +1103,6 @@ int split_extent_map(struct btrfs_inode *inode, u64 start, u64 len, u64 pre,
|
|||||||
split_pre->disk_bytenr = new_logical;
|
split_pre->disk_bytenr = new_logical;
|
||||||
split_pre->disk_num_bytes = split_pre->len;
|
split_pre->disk_num_bytes = split_pre->len;
|
||||||
split_pre->offset = 0;
|
split_pre->offset = 0;
|
||||||
split_pre->orig_start = split_pre->start;
|
|
||||||
split_pre->block_start = new_logical;
|
split_pre->block_start = new_logical;
|
||||||
split_pre->block_len = split_pre->len;
|
split_pre->block_len = split_pre->len;
|
||||||
split_pre->ram_bytes = split_pre->len;
|
split_pre->ram_bytes = split_pre->len;
|
||||||
@ -1138,7 +1122,6 @@ int split_extent_map(struct btrfs_inode *inode, u64 start, u64 len, u64 pre,
|
|||||||
split_mid->disk_bytenr = em->block_start + pre;
|
split_mid->disk_bytenr = em->block_start + pre;
|
||||||
split_mid->disk_num_bytes = split_mid->len;
|
split_mid->disk_num_bytes = split_mid->len;
|
||||||
split_mid->offset = 0;
|
split_mid->offset = 0;
|
||||||
split_mid->orig_start = split_mid->start;
|
|
||||||
split_mid->block_start = em->block_start + pre;
|
split_mid->block_start = em->block_start + pre;
|
||||||
split_mid->block_len = split_mid->len;
|
split_mid->block_len = split_mid->len;
|
||||||
split_mid->ram_bytes = split_mid->len;
|
split_mid->ram_bytes = split_mid->len;
|
||||||
|
@ -61,15 +61,6 @@ struct extent_map {
|
|||||||
*/
|
*/
|
||||||
u64 len;
|
u64 len;
|
||||||
|
|
||||||
/*
|
|
||||||
* The file offset of the original file extent before splitting.
|
|
||||||
*
|
|
||||||
* This is an in-memory only member, matching
|
|
||||||
* extent_map::start - btrfs_file_extent_item::offset for
|
|
||||||
* regular/preallocated extents. EXTENT_MAP_HOLE otherwise.
|
|
||||||
*/
|
|
||||||
u64 orig_start;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The bytenr of the full on-disk extent.
|
* The bytenr of the full on-disk extent.
|
||||||
*
|
*
|
||||||
|
@ -1293,8 +1293,6 @@ void btrfs_extent_item_to_extent_map(struct btrfs_inode *inode,
|
|||||||
type == BTRFS_FILE_EXTENT_PREALLOC) {
|
type == BTRFS_FILE_EXTENT_PREALLOC) {
|
||||||
em->start = extent_start;
|
em->start = extent_start;
|
||||||
em->len = btrfs_file_extent_end(path) - extent_start;
|
em->len = btrfs_file_extent_end(path) - extent_start;
|
||||||
em->orig_start = extent_start -
|
|
||||||
btrfs_file_extent_offset(leaf, fi);
|
|
||||||
bytenr = btrfs_file_extent_disk_bytenr(leaf, fi);
|
bytenr = btrfs_file_extent_disk_bytenr(leaf, fi);
|
||||||
if (bytenr == 0) {
|
if (bytenr == 0) {
|
||||||
em->block_start = EXTENT_MAP_HOLE;
|
em->block_start = EXTENT_MAP_HOLE;
|
||||||
@ -1327,10 +1325,9 @@ void btrfs_extent_item_to_extent_map(struct btrfs_inode *inode,
|
|||||||
em->len = fs_info->sectorsize;
|
em->len = fs_info->sectorsize;
|
||||||
em->offset = 0;
|
em->offset = 0;
|
||||||
/*
|
/*
|
||||||
* Initialize orig_start and block_len with the same values
|
* Initialize block_len with the same values
|
||||||
* as in inode.c:btrfs_get_extent().
|
* as in inode.c:btrfs_get_extent().
|
||||||
*/
|
*/
|
||||||
em->orig_start = EXTENT_MAP_HOLE;
|
|
||||||
em->block_len = (u64)-1;
|
em->block_len = (u64)-1;
|
||||||
extent_map_set_compression(em, compress_type);
|
extent_map_set_compression(em, compress_type);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1104,7 +1104,7 @@ int btrfs_check_nocow_lock(struct btrfs_inode *inode, loff_t pos,
|
|||||||
&cached_state);
|
&cached_state);
|
||||||
}
|
}
|
||||||
ret = can_nocow_extent(&inode->vfs_inode, lockstart, &num_bytes,
|
ret = can_nocow_extent(&inode->vfs_inode, lockstart, &num_bytes,
|
||||||
NULL, NULL, NULL, NULL, nowait, false);
|
NULL, NULL, NULL, nowait, false);
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
btrfs_drew_write_unlock(&root->snapshot_lock);
|
btrfs_drew_write_unlock(&root->snapshot_lock);
|
||||||
else
|
else
|
||||||
@ -2346,7 +2346,6 @@ static int fill_holes(struct btrfs_trans_handle *trans,
|
|||||||
hole_em->start = offset;
|
hole_em->start = offset;
|
||||||
hole_em->len = end - offset;
|
hole_em->len = end - offset;
|
||||||
hole_em->ram_bytes = hole_em->len;
|
hole_em->ram_bytes = hole_em->len;
|
||||||
hole_em->orig_start = offset;
|
|
||||||
|
|
||||||
hole_em->block_start = EXTENT_MAP_HOLE;
|
hole_em->block_start = EXTENT_MAP_HOLE;
|
||||||
hole_em->disk_bytenr = EXTENT_MAP_HOLE;
|
hole_em->disk_bytenr = EXTENT_MAP_HOLE;
|
||||||
|
@ -139,7 +139,7 @@ static noinline int run_delalloc_cow(struct btrfs_inode *inode,
|
|||||||
u64 end, struct writeback_control *wbc,
|
u64 end, struct writeback_control *wbc,
|
||||||
bool pages_dirty);
|
bool pages_dirty);
|
||||||
static struct extent_map *create_io_em(struct btrfs_inode *inode, u64 start,
|
static struct extent_map *create_io_em(struct btrfs_inode *inode, u64 start,
|
||||||
u64 len, u64 orig_start, u64 block_start,
|
u64 len, u64 block_start,
|
||||||
u64 block_len, u64 disk_num_bytes,
|
u64 block_len, u64 disk_num_bytes,
|
||||||
u64 ram_bytes, int compress_type,
|
u64 ram_bytes, int compress_type,
|
||||||
const struct btrfs_file_extent *file_extent,
|
const struct btrfs_file_extent *file_extent,
|
||||||
@ -1210,7 +1210,6 @@ static void submit_one_async_extent(struct async_chunk *async_chunk,
|
|||||||
|
|
||||||
em = create_io_em(inode, start,
|
em = create_io_em(inode, start,
|
||||||
async_extent->ram_size, /* len */
|
async_extent->ram_size, /* len */
|
||||||
start, /* orig_start */
|
|
||||||
ins.objectid, /* block_start */
|
ins.objectid, /* block_start */
|
||||||
ins.offset, /* block_len */
|
ins.offset, /* block_len */
|
||||||
ins.offset, /* orig_block_len */
|
ins.offset, /* orig_block_len */
|
||||||
@ -1454,7 +1453,6 @@ static noinline int cow_file_range(struct btrfs_inode *inode,
|
|||||||
&cached);
|
&cached);
|
||||||
|
|
||||||
em = create_io_em(inode, start, ins.offset, /* len */
|
em = create_io_em(inode, start, ins.offset, /* len */
|
||||||
start, /* orig_start */
|
|
||||||
ins.objectid, /* block_start */
|
ins.objectid, /* block_start */
|
||||||
ins.offset, /* block_len */
|
ins.offset, /* block_len */
|
||||||
ins.offset, /* orig_block_len */
|
ins.offset, /* orig_block_len */
|
||||||
@ -2190,11 +2188,9 @@ static noinline int run_delalloc_nocow(struct btrfs_inode *inode,
|
|||||||
|
|
||||||
is_prealloc = extent_type == BTRFS_FILE_EXTENT_PREALLOC;
|
is_prealloc = extent_type == BTRFS_FILE_EXTENT_PREALLOC;
|
||||||
if (is_prealloc) {
|
if (is_prealloc) {
|
||||||
u64 orig_start = found_key.offset - nocow_args.extent_offset;
|
|
||||||
struct extent_map *em;
|
struct extent_map *em;
|
||||||
|
|
||||||
em = create_io_em(inode, cur_offset, nocow_args.num_bytes,
|
em = create_io_em(inode, cur_offset, nocow_args.num_bytes,
|
||||||
orig_start,
|
|
||||||
nocow_args.disk_bytenr, /* block_start */
|
nocow_args.disk_bytenr, /* block_start */
|
||||||
nocow_args.num_bytes, /* block_len */
|
nocow_args.num_bytes, /* block_len */
|
||||||
nocow_args.disk_num_bytes, /* orig_block_len */
|
nocow_args.disk_num_bytes, /* orig_block_len */
|
||||||
@ -5029,7 +5025,6 @@ int btrfs_cont_expand(struct btrfs_inode *inode, loff_t oldsize, loff_t size)
|
|||||||
}
|
}
|
||||||
hole_em->start = cur_offset;
|
hole_em->start = cur_offset;
|
||||||
hole_em->len = hole_size;
|
hole_em->len = hole_size;
|
||||||
hole_em->orig_start = cur_offset;
|
|
||||||
|
|
||||||
hole_em->block_start = EXTENT_MAP_HOLE;
|
hole_em->block_start = EXTENT_MAP_HOLE;
|
||||||
hole_em->disk_bytenr = EXTENT_MAP_HOLE;
|
hole_em->disk_bytenr = EXTENT_MAP_HOLE;
|
||||||
@ -6900,7 +6895,6 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
em->start = EXTENT_MAP_HOLE;
|
em->start = EXTENT_MAP_HOLE;
|
||||||
em->orig_start = EXTENT_MAP_HOLE;
|
|
||||||
em->disk_bytenr = EXTENT_MAP_HOLE;
|
em->disk_bytenr = EXTENT_MAP_HOLE;
|
||||||
em->len = (u64)-1;
|
em->len = (u64)-1;
|
||||||
em->block_len = (u64)-1;
|
em->block_len = (u64)-1;
|
||||||
@ -6993,7 +6987,6 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
|
|||||||
|
|
||||||
/* New extent overlaps with existing one */
|
/* New extent overlaps with existing one */
|
||||||
em->start = start;
|
em->start = start;
|
||||||
em->orig_start = start;
|
|
||||||
em->len = found_key.offset - start;
|
em->len = found_key.offset - start;
|
||||||
em->block_start = EXTENT_MAP_HOLE;
|
em->block_start = EXTENT_MAP_HOLE;
|
||||||
goto insert;
|
goto insert;
|
||||||
@ -7029,7 +7022,6 @@ struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
|
|||||||
}
|
}
|
||||||
not_found:
|
not_found:
|
||||||
em->start = start;
|
em->start = start;
|
||||||
em->orig_start = start;
|
|
||||||
em->len = len;
|
em->len = len;
|
||||||
em->block_start = EXTENT_MAP_HOLE;
|
em->block_start = EXTENT_MAP_HOLE;
|
||||||
insert:
|
insert:
|
||||||
@ -7062,7 +7054,6 @@ static struct extent_map *btrfs_create_dio_extent(struct btrfs_inode *inode,
|
|||||||
struct btrfs_dio_data *dio_data,
|
struct btrfs_dio_data *dio_data,
|
||||||
const u64 start,
|
const u64 start,
|
||||||
const u64 len,
|
const u64 len,
|
||||||
const u64 orig_start,
|
|
||||||
const u64 block_start,
|
const u64 block_start,
|
||||||
const u64 block_len,
|
const u64 block_len,
|
||||||
const u64 orig_block_len,
|
const u64 orig_block_len,
|
||||||
@ -7074,7 +7065,7 @@ static struct extent_map *btrfs_create_dio_extent(struct btrfs_inode *inode,
|
|||||||
struct btrfs_ordered_extent *ordered;
|
struct btrfs_ordered_extent *ordered;
|
||||||
|
|
||||||
if (type != BTRFS_ORDERED_NOCOW) {
|
if (type != BTRFS_ORDERED_NOCOW) {
|
||||||
em = create_io_em(inode, start, len, orig_start, block_start,
|
em = create_io_em(inode, start, len, block_start,
|
||||||
block_len, orig_block_len, ram_bytes,
|
block_len, orig_block_len, ram_bytes,
|
||||||
BTRFS_COMPRESS_NONE, /* compress_type */
|
BTRFS_COMPRESS_NONE, /* compress_type */
|
||||||
file_extent, type);
|
file_extent, type);
|
||||||
@ -7133,7 +7124,7 @@ static struct extent_map *btrfs_new_extent_direct(struct btrfs_inode *inode,
|
|||||||
file_extent.ram_bytes = ins.offset;
|
file_extent.ram_bytes = ins.offset;
|
||||||
file_extent.offset = 0;
|
file_extent.offset = 0;
|
||||||
file_extent.compression = BTRFS_COMPRESS_NONE;
|
file_extent.compression = BTRFS_COMPRESS_NONE;
|
||||||
em = btrfs_create_dio_extent(inode, dio_data, start, ins.offset, start,
|
em = btrfs_create_dio_extent(inode, dio_data, start, ins.offset,
|
||||||
ins.objectid, ins.offset, ins.offset,
|
ins.objectid, ins.offset, ins.offset,
|
||||||
ins.offset, BTRFS_ORDERED_REGULAR,
|
ins.offset, BTRFS_ORDERED_REGULAR,
|
||||||
&file_extent);
|
&file_extent);
|
||||||
@ -7179,7 +7170,7 @@ static bool btrfs_extent_readonly(struct btrfs_fs_info *fs_info, u64 bytenr)
|
|||||||
* any ordered extents.
|
* any ordered extents.
|
||||||
*/
|
*/
|
||||||
noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
|
noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
|
||||||
u64 *orig_start, u64 *orig_block_len,
|
u64 *orig_block_len,
|
||||||
u64 *ram_bytes, struct btrfs_file_extent *file_extent,
|
u64 *ram_bytes, struct btrfs_file_extent *file_extent,
|
||||||
bool nowait, bool strict)
|
bool nowait, bool strict)
|
||||||
{
|
{
|
||||||
@ -7266,8 +7257,6 @@ noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (orig_start)
|
|
||||||
*orig_start = key.offset - nocow_args.extent_offset;
|
|
||||||
if (orig_block_len)
|
if (orig_block_len)
|
||||||
*orig_block_len = nocow_args.disk_num_bytes;
|
*orig_block_len = nocow_args.disk_num_bytes;
|
||||||
if (file_extent)
|
if (file_extent)
|
||||||
@ -7375,7 +7364,7 @@ static int lock_extent_direct(struct inode *inode, u64 lockstart, u64 lockend,
|
|||||||
|
|
||||||
/* The callers of this must take lock_extent() */
|
/* The callers of this must take lock_extent() */
|
||||||
static struct extent_map *create_io_em(struct btrfs_inode *inode, u64 start,
|
static struct extent_map *create_io_em(struct btrfs_inode *inode, u64 start,
|
||||||
u64 len, u64 orig_start, u64 block_start,
|
u64 len, u64 block_start,
|
||||||
u64 block_len, u64 disk_num_bytes,
|
u64 block_len, u64 disk_num_bytes,
|
||||||
u64 ram_bytes, int compress_type,
|
u64 ram_bytes, int compress_type,
|
||||||
const struct btrfs_file_extent *file_extent,
|
const struct btrfs_file_extent *file_extent,
|
||||||
@ -7413,7 +7402,7 @@ static struct extent_map *create_io_em(struct btrfs_inode *inode, u64 start,
|
|||||||
ASSERT(ram_bytes == len);
|
ASSERT(ram_bytes == len);
|
||||||
|
|
||||||
/* Since it's a new extent, we should not have any offset. */
|
/* Since it's a new extent, we should not have any offset. */
|
||||||
ASSERT(orig_start == start);
|
ASSERT(file_extent->offset == 0);
|
||||||
break;
|
break;
|
||||||
case BTRFS_ORDERED_COMPRESSED:
|
case BTRFS_ORDERED_COMPRESSED:
|
||||||
/* Must be compressed. */
|
/* Must be compressed. */
|
||||||
@ -7432,7 +7421,6 @@ static struct extent_map *create_io_em(struct btrfs_inode *inode, u64 start,
|
|||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
em->start = start;
|
em->start = start;
|
||||||
em->orig_start = orig_start;
|
|
||||||
em->len = len;
|
em->len = len;
|
||||||
em->block_len = block_len;
|
em->block_len = block_len;
|
||||||
em->block_start = block_start;
|
em->block_start = block_start;
|
||||||
@ -7467,7 +7455,7 @@ static int btrfs_get_blocks_direct_write(struct extent_map **map,
|
|||||||
struct btrfs_file_extent file_extent;
|
struct btrfs_file_extent file_extent;
|
||||||
struct extent_map *em = *map;
|
struct extent_map *em = *map;
|
||||||
int type;
|
int type;
|
||||||
u64 block_start, orig_start, orig_block_len, ram_bytes;
|
u64 block_start, orig_block_len, ram_bytes;
|
||||||
struct btrfs_block_group *bg;
|
struct btrfs_block_group *bg;
|
||||||
bool can_nocow = false;
|
bool can_nocow = false;
|
||||||
bool space_reserved = false;
|
bool space_reserved = false;
|
||||||
@ -7494,7 +7482,7 @@ static int btrfs_get_blocks_direct_write(struct extent_map **map,
|
|||||||
len = min(len, em->len - (start - em->start));
|
len = min(len, em->len - (start - em->start));
|
||||||
block_start = em->block_start + (start - em->start);
|
block_start = em->block_start + (start - em->start);
|
||||||
|
|
||||||
if (can_nocow_extent(inode, start, &len, &orig_start,
|
if (can_nocow_extent(inode, start, &len,
|
||||||
&orig_block_len, &ram_bytes,
|
&orig_block_len, &ram_bytes,
|
||||||
&file_extent, false, false) == 1) {
|
&file_extent, false, false) == 1) {
|
||||||
bg = btrfs_inc_nocow_writers(fs_info, block_start);
|
bg = btrfs_inc_nocow_writers(fs_info, block_start);
|
||||||
@ -7522,7 +7510,7 @@ static int btrfs_get_blocks_direct_write(struct extent_map **map,
|
|||||||
space_reserved = true;
|
space_reserved = true;
|
||||||
|
|
||||||
em2 = btrfs_create_dio_extent(BTRFS_I(inode), dio_data, start, len,
|
em2 = btrfs_create_dio_extent(BTRFS_I(inode), dio_data, start, len,
|
||||||
orig_start, block_start,
|
block_start,
|
||||||
len, orig_block_len,
|
len, orig_block_len,
|
||||||
ram_bytes, type,
|
ram_bytes, type,
|
||||||
&file_extent);
|
&file_extent);
|
||||||
@ -9614,7 +9602,6 @@ static int __btrfs_prealloc_file_range(struct inode *inode, int mode,
|
|||||||
}
|
}
|
||||||
|
|
||||||
em->start = cur_offset;
|
em->start = cur_offset;
|
||||||
em->orig_start = cur_offset;
|
|
||||||
em->len = ins.offset;
|
em->len = ins.offset;
|
||||||
em->block_start = ins.objectid;
|
em->block_start = ins.objectid;
|
||||||
em->disk_bytenr = ins.objectid;
|
em->disk_bytenr = ins.objectid;
|
||||||
@ -10123,7 +10110,7 @@ ssize_t btrfs_encoded_read(struct kiocb *iocb, struct iov_iter *iter,
|
|||||||
disk_io_size = em->block_len;
|
disk_io_size = em->block_len;
|
||||||
count = em->block_len;
|
count = em->block_len;
|
||||||
encoded->unencoded_len = em->ram_bytes;
|
encoded->unencoded_len = em->ram_bytes;
|
||||||
encoded->unencoded_offset = iocb->ki_pos - em->orig_start;
|
encoded->unencoded_offset = iocb->ki_pos - (em->start - em->offset);
|
||||||
ret = btrfs_encoded_io_compression_from_extent(fs_info,
|
ret = btrfs_encoded_io_compression_from_extent(fs_info,
|
||||||
extent_map_compression(em));
|
extent_map_compression(em));
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@ -10368,7 +10355,7 @@ ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from,
|
|||||||
file_extent.offset = encoded->unencoded_offset;
|
file_extent.offset = encoded->unencoded_offset;
|
||||||
file_extent.compression = compression;
|
file_extent.compression = compression;
|
||||||
em = create_io_em(inode, start, num_bytes,
|
em = create_io_em(inode, start, num_bytes,
|
||||||
start - encoded->unencoded_offset, ins.objectid,
|
ins.objectid,
|
||||||
ins.offset, ins.offset, ram_bytes, compression,
|
ins.offset, ins.offset, ram_bytes, compression,
|
||||||
&file_extent, BTRFS_ORDERED_COMPRESSED);
|
&file_extent, BTRFS_ORDERED_COMPRESSED);
|
||||||
if (IS_ERR(em)) {
|
if (IS_ERR(em)) {
|
||||||
@ -10700,7 +10687,7 @@ static int btrfs_swap_activate(struct swap_info_struct *sis, struct file *file,
|
|||||||
free_extent_map(em);
|
free_extent_map(em);
|
||||||
em = NULL;
|
em = NULL;
|
||||||
|
|
||||||
ret = can_nocow_extent(inode, start, &len, NULL, NULL, NULL, NULL, false, true);
|
ret = can_nocow_extent(inode, start, &len, NULL, NULL, NULL, false, true);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto out;
|
goto out;
|
||||||
} else if (ret) {
|
} else if (ret) {
|
||||||
|
@ -2911,7 +2911,6 @@ static noinline_for_stack int setup_relocation_extent_mapping(struct inode *inod
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
em->start = start;
|
em->start = start;
|
||||||
em->orig_start = start;
|
|
||||||
em->len = end + 1 - start;
|
em->len = end + 1 - start;
|
||||||
em->block_len = em->len;
|
em->block_len = em->len;
|
||||||
em->block_start = block_start;
|
em->block_start = block_start;
|
||||||
|
@ -99,7 +99,6 @@ static int test_case_1(struct btrfs_fs_info *fs_info, struct btrfs_inode *inode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
em->start = SZ_16K;
|
em->start = SZ_16K;
|
||||||
em->orig_start = SZ_16K;
|
|
||||||
em->len = SZ_4K;
|
em->len = SZ_4K;
|
||||||
em->block_start = SZ_32K; /* avoid merging */
|
em->block_start = SZ_32K; /* avoid merging */
|
||||||
em->block_len = SZ_4K;
|
em->block_len = SZ_4K;
|
||||||
@ -124,7 +123,6 @@ static int test_case_1(struct btrfs_fs_info *fs_info, struct btrfs_inode *inode)
|
|||||||
|
|
||||||
/* Add [0, 8K), should return [0, 16K) instead. */
|
/* Add [0, 8K), should return [0, 16K) instead. */
|
||||||
em->start = start;
|
em->start = start;
|
||||||
em->orig_start = start;
|
|
||||||
em->len = len;
|
em->len = len;
|
||||||
em->block_start = start;
|
em->block_start = start;
|
||||||
em->block_len = len;
|
em->block_len = len;
|
||||||
@ -206,7 +204,6 @@ static int test_case_2(struct btrfs_fs_info *fs_info, struct btrfs_inode *inode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
em->start = SZ_4K;
|
em->start = SZ_4K;
|
||||||
em->orig_start = SZ_4K;
|
|
||||||
em->len = SZ_4K;
|
em->len = SZ_4K;
|
||||||
em->block_start = SZ_4K;
|
em->block_start = SZ_4K;
|
||||||
em->block_len = SZ_4K;
|
em->block_len = SZ_4K;
|
||||||
@ -283,7 +280,6 @@ static int __test_case_3(struct btrfs_fs_info *fs_info,
|
|||||||
|
|
||||||
/* Add [4K, 8K) */
|
/* Add [4K, 8K) */
|
||||||
em->start = SZ_4K;
|
em->start = SZ_4K;
|
||||||
em->orig_start = SZ_4K;
|
|
||||||
em->len = SZ_4K;
|
em->len = SZ_4K;
|
||||||
em->block_start = SZ_4K;
|
em->block_start = SZ_4K;
|
||||||
em->block_len = SZ_4K;
|
em->block_len = SZ_4K;
|
||||||
@ -421,7 +417,6 @@ static int __test_case_4(struct btrfs_fs_info *fs_info,
|
|||||||
|
|
||||||
/* Add [8K, 32K) */
|
/* Add [8K, 32K) */
|
||||||
em->start = SZ_8K;
|
em->start = SZ_8K;
|
||||||
em->orig_start = SZ_8K;
|
|
||||||
em->len = 24 * SZ_1K;
|
em->len = 24 * SZ_1K;
|
||||||
em->block_start = SZ_16K; /* avoid merging */
|
em->block_start = SZ_16K; /* avoid merging */
|
||||||
em->block_len = 24 * SZ_1K;
|
em->block_len = 24 * SZ_1K;
|
||||||
@ -445,7 +440,6 @@ static int __test_case_4(struct btrfs_fs_info *fs_info,
|
|||||||
}
|
}
|
||||||
/* Add [0K, 32K) */
|
/* Add [0K, 32K) */
|
||||||
em->start = 0;
|
em->start = 0;
|
||||||
em->orig_start = 0;
|
|
||||||
em->len = SZ_32K;
|
em->len = SZ_32K;
|
||||||
em->block_start = 0;
|
em->block_start = 0;
|
||||||
em->block_len = SZ_32K;
|
em->block_len = SZ_32K;
|
||||||
@ -533,7 +527,6 @@ static int add_compressed_extent(struct btrfs_inode *inode,
|
|||||||
}
|
}
|
||||||
|
|
||||||
em->start = start;
|
em->start = start;
|
||||||
em->orig_start = start;
|
|
||||||
em->len = len;
|
em->len = len;
|
||||||
em->block_start = block_start;
|
em->block_start = block_start;
|
||||||
em->block_len = SZ_4K;
|
em->block_len = SZ_4K;
|
||||||
@ -758,7 +751,6 @@ static int test_case_6(struct btrfs_fs_info *fs_info, struct btrfs_inode *inode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
em->start = SZ_4K;
|
em->start = SZ_4K;
|
||||||
em->orig_start = SZ_4K;
|
|
||||||
em->len = SZ_4K;
|
em->len = SZ_4K;
|
||||||
em->block_start = SZ_16K;
|
em->block_start = SZ_16K;
|
||||||
em->block_len = SZ_16K;
|
em->block_len = SZ_16K;
|
||||||
@ -840,7 +832,6 @@ static int test_case_7(struct btrfs_fs_info *fs_info, struct btrfs_inode *inode)
|
|||||||
|
|
||||||
/* [32K, 48K), not pinned */
|
/* [32K, 48K), not pinned */
|
||||||
em->start = SZ_32K;
|
em->start = SZ_32K;
|
||||||
em->orig_start = SZ_32K;
|
|
||||||
em->len = SZ_16K;
|
em->len = SZ_16K;
|
||||||
em->block_start = SZ_32K;
|
em->block_start = SZ_32K;
|
||||||
em->block_len = SZ_16K;
|
em->block_len = SZ_16K;
|
||||||
|
@ -358,9 +358,8 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
|
|||||||
test_err("unexpected flags set, want 0 have %u", em->flags);
|
test_err("unexpected flags set, want 0 have %u", em->flags);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (em->orig_start != em->start) {
|
if (em->offset != 0) {
|
||||||
test_err("wrong orig offset, want %llu, have %llu", em->start,
|
test_err("wrong offset, want 0, have %llu", em->offset);
|
||||||
em->orig_start);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
offset = em->start + em->len;
|
offset = em->start + em->len;
|
||||||
@ -386,9 +385,8 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
|
|||||||
test_err("unexpected flags set, want 0 have %u", em->flags);
|
test_err("unexpected flags set, want 0 have %u", em->flags);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (em->orig_start != em->start) {
|
if (em->offset != 0) {
|
||||||
test_err("wrong orig offset, want %llu, have %llu", em->start,
|
test_err("wrong offset, want 0, have %llu", em->offset);
|
||||||
em->orig_start);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
disk_bytenr = em->block_start;
|
disk_bytenr = em->block_start;
|
||||||
@ -437,9 +435,9 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
|
|||||||
test_err("unexpected flags set, want 0 have %u", em->flags);
|
test_err("unexpected flags set, want 0 have %u", em->flags);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (em->orig_start != orig_start) {
|
if (em->start - em->offset != orig_start) {
|
||||||
test_err("wrong orig offset, want %llu, have %llu",
|
test_err("wrong offset, em->start=%llu em->offset=%llu orig_start=%llu",
|
||||||
orig_start, em->orig_start);
|
em->start, em->offset, orig_start);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
disk_bytenr += (em->start - orig_start);
|
disk_bytenr += (em->start - orig_start);
|
||||||
@ -472,9 +470,8 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
|
|||||||
prealloc_only, em->flags);
|
prealloc_only, em->flags);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (em->orig_start != em->start) {
|
if (em->offset != 0) {
|
||||||
test_err("wrong orig offset, want %llu, have %llu", em->start,
|
test_err("wrong offset, want 0, have %llu", em->offset);
|
||||||
em->orig_start);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
offset = em->start + em->len;
|
offset = em->start + em->len;
|
||||||
@ -501,9 +498,8 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
|
|||||||
prealloc_only, em->flags);
|
prealloc_only, em->flags);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (em->orig_start != em->start) {
|
if (em->offset != 0) {
|
||||||
test_err("wrong orig offset, want %llu, have %llu", em->start,
|
test_err("wrong offset, want 0, have %llu", em->offset);
|
||||||
em->orig_start);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
disk_bytenr = em->block_start;
|
disk_bytenr = em->block_start;
|
||||||
@ -530,15 +526,14 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
|
|||||||
test_err("unexpected flags set, want 0 have %u", em->flags);
|
test_err("unexpected flags set, want 0 have %u", em->flags);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (em->orig_start != orig_start) {
|
if (em->start - em->offset != orig_start) {
|
||||||
test_err("unexpected orig offset, wanted %llu, have %llu",
|
test_err("unexpected offset, wanted %llu, have %llu",
|
||||||
orig_start, em->orig_start);
|
em->start - orig_start, em->offset);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (em->block_start != (disk_bytenr + (em->start - em->orig_start))) {
|
if (em->block_start != disk_bytenr + em->offset) {
|
||||||
test_err("unexpected block start, wanted %llu, have %llu",
|
test_err("unexpected block start, wanted %llu, have %llu",
|
||||||
disk_bytenr + (em->start - em->orig_start),
|
disk_bytenr + em->offset, em->block_start);
|
||||||
em->block_start);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
offset = em->start + em->len;
|
offset = em->start + em->len;
|
||||||
@ -564,15 +559,14 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
|
|||||||
prealloc_only, em->flags);
|
prealloc_only, em->flags);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (em->orig_start != orig_start) {
|
if (em->start - em->offset != orig_start) {
|
||||||
test_err("wrong orig offset, want %llu, have %llu", orig_start,
|
test_err("wrong offset, em->start=%llu em->offset=%llu orig_start=%llu",
|
||||||
em->orig_start);
|
em->start, em->offset, orig_start);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (em->block_start != (disk_bytenr + (em->start - em->orig_start))) {
|
if (em->block_start != disk_bytenr + em->offset) {
|
||||||
test_err("unexpected block start, wanted %llu, have %llu",
|
test_err("unexpected block start, wanted %llu, have %llu",
|
||||||
disk_bytenr + (em->start - em->orig_start),
|
disk_bytenr + em->offset, em->block_start);
|
||||||
em->block_start);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
offset = em->start + em->len;
|
offset = em->start + em->len;
|
||||||
@ -599,9 +593,8 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
|
|||||||
compressed_only, em->flags);
|
compressed_only, em->flags);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (em->orig_start != em->start) {
|
if (em->offset != 0) {
|
||||||
test_err("wrong orig offset, want %llu, have %llu",
|
test_err("wrong offset, want 0, have %llu", em->offset);
|
||||||
em->start, em->orig_start);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (extent_map_compression(em) != BTRFS_COMPRESS_ZLIB) {
|
if (extent_map_compression(em) != BTRFS_COMPRESS_ZLIB) {
|
||||||
@ -633,9 +626,8 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
|
|||||||
compressed_only, em->flags);
|
compressed_only, em->flags);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (em->orig_start != em->start) {
|
if (em->offset != 0) {
|
||||||
test_err("wrong orig offset, want %llu, have %llu",
|
test_err("wrong offset, want 0, have %llu", em->offset);
|
||||||
em->start, em->orig_start);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (extent_map_compression(em) != BTRFS_COMPRESS_ZLIB) {
|
if (extent_map_compression(em) != BTRFS_COMPRESS_ZLIB) {
|
||||||
@ -667,9 +659,8 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
|
|||||||
test_err("unexpected flags set, want 0 have %u", em->flags);
|
test_err("unexpected flags set, want 0 have %u", em->flags);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (em->orig_start != em->start) {
|
if (em->offset != 0) {
|
||||||
test_err("wrong orig offset, want %llu, have %llu", em->start,
|
test_err("wrong offset, want 0, have %llu", em->offset);
|
||||||
em->orig_start);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
offset = em->start + em->len;
|
offset = em->start + em->len;
|
||||||
@ -696,9 +687,9 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
|
|||||||
compressed_only, em->flags);
|
compressed_only, em->flags);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (em->orig_start != orig_start) {
|
if (em->start - em->offset != orig_start) {
|
||||||
test_err("wrong orig offset, want %llu, have %llu",
|
test_err("wrong offset, em->start=%llu em->offset=%llu orig_start=%llu",
|
||||||
em->start, orig_start);
|
em->start, em->offset, orig_start);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (extent_map_compression(em) != BTRFS_COMPRESS_ZLIB) {
|
if (extent_map_compression(em) != BTRFS_COMPRESS_ZLIB) {
|
||||||
@ -729,9 +720,8 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
|
|||||||
test_err("unexpected flags set, want 0 have %u", em->flags);
|
test_err("unexpected flags set, want 0 have %u", em->flags);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (em->orig_start != em->start) {
|
if (em->offset != 0) {
|
||||||
test_err("wrong orig offset, want %llu, have %llu", em->start,
|
test_err("wrong offset, want 0, have %llu", em->offset);
|
||||||
em->orig_start);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
offset = em->start + em->len;
|
offset = em->start + em->len;
|
||||||
@ -762,9 +752,8 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
|
|||||||
vacancy_only, em->flags);
|
vacancy_only, em->flags);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (em->orig_start != em->start) {
|
if (em->offset != 0) {
|
||||||
test_err("wrong orig offset, want %llu, have %llu", em->start,
|
test_err("wrong offset, want 0, have %llu", em->offset);
|
||||||
em->orig_start);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
offset = em->start + em->len;
|
offset = em->start + em->len;
|
||||||
@ -789,9 +778,8 @@ static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
|
|||||||
test_err("unexpected flags set, want 0 have %u", em->flags);
|
test_err("unexpected flags set, want 0 have %u", em->flags);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (em->orig_start != em->start) {
|
if (em->offset != 0) {
|
||||||
test_err("wrong orig offset, want %llu, have %llu", em->start,
|
test_err("wrong orig offset, want 0, have %llu", em->offset);
|
||||||
em->orig_start);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -4710,7 +4710,7 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
|
|||||||
struct extent_buffer *leaf;
|
struct extent_buffer *leaf;
|
||||||
struct btrfs_key key;
|
struct btrfs_key key;
|
||||||
enum btrfs_compression_type compress_type;
|
enum btrfs_compression_type compress_type;
|
||||||
u64 extent_offset = em->start - em->orig_start;
|
u64 extent_offset = em->offset;
|
||||||
u64 block_len;
|
u64 block_len;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -291,7 +291,6 @@ TRACE_EVENT_CONDITION(btrfs_get_extent,
|
|||||||
__field( u64, ino )
|
__field( u64, ino )
|
||||||
__field( u64, start )
|
__field( u64, start )
|
||||||
__field( u64, len )
|
__field( u64, len )
|
||||||
__field( u64, orig_start )
|
|
||||||
__field( u64, block_start )
|
__field( u64, block_start )
|
||||||
__field( u64, block_len )
|
__field( u64, block_len )
|
||||||
__field( u32, flags )
|
__field( u32, flags )
|
||||||
@ -303,21 +302,18 @@ TRACE_EVENT_CONDITION(btrfs_get_extent,
|
|||||||
__entry->ino = btrfs_ino(inode);
|
__entry->ino = btrfs_ino(inode);
|
||||||
__entry->start = map->start;
|
__entry->start = map->start;
|
||||||
__entry->len = map->len;
|
__entry->len = map->len;
|
||||||
__entry->orig_start = map->orig_start;
|
|
||||||
__entry->block_start = map->block_start;
|
__entry->block_start = map->block_start;
|
||||||
__entry->block_len = map->block_len;
|
__entry->block_len = map->block_len;
|
||||||
__entry->flags = map->flags;
|
__entry->flags = map->flags;
|
||||||
__entry->refs = refcount_read(&map->refs);
|
__entry->refs = refcount_read(&map->refs);
|
||||||
),
|
),
|
||||||
|
|
||||||
TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu len=%llu "
|
TP_printk_btrfs(
|
||||||
"orig_start=%llu block_start=%llu(%s) "
|
"root=%llu(%s) ino=%llu start=%llu len=%llu block_start=%llu(%s) block_len=%llu flags=%s refs=%u",
|
||||||
"block_len=%llu flags=%s refs=%u",
|
|
||||||
show_root_type(__entry->root_objectid),
|
show_root_type(__entry->root_objectid),
|
||||||
__entry->ino,
|
__entry->ino,
|
||||||
__entry->start,
|
__entry->start,
|
||||||
__entry->len,
|
__entry->len,
|
||||||
__entry->orig_start,
|
|
||||||
show_map_type(__entry->block_start),
|
show_map_type(__entry->block_start),
|
||||||
__entry->block_len,
|
__entry->block_len,
|
||||||
show_map_flags(__entry->flags),
|
show_map_flags(__entry->flags),
|
||||||
|
Loading…
Reference in New Issue
Block a user