Message ID | 1480600274-13623-1-git-send-email-chandan@linux.vnet.ibm.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
On Thu, Dec 01, 2016 at 07:21:14PM +0530, Chandan Rajendra wrote: > btrfs_super_block->sys_chunk_array_size is stored as le32 data on > disk. However insert_temp_chunk_item() writes sys_chunk_array_size in > host cpu order. This commit fixes this by using super block access > helper functions to read and write > btrfs_super_block->sys_chunk_array_size field. > > Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com> Applied, thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/utils.c b/utils.c index d0189ad..74dde1e 100644 --- a/utils.c +++ b/utils.c @@ -562,14 +562,18 @@ static int insert_temp_chunk_item(int fd, struct extent_buffer *buf, */ if (type & BTRFS_BLOCK_GROUP_SYSTEM) { char *cur; + u32 array_size; - cur = (char *)sb->sys_chunk_array + sb->sys_chunk_array_size; + cur = (char *)sb->sys_chunk_array + + btrfs_super_sys_array_size(sb); memcpy(cur, &disk_key, sizeof(disk_key)); cur += sizeof(disk_key); read_extent_buffer(buf, cur, (unsigned long int)chunk, btrfs_chunk_item_size(1)); - sb->sys_chunk_array_size += btrfs_chunk_item_size(1) + + array_size = btrfs_super_sys_array_size(sb); + array_size += btrfs_chunk_item_size(1) + sizeof(disk_key); + btrfs_set_super_sys_array_size(sb, array_size); ret = write_temp_super(fd, sb, cfg->super_bytenr); }
btrfs_super_block->sys_chunk_array_size is stored as le32 data on disk. However insert_temp_chunk_item() writes sys_chunk_array_size in host cpu order. This commit fixes this by using super block access helper functions to read and write btrfs_super_block->sys_chunk_array_size field. Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com> --- utils.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)