Parameter and type changes to btrfs_inode
Subsystems (2)
David Sterba
maintainercover Parameter and type changes to btrfs_inode
Many patches but also quite short, switching struct inode to struct btrfs_node for structures and related functions in the io path, removing some indirect function calls and typedefs.
David Sterba (40):
btrfs: change how repair action is passed to btrfs_repair_one_sector
btrfs: drop parameter compression_type from
btrfs_submit_dio_repair_bio
btrfs: change how submit bio callback is passed to btrfs_wq_submit_bio
btrfs: simplify btree_submit_bio_start and btrfs_submit_bio_start
parameters
btrfs: switch async_submit_bio::inode to btrfs_inode
btrfs: pass btrfs_inode to btrfs_submit_bio_start
btrfs: pass btrfs_inode to btrfs_submit_bio_start_direct_io
btrfs: pass btrfs_inode to btrfs_wq_submit_bio
btrfs: pass btrfs_inode to btrfs_submit_metadata_bio
btrfs: pass btrfs_inode to btrfs_submit_data_write_bio
btrfs: pass btrfs_inode to btrfs_submit_data_read_bio
btrfs: pass btrfs_inode to btrfs_submit_dio_repair_bio
btrfs: pass btrfs_inode to submit_one_bio
btrfs: pass btrfs_inode to btrfs_repair_one_sector
btrfs: switch btrfs_dio_private::inode to btrfs_inode
btrfs: pass btrfs_inode to btrfs_submit_dio_bio
btrfs: pass btrfs_inode to btrfs_truncate
btrfs: pass btrfs_inode to btrfs_inode_lock
btrfs: pass btrfs_inode to btrfs_inode_unlock
btrfs: pass btrfs_inode to btrfs_dirty_inode
btrfs: pass btrfs_inode to btrfs_add_delalloc_inodes
btrfs: switch btrfs_writepage_fixup::inode to btrfs_inode
btrfs: pass btrfs_inode to btrfs_check_data_csum
btrfs: pass btrfs_inode to __unlink_start_trans
btrfs: pass btrfs_inode to btrfs_delete_subvolume
btrfs: drop private_data parameter from extent_io_tree_init
btrfs: switch extent_io_tree::private_data to btrfs_inode and rename
btrfs: pass btrfs_inode to btrfs_merge_delalloc_extent
btrfs: pass btrfs_inode to btrfs_set_delalloc_extent
btrfs: pass btrfs_inode to btrfs_split_delalloc_extent
btrfs: pass btrfs_inode to btrfs_clear_delalloc_extent
btrfs: pass btrfs_inode to btrfs_unlink_subvol
btrfs: pass btrfs_inode to btrfs_inode_by_name
btrfs: pass btrfs_inode to fixup_tree_root_location
btrfs: pass btrfs_inode to inode_tree_add
btrfs: pass btrfs_inode to btrfs_inherit_iflags
btrfs: switch async_chunk::inode to btrfs_inode
btrfs: use btrfs_inode inside compress_file_range
btrfs: use btrfs_inode inside btrfs_verify_data_csum
btrfs: pass btrfs_inode to btrfs_add_delayed_iput
fs/btrfs/btrfs_inode.h | 29 +- fs/btrfs/compression.c | 6 +- fs/btrfs/defrag.c | 12 +- fs/btrfs/delayed-inode.c | 4 +- fs/btrfs/disk-io.c | 52 ++-- fs/btrfs/disk-io.h | 15 +- fs/btrfs/extent-io-tree.c | 35 ++- fs/btrfs/extent-io-tree.h | 6 +- fs/btrfs/extent_io.c | 35 +-- fs/btrfs/extent_io.h | 11 +- fs/btrfs/file.c | 48 ++-- fs/btrfs/free-space-cache.c | 4 +- fs/btrfs/inode.c | 445 +++++++++++++++---------------- fs/btrfs/ioctl.c | 10 +- fs/btrfs/ordered-data.c | 2 +- fs/btrfs/reflink.c | 4 +- fs/btrfs/relocation.c | 11 +- fs/btrfs/tests/btrfs-tests.c | 2 +- fs/btrfs/tests/extent-io-tests.c | 4 +- fs/btrfs/transaction.c | 4 +- fs/btrfs/tree-log.c | 24 +- fs/btrfs/volumes.c | 3 +- include/trace/events/btrfs.h | 27 +- 23 files changed, 393 insertions(+), 400 deletions(-)
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 1/40 btrfs: change how repair action is passed to btrfs_repair_one_sector
There's a function pointer passed to btrfs_repair_one_sector that will submit the right bio for repair. However there are only two callbacks, for buffered and for direct IO. This can be simplified to a bool-based switch and call either function, indirect calls in this case is an unnecessary abstraction. This allows to remove the submit_bio_hook_t typedef.
--- fs/btrfs/btrfs_inode.h | 3 +++ fs/btrfs/compression.c | 2 +- fs/btrfs/extent_io.c | 14 +++++++++----- fs/btrfs/extent_io.h | 6 +----- fs/btrfs/inode.c | 9 ++++----- 5 files changed, 18 insertions(+), 16 deletions(-)
fs/btrfs/btrfs_inode.h +3 -0
@@ -414,6 +414,9 @@ static inline void btrfs_inode_split_flags(u64 inode_item_flags,void btrfs_submit_data_write_bio (struct inode *inode,struct bio *bio,int mirror_num);void btrfs_submit_data_read_bio (struct inode *inode,struct bio *bio,int mirror_num,enum btrfs_compression_type compress_type); +void btrfs_submit_dio_repair_bio (struct inode *inode,struct bio *bio, +int mirror_num, +enum btrfs_compression_type compress_type);int btrfs_check_sector_csum (struct btrfs_fs_info *fs_info,struct page *page,u32 pgoff,u8 *csum,const u8 *const csum_expected); int btrfs_check_data_csum(struct inode *inode, struct btrfs_bio *bbio,
fs/btrfs/compression.c +1 -1
@@ -196,7 +196,7 @@ static void end_compressed_bio_read(struct btrfs_bio *bbio)refcount_inc (&cb->pending_ios); ret =btrfs_repair_one_sector (inode, bbio, offset, bv.bv_page, bv.bv_offset, - btrfs_submit_data_read_bio); + true);if (ret) {refcount_dec (&cb->pending_ios); status =errno_to_blk_status (ret);
fs/btrfs/extent_io.c +9 -5
@@ -797,7 +797,7 @@ static struct io_failure_record *btrfs_get_io_failure_record(struct inode *inodeint btrfs_repair_one_sector (struct inode *inode,struct btrfs_bio *failed_bbio,u32 bio_offset,struct page *page,unsigned int pgoff, -submit_bio_hook_t *submit_bio_hook) +bool submit_buffered) {u64 start = failed_bbio->file_offset + bio_offset;struct io_failure_record *failrec;
@@ -856,11 +856,15 @@ int btrfs_repair_one_sector(struct inode *inode, struct btrfs_bio *failed_bbio, failrec->this_mirror);/* -* At this point we have a bio, so any errors from submit_bio_hook() -* will be handled by the endio on the repair_bio, so we can't return an +* At this point we have a bio, so any errors from bio submission will +* be handled by the endio on the repair_bio, so we can't return an * error here. */ -submit_bio_hook (inode, repair_bio, failrec->this_mirror,0 ); +if (submit_buffered) +btrfs_submit_data_read_bio (inode, repair_bio, failrec->this_mirror,0 ); +else +btrfs_submit_dio_repair_bio (inode, repair_bio, failrec->this_mirror,0 ); +return BLK_STS_OK ; }
@@ -951,7 +955,7 @@ static void submit_data_read_repair(struct inode *inode, ret =btrfs_repair_one_sector (inode, failed_bbio, bio_offset + offset, page, pgoff + offset, - btrfs_submit_data_read_bio); + true);if (!ret) {/* * We have submitted the read repair, the page release
fs/btrfs/extent_io.h +1 -5
@@ -70,10 +70,6 @@ struct extent_io_tree;int __init extent_buffer_init_cachep (void );void __cold extent_buffer_free_cachep (void ); -typedef void (submit_bio_hook_t )(struct inode *inode,struct bio *bio, -int mirror_num, -enum btrfs_compression_type compress_type); -typedef blk_status_t (extent_submit_bio_start_t )(struct inode *inode,struct bio *bio,u64 dio_file_offset);
@@ -277,7 +273,7 @@ struct io_failure_record {int btrfs_repair_one_sector (struct inode *inode,struct btrfs_bio *failed_bbio,u32 bio_offset,struct page *page,unsigned int pgoff, -submit_bio_hook_t *submit_bio_hook); +bool submit_buffered);void btrfs_free_io_failure_record (struct btrfs_inode *inode,u64 start,u64 end);int btrfs_clean_io_failure (struct btrfs_inode *inode,u64 start,struct page *page,unsigned int pg_offset);
fs/btrfs/inode.c +4 -5
@@ -7922,9 +7922,9 @@ static void btrfs_dio_private_put(struct btrfs_dio_private *dip)bio_endio (&dip->bio); } -static void submit_dio_repair_bio (struct inode *inode,struct bio *bio, -int mirror_num, -enum btrfs_compression_type compress_type) +void btrfs_submit_dio_repair_bio (struct inode *inode,struct bio *bio, +int mirror_num, +enum btrfs_compression_type compress_type) {struct btrfs_dio_private *dip =btrfs_bio (bio)->private;struct btrfs_fs_info *fs_info =btrfs_sb (inode->i_sb);
@@ -7959,8 +7959,7 @@ static blk_status_t btrfs_check_read_dio_bio(struct btrfs_dio_private *dip,int ret; ret =btrfs_repair_one_sector (inode, bbio, offset, - bv.bv_page, bv.bv_offset, - submit_dio_repair_bio); + bv.bv_page, bv.bv_offset, false);if (ret) err =errno_to_blk_status (ret); }
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 2/40 btrfs: drop parameter compression_type from btrfs_submit_dio_repair_bio
In reply to David SterbaCompression and direct io don't work together so the compression parameter can be dropped after previous patch that changed the call to direct.
--- fs/btrfs/btrfs_inode.h | 4 +--- fs/btrfs/extent_io.c | 2 +- fs/btrfs/inode.c | 4 +--- 3 files changed, 3 insertions(+), 7 deletions(-)
fs/btrfs/btrfs_inode.h +1 -3
@@ -414,9 +414,7 @@ static inline void btrfs_inode_split_flags(u64 inode_item_flags,void btrfs_submit_data_write_bio (struct inode *inode,struct bio *bio,int mirror_num);void btrfs_submit_data_read_bio (struct inode *inode,struct bio *bio,int mirror_num,enum btrfs_compression_type compress_type); -void btrfs_submit_dio_repair_bio (struct inode *inode,struct bio *bio, -int mirror_num, -enum btrfs_compression_type compress_type); +void btrfs_submit_dio_repair_bio (struct inode *inode,struct bio *bio,int mirror_num);int btrfs_check_sector_csum (struct btrfs_fs_info *fs_info,struct page *page,u32 pgoff,u8 *csum,const u8 *const csum_expected); int btrfs_check_data_csum(struct inode *inode, struct btrfs_bio *bbio,
fs/btrfs/extent_io.c +1 -1
@@ -863,7 +863,7 @@ int btrfs_repair_one_sector(struct inode *inode, struct btrfs_bio *failed_bbio,if (submit_buffered)btrfs_submit_data_read_bio (inode, repair_bio, failrec->this_mirror,0 );else -btrfs_submit_dio_repair_bio (inode, repair_bio, failrec->this_mirror,0 ); +btrfs_submit_dio_repair_bio (inode, repair_bio, failrec->this_mirror);return BLK_STS_OK ; }
fs/btrfs/inode.c +1 -3
@@ -7922,9 +7922,7 @@ static void btrfs_dio_private_put(struct btrfs_dio_private *dip)bio_endio (&dip->bio); } -void btrfs_submit_dio_repair_bio (struct inode *inode,struct bio *bio, -int mirror_num, -enum btrfs_compression_type compress_type) +void btrfs_submit_dio_repair_bio (struct inode *inode,struct bio *bio,int mirror_num) {struct btrfs_dio_private *dip =btrfs_bio (bio)->private;struct btrfs_fs_info *fs_info =btrfs_sb (inode->i_sb);
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 3/40 btrfs: change how submit bio callback is passed to btrfs_wq_submit_bio
In reply to David SterbaThere's a callback function parameter for btrfs_wq_submit_bio that can be one of: metadata, buffered data, direct io data. The callback abstraction is unnecessary as we have all functions available.
Replace the parameter with a command that leads to a direct call in run_one_async_start. The called functions can be then simplified and we can also remove the extent_submit_bio_start_t typedef.
--- fs/btrfs/btrfs_inode.h | 5 +++++ fs/btrfs/disk-io.c | 33 +++++++++++++++++++++++---------- fs/btrfs/disk-io.h | 12 ++++++++++-- fs/btrfs/extent_io.h | 3 --- fs/btrfs/inode.c | 15 +++++++-------- 5 files changed, 45 insertions(+), 23 deletions(-)
fs/btrfs/btrfs_inode.h +5 -0
@@ -415,6 +415,11 @@ void btrfs_submit_data_write_bio(struct inode *inode, struct bio *bio, int mirrovoid btrfs_submit_data_read_bio (struct inode *inode,struct bio *bio,int mirror_num,enum btrfs_compression_type compress_type);void btrfs_submit_dio_repair_bio (struct inode *inode,struct bio *bio,int mirror_num); +blk_status_t btrfs_submit_bio_start (struct inode *inode,struct bio *bio, +u64 dio_file_offset); +blk_status_t btrfs_submit_bio_start_direct_io (struct inode *inode, +struct bio *bio, +u64 dio_file_offset);int btrfs_check_sector_csum (struct btrfs_fs_info *fs_info,struct page *page,u32 pgoff,u8 *csum,const u8 *const csum_expected); int btrfs_check_data_csum(struct inode *inode, struct btrfs_bio *bbio,
fs/btrfs/disk-io.c +23 -10
@@ -86,10 +86,10 @@ static void btrfs_free_csum_hash(struct btrfs_fs_info *fs_info)struct async_submit_bio {struct inode *inode;struct bio *bio; -extent_submit_bio_start_t *submit_bio_start; +enum btrfs_wq_submit_cmd submit_cmd;int mirror_num; -/* Optional parameter for submit_bio_start used by direct io */ +/* Optional parameter for used by direct io */ u64 dio_file_offset;struct btrfs_work work;blk_status_t status;
@@ -637,8 +637,22 @@ static void run_one_async_start(struct btrfs_work *work)blk_status_t ret; async = container_of(work, struct async_submit_bio, work); - ret = async->submit_bio_start (async->inode, async->bio, - async->dio_file_offset); +switch (async->submit_cmd) { +case WQ_SUBMIT_METADATA : + ret =btree_submit_bio_start (async->inode, async->bio, + async->dio_file_offset); +break ; +case WQ_SUBMIT_DATA : + ret =btrfs_submit_bio_start (async->inode, async->bio, + async->dio_file_offset); + +break ; +case WQ_SUBMIT_DATA_DIO : + ret =btrfs_submit_bio_start_direct_io (async->inode, async->bio, + async->dio_file_offset); + +break ; + }if (ret) async->status = ret; }
@@ -689,8 +703,7 @@ static void run_one_async_free(struct btrfs_work *work)* - false in case of error */ bool btrfs_wq_submit_bio (struct inode *inode,struct bio *bio,int mirror_num, -u64 dio_file_offset, -extent_submit_bio_start_t *submit_bio_start) +u64 dio_file_offset,enum btrfs_wq_submit_cmd cmd) {struct btrfs_fs_info *fs_info =BTRFS_I (inode)->root->fs_info;struct async_submit_bio *async;
@@ -702,7 +715,7 @@ bool btrfs_wq_submit_bio(struct inode *inode, struct bio *bio, int mirror_num, async->inode = inode; async->bio = bio; async->mirror_num = mirror_num; - async->submit_bio_start = submit_bio_start; + async->submit_cmd = cmd;btrfs_init_work (&async->work, run_one_async_start, run_one_async_done, run_one_async_free);
@@ -736,8 +749,8 @@ static blk_status_t btree_csum_one_bio(struct bio *bio)return errno_to_blk_status (ret); } -static blk_status_t btree_submit_bio_start (struct inode *inode,struct bio *bio, -u64 dio_file_offset) +blk_status_t btree_submit_bio_start (struct inode *inode,struct bio *bio, +u64 dio_file_offset) {/* * when we're called for a write, we're already in the async
@@ -776,7 +789,7 @@ void btrfs_submit_metadata_bio(struct inode *inode, struct bio *bio, int mirror_* happen in parallel across all CPUs. */ if (should_async_write (fs_info,BTRFS_I (inode)) && -btrfs_wq_submit_bio (inode, bio, mirror_num,0 , btree_submit_bio_start)) +btrfs_wq_submit_bio (inode, bio, mirror_num,0 ,WQ_SUBMIT_METADATA ))return ; ret =btree_csum_one_bio (bio);
fs/btrfs/disk-io.h +10 -2
@@ -113,9 +113,17 @@ int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid, int atomic);int btrfs_read_extent_buffer (struct extent_buffer *buf,u64 parent_transid,int level,struct btrfs_key *first_key); + +enum btrfs_wq_submit_cmd { +WQ_SUBMIT_METADATA , +WQ_SUBMIT_DATA , +WQ_SUBMIT_DATA_DIO , +}; +bool btrfs_wq_submit_bio (struct inode *inode,struct bio *bio,int mirror_num, -u64 dio_file_offset, -extent_submit_bio_start_t *submit_bio_start); +u64 dio_file_offset,enum btrfs_wq_submit_cmd cmd); +blk_status_t btree_submit_bio_start (struct inode *inode,struct bio *bio, +u64 dio_file_offset);int btrfs_alloc_log_tree_node (struct btrfs_trans_handle *trans,struct btrfs_root *root); int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans,
fs/btrfs/extent_io.h +0 -3
@@ -70,9 +70,6 @@ struct extent_io_tree;int __init extent_buffer_init_cachep (void );void __cold extent_buffer_free_cachep (void ); -typedef blk_status_t (extent_submit_bio_start_t )(struct inode *inode, -struct bio *bio,u64 dio_file_offset); -#define INLINE_EXTENT_BUFFER_PAGES (BTRFS_MAX_METADATA_BLOCKSIZE / PAGE_SIZE)struct extent_buffer {u64 start;
fs/btrfs/inode.c +7 -8
@@ -2550,8 +2550,8 @@ void btrfs_clear_delalloc_extent(struct inode *vfs_inode,* At IO completion time the cums attached on the ordered extent record * are inserted into the btree */ -static blk_status_t btrfs_submit_bio_start (struct inode *inode,struct bio *bio, -u64 dio_file_offset) +blk_status_t btrfs_submit_bio_start (struct inode *inode,struct bio *bio, +u64 dio_file_offset) {return btrfs_csum_one_bio (BTRFS_I (inode), bio, (u64)-1 , false); }
@@ -2758,8 +2758,7 @@ void btrfs_submit_data_write_bio(struct inode *inode, struct bio *bio, int mirro !test_bit(BTRFS_FS_STATE_NO_CSUMS, &fs_info->fs_state) && !btrfs_is_data_reloc_root(bi->root)) {if (!atomic_read (&bi->sync_writers) && -btrfs_wq_submit_bio (inode, bio, mirror_num,0 , - btrfs_submit_bio_start)) +btrfs_wq_submit_bio (inode, bio, mirror_num,0 ,WQ_SUBMIT_DATA ))return ; ret =btrfs_csum_one_bio (bi, bio, (u64)-1 , false);
@@ -7966,9 +7965,9 @@ static blk_status_t btrfs_check_read_dio_bio(struct btrfs_dio_private *dip,return err; } -static blk_status_t btrfs_submit_bio_start_direct_io (struct inode *inode, -struct bio *bio, -u64 dio_file_offset) +blk_status_t btrfs_submit_bio_start_direct_io (struct inode *inode, +struct bio *bio, +u64 dio_file_offset) {return btrfs_csum_one_bio (BTRFS_I (inode), bio, dio_file_offset, false); }
@@ -8016,7 +8015,7 @@ static void btrfs_submit_dio_bio(struct bio *bio, struct inode *inode,/* Check btrfs_submit_data_write_bio() for async submit rules */ if (async_submit && !atomic_read (&BTRFS_I (inode)->sync_writers) &&btrfs_wq_submit_bio (inode, bio,0 , file_offset, - btrfs_submit_bio_start_direct_io)) +WQ_SUBMIT_DATA_DIO ))return ;/*
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 4/40 btrfs: simplify btree_submit_bio_start and btrfs_submit_bio_start parameters
In reply to David SterbaAfter previous patches the unused parameters can be removed from btree_submit_bio_start and btrfs_submit_bio_start as they don't need to conform to the extent_submit_bio_start_t typedef.
--- fs/btrfs/btrfs_inode.h | 3 +-- fs/btrfs/disk-io.c | 11 +++-------- fs/btrfs/disk-io.h | 3 +-- fs/btrfs/inode.c | 3 +-- 4 files changed, 6 insertions(+), 14 deletions(-)
fs/btrfs/btrfs_inode.h +1 -2
@@ -415,8 +415,7 @@ void btrfs_submit_data_write_bio(struct inode *inode, struct bio *bio, int mirrovoid btrfs_submit_data_read_bio (struct inode *inode,struct bio *bio,int mirror_num,enum btrfs_compression_type compress_type);void btrfs_submit_dio_repair_bio (struct inode *inode,struct bio *bio,int mirror_num); -blk_status_t btrfs_submit_bio_start (struct inode *inode,struct bio *bio, -u64 dio_file_offset); +blk_status_t btrfs_submit_bio_start (struct inode *inode,struct bio *bio);blk_status_t btrfs_submit_bio_start_direct_io (struct inode *inode,struct bio *bio,u64 dio_file_offset);
fs/btrfs/disk-io.c +3 -8
@@ -639,18 +639,14 @@ static void run_one_async_start(struct btrfs_work *work) async = container_of(work, struct async_submit_bio, work);switch (async->submit_cmd) {case WQ_SUBMIT_METADATA : - ret =btree_submit_bio_start (async->inode, async->bio, - async->dio_file_offset); + ret =btree_submit_bio_start (async->bio);break ;case WQ_SUBMIT_DATA : - ret =btrfs_submit_bio_start (async->inode, async->bio, - async->dio_file_offset); - + ret =btrfs_submit_bio_start (async->inode, async->bio);break ;case WQ_SUBMIT_DATA_DIO : ret =btrfs_submit_bio_start_direct_io (async->inode, async->bio, async->dio_file_offset); -break ; }if (ret)
@@ -749,8 +745,7 @@ static blk_status_t btree_csum_one_bio(struct bio *bio)return errno_to_blk_status (ret); } -blk_status_t btree_submit_bio_start (struct inode *inode,struct bio *bio, -u64 dio_file_offset) +blk_status_t btree_submit_bio_start (struct bio *bio) {/* * when we're called for a write, we're already in the async
fs/btrfs/disk-io.h +1 -2
@@ -122,8 +122,7 @@ enum btrfs_wq_submit_cmd {bool btrfs_wq_submit_bio (struct inode *inode,struct bio *bio,int mirror_num,u64 dio_file_offset,enum btrfs_wq_submit_cmd cmd); -blk_status_t btree_submit_bio_start (struct inode *inode,struct bio *bio, -u64 dio_file_offset); +blk_status_t btree_submit_bio_start (struct bio *bio);int btrfs_alloc_log_tree_node (struct btrfs_trans_handle *trans,struct btrfs_root *root); int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans,
fs/btrfs/inode.c +1 -2
@@ -2550,8 +2550,7 @@ void btrfs_clear_delalloc_extent(struct inode *vfs_inode,* At IO completion time the cums attached on the ordered extent record * are inserted into the btree */ -blk_status_t btrfs_submit_bio_start (struct inode *inode,struct bio *bio, -u64 dio_file_offset) +blk_status_t btrfs_submit_bio_start (struct inode *inode,struct bio *bio); {return btrfs_csum_one_bio (BTRFS_I (inode), bio, (u64)-1 , false); }
Signature · 1 line
2.37.3
Re: [PATCH 04/40] btrfs: simplify btree_submit_bio_start and btrfs_submit_bio_start parameters
Quoted 8 lines
fs/btrfs/inode.c +0
-0
fs/btrfs/inode.c void btrfs_clear_delalloc_extent(struct inode *vfs_inode, · line 2554
Quoted 7 lines
fs/btrfs/inode.c +1
-2@@ -2550,8 +2550,7 @@ void btrfs_clear_delalloc_extent(struct inode *vfs_inode,* At IO completion time the cums attached on the ordered extent record * are inserted into the btree */ -blk_status_t btrfs_submit_bio_start (struct inode *inode,struct bio *bio, -u64 dio_file_offset) +blk_status_t btrfs_submit_bio_start (struct inode *inode,struct bio *bio);
Remove the semicolon at the end of the function declaration.
Quoted 3 lines
fs/btrfs/inode.c +0
-0{return btrfs_csum_one_bio (BTRFS_I (inode), bio, (u64)-1 , false);}
Re: [PATCH 04/40] btrfs: simplify btree_submit_bio_start and btrfs_submit_bio_start parameters
Quoted 11 lines · Anand Jain
Quoted 10 lines
fs/btrfs/inode.c +0
-2@@ -2550,8 +2550,7 @@ void btrfs_clear_delalloc_extent(struct inode *vfs_inode,* At IO completion time the cums attached on the ordered extent record * are inserted into the btree */ -blk_status_t btrfs_submit_bio_start (struct inode *inode,struct bio *bio, -u64 dio_file_offset)
Quoted 2 lines
fs/btrfs/inode.c void btrfs_clear_delalloc_extent(struct inode *vfs_inode, · line 2553
Quoted 1 line
fs/btrfs/inode.c +1
-0+blk_status_t btrfs_submit_bio_start (struct inode *inode,struct bio *bio);Remove the semicolon at the end of the function declaration.
Right, thanks. It gets removed in the next patch so the whole series compiles, I don't think it needs to be resent.
Re: [PATCH 04/40] btrfs: simplify btree_submit_bio_start and btrfs_submit_bio_start parameters
Quoted 12 lines · David Sterba
Quoted 11 lines · Anand Jain
Quoted 10 lines
fs/btrfs/inode.c +0
-2@@ -2550,8 +2550,7 @@ void btrfs_clear_delalloc_extent(struct inode *vfs_inode,* At IO completion time the cums attached on the ordered extent record * are inserted into the btree */ -blk_status_t btrfs_submit_bio_start (struct inode *inode,struct bio *bio, -u64 dio_file_offset)
Quoted 8 lines
Quoted 2 lines
fs/btrfs/inode.c void btrfs_clear_delalloc_extent(struct inode *vfs_inode, · line 2553
Quoted 1 line
fs/btrfs/inode.c +1
-0+blk_status_t btrfs_submit_bio_start (struct inode *inode,struct bio *bio);Remove the semicolon at the end of the function declaration.
Right, thanks. It gets removed in the next patch so the whole series compiles,
I don't think it needs to be resent.
Yes, of course, no resend is required. I am fine.
David Sterba
maintainerPATCH 5/40 btrfs: switch async_submit_bio::inode to btrfs_inode
In reply to David SterbaThe async bio submit is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/disk-io.c | 14 +++++++------- fs/btrfs/inode.c | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-)
fs/btrfs/disk-io.c +7 -7
@@ -84,7 +84,7 @@ static void btrfs_free_csum_hash(struct btrfs_fs_info *fs_info)* just before they are sent down the IO stack. */ struct async_submit_bio { -struct inode *inode; +struct btrfs_inode *inode;struct bio *bio;enum btrfs_wq_submit_cmd submit_cmd;int mirror_num;
@@ -642,11 +642,11 @@ static void run_one_async_start(struct btrfs_work *work) ret =btree_submit_bio_start (async->bio);break ;case WQ_SUBMIT_DATA : - ret =btrfs_submit_bio_start (async->inode, async->bio); + ret =btrfs_submit_bio_start (&async->inode->vfs_inode, async->bio);break ;case WQ_SUBMIT_DATA_DIO : - ret =btrfs_submit_bio_start_direct_io (async->inode, async->bio, - async->dio_file_offset); + ret =btrfs_submit_bio_start_direct_io (&async->inode->vfs_inode, + async->bio, async->dio_file_offset);break ; }if (ret)
@@ -665,7 +665,7 @@ static void run_one_async_done(struct btrfs_work *work) {struct async_submit_bio *async = container_of(work, struct async_submit_bio, work); -struct inode *inode = async->inode; +struct btrfs_inode *inode = async->inode;struct btrfs_bio *bbio =btrfs_bio (async->bio);/* If an error occurred we just want to clean up the bio and move on */
@@ -680,7 +680,7 @@ static void run_one_async_done(struct btrfs_work *work)* This changes nothing when cgroups aren't in use. */ async->bio->bi_opf |=REQ_CGROUP_PUNT ; -btrfs_submit_bio (btrfs_sb (inode->i_sb), async->bio, async->mirror_num); +btrfs_submit_bio (inode->root->fs_info, async->bio, async->mirror_num); }static void run_one_async_free (struct btrfs_work *work)
@@ -708,7 +708,7 @@ bool btrfs_wq_submit_bio(struct inode *inode, struct bio *bio, int mirror_num,if (!async)return false; - async->inode = inode; + async->inode =BTRFS_I (inode); async->bio = bio; async->mirror_num = mirror_num; async->submit_cmd = cmd;
fs/btrfs/inode.c +1 -1
@@ -2550,7 +2550,7 @@ void btrfs_clear_delalloc_extent(struct inode *vfs_inode,* At IO completion time the cums attached on the ordered extent record * are inserted into the btree */ -blk_status_t btrfs_submit_bio_start (struct inode *inode,struct bio *bio); +blk_status_t btrfs_submit_bio_start (struct inode *inode,struct bio *bio) {return btrfs_csum_one_bio (BTRFS_I (inode), bio, (u64)-1 , false); }
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 6/40 btrfs: pass btrfs_inode to btrfs_submit_bio_start
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/btrfs_inode.h | 2 +- fs/btrfs/disk-io.c | 2 +- fs/btrfs/inode.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
fs/btrfs/btrfs_inode.h +1 -1
@@ -415,7 +415,7 @@ void btrfs_submit_data_write_bio(struct inode *inode, struct bio *bio, int mirrovoid btrfs_submit_data_read_bio (struct inode *inode,struct bio *bio,int mirror_num,enum btrfs_compression_type compress_type);void btrfs_submit_dio_repair_bio (struct inode *inode,struct bio *bio,int mirror_num); -blk_status_t btrfs_submit_bio_start (struct inode *inode,struct bio *bio); +blk_status_t btrfs_submit_bio_start (struct btrfs_inode *inode,struct bio *bio);blk_status_t btrfs_submit_bio_start_direct_io (struct inode *inode,struct bio *bio,u64 dio_file_offset);
fs/btrfs/disk-io.c +1 -1
@@ -642,7 +642,7 @@ static void run_one_async_start(struct btrfs_work *work) ret =btree_submit_bio_start (async->bio);break ;case WQ_SUBMIT_DATA : - ret =btrfs_submit_bio_start (&async->inode->vfs_inode, async->bio); + ret =btrfs_submit_bio_start (async->inode, async->bio);break ;case WQ_SUBMIT_DATA_DIO : ret = btrfs_submit_bio_start_direct_io(&async->inode->vfs_inode,
fs/btrfs/inode.c +2 -2
@@ -2550,9 +2550,9 @@ void btrfs_clear_delalloc_extent(struct inode *vfs_inode,* At IO completion time the cums attached on the ordered extent record * are inserted into the btree */ -blk_status_t btrfs_submit_bio_start (struct inode *inode,struct bio *bio) +blk_status_t btrfs_submit_bio_start (struct btrfs_inode *inode,struct bio *bio) { -return btrfs_csum_one_bio (BTRFS_I (inode), bio, (u64)-1 , false); +return btrfs_csum_one_bio (inode, bio, (u64)-1 , false); }/*
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 7/40 btrfs: pass btrfs_inode to btrfs_submit_bio_start_direct_io
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/btrfs_inode.h | 2 +- fs/btrfs/disk-io.c | 2 +- fs/btrfs/inode.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
fs/btrfs/btrfs_inode.h +1 -1
@@ -416,7 +416,7 @@ void btrfs_submit_data_read_bio(struct inode *inode, struct bio *bio, int mirror_num, enum btrfs_compression_type compress_type);void btrfs_submit_dio_repair_bio (struct inode *inode,struct bio *bio,int mirror_num);blk_status_t btrfs_submit_bio_start (struct btrfs_inode *inode,struct bio *bio); -blk_status_t btrfs_submit_bio_start_direct_io (struct inode *inode, +blk_status_t btrfs_submit_bio_start_direct_io (struct btrfs_inode *inode,struct bio *bio,u64 dio_file_offset); int btrfs_check_sector_csum(struct btrfs_fs_info *fs_info, struct page *page,
fs/btrfs/disk-io.c +1 -1
@@ -645,7 +645,7 @@ static void run_one_async_start(struct btrfs_work *work) ret =btrfs_submit_bio_start (async->inode, async->bio);break ;case WQ_SUBMIT_DATA_DIO : - ret =btrfs_submit_bio_start_direct_io (&async->inode->vfs_inode, + ret =btrfs_submit_bio_start_direct_io (async->inode, async->bio, async->dio_file_offset);break ; }
fs/btrfs/inode.c +2 -2
@@ -7964,11 +7964,11 @@ static blk_status_t btrfs_check_read_dio_bio(struct btrfs_dio_private *dip,return err; } -blk_status_t btrfs_submit_bio_start_direct_io (struct inode *inode, +blk_status_t btrfs_submit_bio_start_direct_io (struct btrfs_inode *inode,struct bio *bio,u64 dio_file_offset) { -return btrfs_csum_one_bio (BTRFS_I (inode), bio, dio_file_offset, false); +return btrfs_csum_one_bio (inode, bio, dio_file_offset, false); }static void btrfs_end_dio_bio (struct btrfs_bio *bbio)
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 8/40 btrfs: pass btrfs_inode to btrfs_wq_submit_bio
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/disk-io.c | 8 ++++---- fs/btrfs/disk-io.h | 2 +- fs/btrfs/inode.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-)
fs/btrfs/disk-io.c +4 -4
@@ -698,17 +698,17 @@ static void run_one_async_free(struct btrfs_work *work)* - true if the work has been succesfuly submitted * - false in case of error */ -bool btrfs_wq_submit_bio (struct inode *inode,struct bio *bio,int mirror_num, +bool btrfs_wq_submit_bio (struct btrfs_inode *inode,struct bio *bio,int mirror_num,u64 dio_file_offset,enum btrfs_wq_submit_cmd cmd) { -struct btrfs_fs_info *fs_info =BTRFS_I (inode)->root->fs_info; +struct btrfs_fs_info *fs_info = inode->root->fs_info;struct async_submit_bio *async; async =kmalloc (sizeof (*async),GFP_NOFS );if (!async)return false; - async->inode =BTRFS_I (inode); + async->inode = inode; async->bio = bio; async->mirror_num = mirror_num; async->submit_cmd = cmd;
@@ -784,7 +784,7 @@ void btrfs_submit_metadata_bio(struct inode *inode, struct bio *bio, int mirror_* happen in parallel across all CPUs. */ if (should_async_write (fs_info,BTRFS_I (inode)) && -btrfs_wq_submit_bio (inode, bio, mirror_num,0 ,WQ_SUBMIT_METADATA )) +btrfs_wq_submit_bio (BTRFS_I (inode), bio, mirror_num,0 ,WQ_SUBMIT_METADATA ))return ; ret =btree_csum_one_bio (bio);
fs/btrfs/disk-io.h +1 -1
@@ -120,7 +120,7 @@ enum btrfs_wq_submit_cmd { WQ_SUBMIT_DATA_DIO, }; -bool btrfs_wq_submit_bio (struct inode *inode,struct bio *bio,int mirror_num, +bool btrfs_wq_submit_bio (struct btrfs_inode *inode,struct bio *bio,int mirror_num,u64 dio_file_offset,enum btrfs_wq_submit_cmd cmd);blk_status_t btree_submit_bio_start (struct bio *bio); int btrfs_alloc_log_tree_node(struct btrfs_trans_handle *trans,
fs/btrfs/inode.c +2 -2
@@ -2757,7 +2757,7 @@ void btrfs_submit_data_write_bio(struct inode *inode, struct bio *bio, int mirro !test_bit(BTRFS_FS_STATE_NO_CSUMS, &fs_info->fs_state) && !btrfs_is_data_reloc_root(bi->root)) {if (!atomic_read (&bi->sync_writers) && -btrfs_wq_submit_bio (inode, bio, mirror_num,0 ,WQ_SUBMIT_DATA )) +btrfs_wq_submit_bio (bi, bio, mirror_num,0 ,WQ_SUBMIT_DATA ))return ; ret =btrfs_csum_one_bio (bi, bio, (u64)-1 , false);
@@ -8013,7 +8013,7 @@ static void btrfs_submit_dio_bio(struct bio *bio, struct inode *inode,if (btrfs_op (bio) ==BTRFS_MAP_WRITE ) {/* Check btrfs_submit_data_write_bio() for async submit rules */ if (async_submit && !atomic_read (&BTRFS_I (inode)->sync_writers) && -btrfs_wq_submit_bio (inode, bio,0 , file_offset, +btrfs_wq_submit_bio (BTRFS_I (inode), bio,0 , file_offset,WQ_SUBMIT_DATA_DIO ))return ;
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 9/40 btrfs: pass btrfs_inode to btrfs_submit_metadata_bio
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/disk-io.c | 8 ++++---- fs/btrfs/disk-io.h | 2 +- fs/btrfs/extent_io.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-)
fs/btrfs/disk-io.c +4 -4
@@ -766,9 +766,9 @@ static bool should_async_write(struct btrfs_fs_info *fs_info,return true; } -void btrfs_submit_metadata_bio (struct inode *inode,struct bio *bio,int mirror_num) +void btrfs_submit_metadata_bio (struct btrfs_inode *inode,struct bio *bio,int mirror_num) { -struct btrfs_fs_info *fs_info =btrfs_sb (inode->i_sb); +struct btrfs_fs_info *fs_info = inode->root->fs_info;struct btrfs_bio *bbio =btrfs_bio (bio);blk_status_t ret;
@@ -783,8 +783,8 @@ void btrfs_submit_metadata_bio(struct inode *inode, struct bio *bio, int mirror_* Kthread helpers are used to submit writes so that checksumming can * happen in parallel across all CPUs. */ -if (should_async_write (fs_info,BTRFS_I (inode)) && -btrfs_wq_submit_bio (BTRFS_I (inode), bio, mirror_num,0 ,WQ_SUBMIT_METADATA )) +if (should_async_write (fs_info, inode) && +btrfs_wq_submit_bio (inode, bio, mirror_num,0 ,WQ_SUBMIT_METADATA ))return ; ret =btree_csum_one_bio (bio);
fs/btrfs/disk-io.h +1 -1
@@ -86,7 +86,7 @@ void btrfs_drop_and_free_fs_root(struct btrfs_fs_info *fs_info,int btrfs_validate_metadata_buffer (struct btrfs_bio *bbio,struct page *page,u64 start,u64 end,int mirror); -void btrfs_submit_metadata_bio (struct inode *inode,struct bio *bio,int mirror_num); +void btrfs_submit_metadata_bio (struct btrfs_inode *inode,struct bio *bio,int mirror_num);#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS struct btrfs_root *btrfs_alloc_dummy_root (struct btrfs_fs_info *fs_info);#endif
fs/btrfs/extent_io.c +1 -1
@@ -134,7 +134,7 @@ static void submit_one_bio(struct btrfs_bio_ctrl *bio_ctrl)btrfs_bio (bio)->file_offset =page_offset (bv->bv_page) + bv->bv_offset;if (!is_data_inode (inode)) -btrfs_submit_metadata_bio (inode, bio, mirror_num); +btrfs_submit_metadata_bio (BTRFS_I (inode), bio, mirror_num);else if (btrfs_op (bio) ==BTRFS_MAP_WRITE )btrfs_submit_data_write_bio (inode, bio, mirror_num);else
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 10/40 btrfs: pass btrfs_inode to btrfs_submit_data_write_bio
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/btrfs_inode.h | 2 +- fs/btrfs/extent_io.c | 2 +- fs/btrfs/inode.c | 17 ++++++++--------- 3 files changed, 10 insertions(+), 11 deletions(-)
fs/btrfs/btrfs_inode.h +1 -1
@@ -411,7 +411,7 @@ static inline void btrfs_inode_split_flags(u64 inode_item_flags,#define CSUM_FMT "0x%*phN"#define CSUM_FMT_VALUE (size, bytes) size, bytes -void btrfs_submit_data_write_bio (struct inode *inode,struct bio *bio,int mirror_num); +void btrfs_submit_data_write_bio (struct btrfs_inode *inode,struct bio *bio,int mirror_num);void btrfs_submit_data_read_bio (struct inode *inode,struct bio *bio,int mirror_num,enum btrfs_compression_type compress_type);void btrfs_submit_dio_repair_bio (struct inode *inode,struct bio *bio,int mirror_num);
fs/btrfs/extent_io.c +1 -1
@@ -136,7 +136,7 @@ static void submit_one_bio(struct btrfs_bio_ctrl *bio_ctrl)if (!is_data_inode (inode))btrfs_submit_metadata_bio (BTRFS_I (inode), bio, mirror_num);else if (btrfs_op (bio) ==BTRFS_MAP_WRITE ) -btrfs_submit_data_write_bio (inode, bio, mirror_num); +btrfs_submit_data_write_bio (BTRFS_I (inode), bio, mirror_num);else btrfs_submit_data_read_bio (inode, bio, mirror_num, bio_ctrl->compress_type);
fs/btrfs/inode.c +8 -9
@@ -2730,14 +2730,13 @@ static blk_status_t extract_ordered_extent(struct btrfs_inode *inode,return errno_to_blk_status (ret); } -void btrfs_submit_data_write_bio (struct inode *inode,struct bio *bio,int mirror_num) +void btrfs_submit_data_write_bio (struct btrfs_inode *inode,struct bio *bio,int mirror_num) { -struct btrfs_fs_info *fs_info =btrfs_sb (inode->i_sb); -struct btrfs_inode *bi =BTRFS_I (inode); +struct btrfs_fs_info *fs_info = inode->root->fs_info;blk_status_t ret;if (bio_op (bio) ==REQ_OP_ZONE_APPEND ) { - ret =extract_ordered_extent (bi, bio, + ret =extract_ordered_extent (inode, bio,page_offset (bio_first_bvec_all (bio)->bv_page));if (ret) {btrfs_bio_end_io (btrfs_bio (bio), ret);
@@ -2753,14 +2752,14 @@ void btrfs_submit_data_write_bio(struct inode *inode, struct bio *bio, int mirro* Csum items for reloc roots have already been cloned at this point, * so they are handled as part of the no-checksum case. */ -if (!(bi->flags &BTRFS_INODE_NODATASUM ) && +if (!(inode->flags &BTRFS_INODE_NODATASUM ) && !test_bit (BTRFS_FS_STATE_NO_CSUMS , &fs_info->fs_state) && - !btrfs_is_data_reloc_root (bi->root)) { -if (!atomic_read (&bi->sync_writers) && -btrfs_wq_submit_bio (bi, bio, mirror_num,0 ,WQ_SUBMIT_DATA )) + !btrfs_is_data_reloc_root (inode->root)) { +if (!atomic_read (&inode->sync_writers) && +btrfs_wq_submit_bio (inode, bio, mirror_num,0 ,WQ_SUBMIT_DATA ))return ; - ret =btrfs_csum_one_bio (bi, bio, (u64)-1 , false); + ret =btrfs_csum_one_bio (inode, bio, (u64)-1 , false);if (ret) {btrfs_bio_end_io (btrfs_bio (bio), ret);return ;
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 11/40 btrfs: pass btrfs_inode to btrfs_submit_data_read_bio
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/btrfs_inode.h | 2 +- fs/btrfs/extent_io.c | 5 +++-- fs/btrfs/inode.c | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-)
fs/btrfs/btrfs_inode.h +1 -1
@@ -412,7 +412,7 @@ static inline void btrfs_inode_split_flags(u64 inode_item_flags,#define CSUM_FMT_VALUE (size, bytes) size, bytesvoid btrfs_submit_data_write_bio (struct btrfs_inode *inode,struct bio *bio,int mirror_num); -void btrfs_submit_data_read_bio (struct inode *inode,struct bio *bio, +void btrfs_submit_data_read_bio (struct btrfs_inode *inode,struct bio *bio,int mirror_num,enum btrfs_compression_type compress_type);void btrfs_submit_dio_repair_bio (struct inode *inode,struct bio *bio,int mirror_num);blk_status_t btrfs_submit_bio_start (struct btrfs_inode *inode,struct bio *bio);
fs/btrfs/extent_io.c +3 -2
@@ -138,7 +138,7 @@ static void submit_one_bio(struct btrfs_bio_ctrl *bio_ctrl)else if (btrfs_op (bio) ==BTRFS_MAP_WRITE )btrfs_submit_data_write_bio (BTRFS_I (inode), bio, mirror_num);else -btrfs_submit_data_read_bio (inode, bio, mirror_num, +btrfs_submit_data_read_bio (BTRFS_I (inode), bio, mirror_num, bio_ctrl->compress_type);/* The bio is owned by the end_io handler now */
@@ -861,7 +861,8 @@ int btrfs_repair_one_sector(struct inode *inode, struct btrfs_bio *failed_bbio,* error here. */ if (submit_buffered) -btrfs_submit_data_read_bio (inode, repair_bio, failrec->this_mirror,0 ); +btrfs_submit_data_read_bio (BTRFS_I (inode), repair_bio, + failrec->this_mirror,0 );else btrfs_submit_dio_repair_bio (inode, repair_bio, failrec->this_mirror);
fs/btrfs/inode.c +4 -4
@@ -2768,10 +2768,10 @@ void btrfs_submit_data_write_bio(struct btrfs_inode *inode, struct bio *bio, intbtrfs_submit_bio (fs_info, bio, mirror_num); } -void btrfs_submit_data_read_bio (struct inode *inode,struct bio *bio, +void btrfs_submit_data_read_bio (struct btrfs_inode *inode,struct bio *bio,int mirror_num,enum btrfs_compression_type compress_type) { -struct btrfs_fs_info *fs_info =btrfs_sb (inode->i_sb); +struct btrfs_fs_info *fs_info = inode->root->fs_info;blk_status_t ret;if (compress_type !=BTRFS_COMPRESS_NONE ) {
@@ -2779,7 +2779,7 @@ void btrfs_submit_data_read_bio(struct inode *inode, struct bio *bio,* btrfs_submit_compressed_read will handle completing the bio * if there were any errors, so just return here. */ -btrfs_submit_compressed_read (inode, bio, mirror_num); +btrfs_submit_compressed_read (&inode->vfs_inode, bio, mirror_num);return ; }
@@ -2790,7 +2790,7 @@ void btrfs_submit_data_read_bio(struct inode *inode, struct bio *bio,* Lookup bio sums does extra checks around whether we need to csum or * not, which is why we ignore skip_sum here. */ - ret =btrfs_lookup_bio_sums (inode, bio,NULL ); + ret =btrfs_lookup_bio_sums (&inode->vfs_inode, bio,NULL );if (ret) {btrfs_bio_end_io (btrfs_bio (bio), ret);return ;
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 12/40 btrfs: pass btrfs_inode to btrfs_submit_dio_repair_bio
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/btrfs_inode.h | 2 +- fs/btrfs/extent_io.c | 3 ++- fs/btrfs/inode.c | 5 ++--- 3 files changed, 5 insertions(+), 5 deletions(-)
fs/btrfs/btrfs_inode.h +1 -1
@@ -414,7 +414,7 @@ static inline void btrfs_inode_split_flags(u64 inode_item_flags,void btrfs_submit_data_write_bio (struct btrfs_inode *inode,struct bio *bio,int mirror_num);void btrfs_submit_data_read_bio (struct btrfs_inode *inode,struct bio *bio,int mirror_num,enum btrfs_compression_type compress_type); -void btrfs_submit_dio_repair_bio (struct inode *inode,struct bio *bio,int mirror_num); +void btrfs_submit_dio_repair_bio (struct btrfs_inode *inode,struct bio *bio,int mirror_num);blk_status_t btrfs_submit_bio_start (struct btrfs_inode *inode,struct bio *bio); blk_status_t btrfs_submit_bio_start_direct_io(struct btrfs_inode *inode, struct bio *bio,
fs/btrfs/extent_io.c +2 -1
@@ -864,7 +864,8 @@ int btrfs_repair_one_sector(struct inode *inode, struct btrfs_bio *failed_bbio,btrfs_submit_data_read_bio (BTRFS_I (inode), repair_bio, failrec->this_mirror,0 ); else - btrfs_submit_dio_repair_bio(inode, repair_bio, failrec->this_mirror); +btrfs_submit_dio_repair_bio (BTRFS_I (inode ),repair_bio , + failrec->this_mirror);return BLK_STS_OK ; }
fs/btrfs/inode.c +2 -3
@@ -7919,15 +7919,14 @@ static void btrfs_dio_private_put(struct btrfs_dio_private *dip)bio_endio (&dip->bio); } -void btrfs_submit_dio_repair_bio (struct inode *inode,struct bio *bio,int mirror_num) +void btrfs_submit_dio_repair_bio (struct btrfs_inode *inode,struct bio *bio,int mirror_num) {struct btrfs_dio_private *dip =btrfs_bio (bio)->private; -struct btrfs_fs_info *fs_info =btrfs_sb (inode->i_sb);BUG_ON (bio_op (bio) ==REQ_OP_WRITE );refcount_inc (&dip->refs); -btrfs_submit_bio (fs_info, bio, mirror_num); +btrfs_submit_bio (inode->root->fs_info, bio, mirror_num); } static blk_status_t btrfs_check_read_dio_bio(struct btrfs_dio_private *dip,
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 13/40 btrfs: pass btrfs_inode to submit_one_bio
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/extent_io.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
fs/btrfs/extent_io.c +6 -6
@@ -117,7 +117,7 @@ static void submit_one_bio(struct btrfs_bio_ctrl *bio_ctrl) {struct bio *bio;struct bio_vec *bv; -struct inode *inode; +struct btrfs_inode *inode;int mirror_num;if (!bio_ctrl->bio)
@@ -125,7 +125,7 @@ static void submit_one_bio(struct btrfs_bio_ctrl *bio_ctrl) bio = bio_ctrl->bio; bv =bio_first_bvec_all (bio); - inode = bv->bv_page->mapping->host; + inode =BTRFS_I (bv->bv_page->mapping->host); mirror_num = bio_ctrl->mirror_num;/* Caller should ensure the bio has at least some range added */
@@ -133,12 +133,12 @@ static void submit_one_bio(struct btrfs_bio_ctrl *bio_ctrl)btrfs_bio (bio)->file_offset =page_offset (bv->bv_page) + bv->bv_offset; -if (!is_data_inode (inode)) -btrfs_submit_metadata_bio (BTRFS_I (inode), bio, mirror_num); +if (!is_data_inode (&inode->vfs_inode)) +btrfs_submit_metadata_bio (inode, bio, mirror_num);else if (btrfs_op (bio) ==BTRFS_MAP_WRITE ) -btrfs_submit_data_write_bio (BTRFS_I (inode), bio, mirror_num); +btrfs_submit_data_write_bio (inode, bio, mirror_num);else -btrfs_submit_data_read_bio (BTRFS_I (inode), bio, mirror_num, +btrfs_submit_data_read_bio (inode, bio, mirror_num, bio_ctrl->compress_type);/* The bio is owned by the end_io handler now */
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 14/40 btrfs: pass btrfs_inode to btrfs_repair_one_sector
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/compression.c | 2 +- fs/btrfs/extent_io.c | 17 ++++++++--------- fs/btrfs/extent_io.h | 2 +- fs/btrfs/inode.c | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-)
fs/btrfs/compression.c +1 -1
@@ -194,7 +194,7 @@ static void end_compressed_bio_read(struct btrfs_bio *bbio)int ret;refcount_inc (&cb->pending_ios); - ret =btrfs_repair_one_sector (inode, bbio, offset, + ret =btrfs_repair_one_sector (BTRFS_I (inode), bbio, offset, bv.bv_page, bv.bv_offset, true);if (ret) {
fs/btrfs/extent_io.c +8 -9
@@ -795,13 +795,13 @@ static struct io_failure_record *btrfs_get_io_failure_record(struct inode *inodereturn failrec; } -int btrfs_repair_one_sector (struct inode *inode,struct btrfs_bio *failed_bbio, +int btrfs_repair_one_sector (struct btrfs_inode *inode,struct btrfs_bio *failed_bbio,u32 bio_offset,struct page *page,unsigned int pgoff,bool submit_buffered) {u64 start = failed_bbio->file_offset + bio_offset;struct io_failure_record *failrec; -struct btrfs_fs_info *fs_info =btrfs_sb (inode->i_sb); +struct btrfs_fs_info *fs_info = inode->root->fs_info;struct bio *failed_bio = &failed_bbio->bio;const int icsum = bio_offset >> fs_info->sectorsize_bits;struct bio *repair_bio;
@@ -812,7 +812,7 @@ int btrfs_repair_one_sector(struct inode *inode, struct btrfs_bio *failed_bbio,BUG_ON (bio_op (failed_bio) ==REQ_OP_WRITE ); - failrec =btrfs_get_io_failure_record (inode, failed_bbio, bio_offset); + failrec =btrfs_get_io_failure_record (&inode->vfs_inode, failed_bbio, bio_offset);if (IS_ERR (failrec))return PTR_ERR (failrec);
@@ -830,7 +830,7 @@ int btrfs_repair_one_sector(struct inode *inode, struct btrfs_bio *failed_bbio,btrfs_debug (fs_info,"failed to repair num_copies %d this_mirror %d failed_mirror %d" , failrec->num_copies, failrec->this_mirror, failrec->failed_mirror); -free_io_failure (BTRFS_I (inode), failrec); +free_io_failure (inode, failrec);return -EIO ; }
@@ -851,7 +851,7 @@ int btrfs_repair_one_sector(struct inode *inode, struct btrfs_bio *failed_bbio,bio_add_page (repair_bio, page, failrec->len, pgoff); repair_bbio->iter = repair_bio->bi_iter; -btrfs_debug (btrfs_sb (inode->i_sb), +btrfs_debug (fs_info,"repair read error: submitting new read to mirror %d" , failrec->this_mirror);
@@ -861,11 +861,10 @@ int btrfs_repair_one_sector(struct inode *inode, struct btrfs_bio *failed_bbio,* error here. */ if (submit_buffered) -btrfs_submit_data_read_bio (BTRFS_I (inode), repair_bio, +btrfs_submit_data_read_bio (inode, repair_bio, failrec->this_mirror,0 );else -btrfs_submit_dio_repair_bio (BTRFS_I (inode), repair_bio, - failrec->this_mirror); +btrfs_submit_dio_repair_bio (inode, repair_bio, failrec->this_mirror);return BLK_STS_OK ; }
@@ -955,7 +954,7 @@ static void submit_data_read_repair(struct inode *inode, goto next; } - ret =btrfs_repair_one_sector (inode, failed_bbio, + ret =btrfs_repair_one_sector (BTRFS_I (inode), failed_bbio, bio_offset + offset, page, pgoff + offset, true);if (!ret) {
fs/btrfs/extent_io.h +1 -1
@@ -268,7 +268,7 @@ struct io_failure_record {int num_copies; }; -int btrfs_repair_one_sector (struct inode *inode,struct btrfs_bio *failed_bbio, +int btrfs_repair_one_sector (struct btrfs_inode *inode,struct btrfs_bio *failed_bbio,u32 bio_offset,struct page *page,unsigned int pgoff,bool submit_buffered);void btrfs_free_io_failure_record (struct btrfs_inode *inode,u64 start,u64 end);
fs/btrfs/inode.c +1 -1
@@ -7952,7 +7952,7 @@ static blk_status_t btrfs_check_read_dio_bio(struct btrfs_dio_private *dip, }else {int ret; - ret =btrfs_repair_one_sector (inode, bbio, offset, + ret =btrfs_repair_one_sector (BTRFS_I (inode), bbio, offset, bv.bv_page, bv.bv_offset, false);if (ret) err =errno_to_blk_status (ret);
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 15/40 btrfs: switch btrfs_dio_private::inode to btrfs_inode
In reply to David SterbaThe btrfs_dio_private structure is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/inode.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
fs/btrfs/inode.c +8 -8
@@ -84,7 +84,7 @@ struct btrfs_dio_data { };struct btrfs_dio_private { -struct inode *inode; +struct btrfs_inode *inode;/* * Since DIO can use anonymous page, we cannot use page_offset() to
@@ -7906,11 +7906,11 @@ static void btrfs_dio_private_put(struct btrfs_dio_private *dip)return ;if (btrfs_op (&dip->bio) ==BTRFS_MAP_WRITE ) { -btrfs_mark_ordered_io_finished (BTRFS_I (dip->inode),NULL , +btrfs_mark_ordered_io_finished (dip->inode,NULL , dip->file_offset, dip->bytes, !dip->bio.bi_status); }else { -unlock_extent (&BTRFS_I (dip->inode)->io_tree, +unlock_extent (&dip->inode->io_tree, dip->file_offset, dip->file_offset + dip->bytes -1 ,NULL ); }
@@ -7933,7 +7933,7 @@ static blk_status_t btrfs_check_read_dio_bio(struct btrfs_dio_private *dip,struct btrfs_bio *bbio, const bool uptodate) { - struct inode *inode = dip->inode; + struct inode *inode = &dip->inode->vfs_inode;struct btrfs_fs_info *fs_info =BTRFS_I (inode)->root->fs_info;const bool csum = !(BTRFS_I (inode)->flags &BTRFS_INODE_NODATASUM );blk_status_t err =BLK_STS_OK ;
@@ -7976,9 +7976,9 @@ static void btrfs_end_dio_bio(struct btrfs_bio *bbio)blk_status_t err = bio->bi_status;if (err) -btrfs_warn (BTRFS_I (dip->inode)->root->fs_info, +btrfs_warn (dip->inode->root->fs_info,"direct IO failed ino %llu rw %d,%u sector %#Lx len %u err no %d" , -btrfs_ino (BTRFS_I (dip->inode)),bio_op (bio), +btrfs_ino (dip->inode),bio_op (bio), bio->bi_opf, bio->bi_iter.bi_sector, bio->bi_iter.bi_size, err);
@@ -7988,7 +7988,7 @@ static void btrfs_end_dio_bio(struct btrfs_bio *bbio)if (err) dip->bio.bi_status = err; -btrfs_record_physical_zoned (dip->inode, bbio->file_offset, bio); +btrfs_record_physical_zoned (&dip->inode->vfs_inode, bbio->file_offset, bio);bio_put (bio);btrfs_dio_private_put (dip);
@@ -8055,7 +8055,7 @@ static void btrfs_submit_direct(const struct iomap_iter *iter,struct btrfs_dio_data *dio_data = iter->private;struct extent_map *em =NULL ; - dip->inode = inode; + dip->inode =BTRFS_I (inode); dip->file_offset = file_offset; dip->bytes = dio_bio->bi_iter.bi_size;refcount_set (&dip->refs,1 );
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 16/40 btrfs: pass btrfs_inode to btrfs_submit_dio_bio
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/inode.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
fs/btrfs/inode.c +7 -7
@@ -7994,10 +7994,10 @@ static void btrfs_end_dio_bio(struct btrfs_bio *bbio)btrfs_dio_private_put (dip); } -static void btrfs_submit_dio_bio (struct bio *bio,struct inode *inode, +static void btrfs_submit_dio_bio (struct bio *bio,struct btrfs_inode *inode,u64 file_offset,int async_submit) { -struct btrfs_fs_info *fs_info =btrfs_sb (inode->i_sb); +struct btrfs_fs_info *fs_info = inode->root->fs_info;struct btrfs_dio_private *dip =btrfs_bio (bio)->private;blk_status_t ret;
@@ -8005,13 +8005,13 @@ static void btrfs_submit_dio_bio(struct bio *bio, struct inode *inode,if (btrfs_op (bio) ==BTRFS_MAP_READ )btrfs_bio (bio)->iter = bio->bi_iter; -if (BTRFS_I (inode)->flags &BTRFS_INODE_NODATASUM ) +if (inode->flags &BTRFS_INODE_NODATASUM ) goto map;if (btrfs_op (bio) ==BTRFS_MAP_WRITE ) {/* Check btrfs_submit_data_write_bio() for async submit rules */ -if (async_submit && !atomic_read (&BTRFS_I (inode)->sync_writers) && -btrfs_wq_submit_bio (BTRFS_I (inode), bio,0 , file_offset, +if (async_submit && !atomic_read (&inode->sync_writers) && +btrfs_wq_submit_bio (inode, bio,0 , file_offset,WQ_SUBMIT_DATA_DIO ))return ;
@@ -8019,7 +8019,7 @@ static void btrfs_submit_dio_bio(struct bio *bio, struct inode *inode,* If we aren't doing async submit, calculate the csum of the * bio now. */ - ret =btrfs_csum_one_bio (BTRFS_I (inode), bio, file_offset, false); + ret =btrfs_csum_one_bio (inode, bio, file_offset, false);if (ret) {btrfs_bio_end_io (btrfs_bio (bio), ret);return ;
@@ -8141,7 +8141,7 @@ static void btrfs_submit_direct(const struct iomap_iter *iter, async_submit =1 ; } -btrfs_submit_dio_bio (bio, inode, file_offset, async_submit); +btrfs_submit_dio_bio (bio,BTRFS_I (inode), file_offset, async_submit); dio_data->submitted += clone_len; clone_offset += clone_len;
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 17/40 btrfs: pass btrfs_inode to btrfs_truncate
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/inode.c | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-)
fs/btrfs/inode.c +20 -21
@@ -124,7 +124,7 @@ static const struct file_operations btrfs_dir_file_operations;static struct kmem_cache *btrfs_inode_cachep;static int btrfs_setsize (struct inode *inode,struct iattr *attr); -static int btrfs_truncate (struct inode *inode,bool skip_writeback); +static int btrfs_truncate (struct btrfs_inode *inode,bool skip_writeback); static noinline int cow_file_range(struct btrfs_inode *inode, struct page *locked_page, u64 start, u64 end, int *page_started,
@@ -5269,7 +5269,7 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr)inode_dio_wait (inode); - ret =btrfs_truncate (inode, newsize == oldsize); + ret =btrfs_truncate (BTRFS_I (inode), newsize == oldsize);if (ret && inode->i_nlink) {int err;
@@ -8631,16 +8631,16 @@ vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf)return ret; } -static int btrfs_truncate (struct inode *inode,bool skip_writeback) +static int btrfs_truncate (struct btrfs_inode *inode,bool skip_writeback) {struct btrfs_truncate_control control = { - .inode =BTRFS_I (inode), - .ino =btrfs_ino (BTRFS_I (inode)), + .inode = inode, + .ino =btrfs_ino (inode), .min_type =BTRFS_EXTENT_DATA_KEY , .clear_extent_range = true, }; -struct btrfs_fs_info *fs_info =btrfs_sb (inode->i_sb); -struct btrfs_root *root =BTRFS_I (inode)->root; +struct btrfs_root *root = inode->root; +struct btrfs_fs_info *fs_info = root->fs_info;struct btrfs_block_rsv *rsv;int ret;struct btrfs_trans_handle *trans;
@@ -8648,7 +8648,8 @@ static int btrfs_truncate(struct inode *inode, bool skip_writeback)u64 min_size =btrfs_calc_metadata_size (fs_info,1 );if (!skip_writeback) { - ret =btrfs_wait_ordered_range (inode, inode->i_size & (~mask), + ret =btrfs_wait_ordered_range (&inode->vfs_inode, + inode->vfs_inode.i_size & (~mask), (u64)-1 );if (ret)return ret;
@@ -8707,34 +8708,32 @@ static int btrfs_truncate(struct inode *inode, bool skip_writeback)while (1 ) {struct extent_state *cached_state =NULL ; -const u64 new_size = inode->i_size; +const u64 new_size = inode->vfs_inode.i_size;const u64 lock_start =ALIGN_DOWN (new_size, fs_info->sectorsize); control.new_size = new_size; -lock_extent (&BTRFS_I (inode)->io_tree, lock_start, (u64)-1 , - &cached_state); +lock_extent (&inode->io_tree, lock_start, (u64)-1 , &cached_state);/* * We want to drop from the next block forward in case this new * size is not block aligned since we will be keeping the last * block of the extent just the way it is. */ -btrfs_drop_extent_map_range (BTRFS_I (inode), +btrfs_drop_extent_map_range (inode,ALIGN (new_size, fs_info->sectorsize), (u64)-1 , false); ret =btrfs_truncate_inode_items (trans, root, &control); -inode_sub_bytes (inode, control.sub_bytes); -btrfs_inode_safe_disk_i_size_write (BTRFS_I (inode), control.last_size); +inode_sub_bytes (&inode->vfs_inode, control.sub_bytes); +btrfs_inode_safe_disk_i_size_write (inode, control.last_size); -unlock_extent (&BTRFS_I (inode)->io_tree, lock_start, (u64)-1 , - &cached_state); +unlock_extent (&inode->io_tree, lock_start, (u64)-1 , &cached_state); trans->block_rsv = &fs_info->trans_block_rsv;if (ret != -ENOSPC && ret != -EAGAIN )break ; - ret =btrfs_update_inode (trans, root,BTRFS_I (inode)); + ret =btrfs_update_inode (trans, root, inode);if (ret)break ;
@@ -8765,7 +8764,7 @@ static int btrfs_truncate(struct inode *inode, bool skip_writeback)btrfs_end_transaction (trans);btrfs_btree_balance_dirty (fs_info); - ret =btrfs_truncate_block (BTRFS_I (inode), inode->i_size,0 ,0 ); + ret =btrfs_truncate_block (inode, inode->vfs_inode.i_size,0 ,0 );if (ret) goto out; trans =btrfs_start_transaction (root,1 );
@@ -8773,14 +8772,14 @@ static int btrfs_truncate(struct inode *inode, bool skip_writeback) ret =PTR_ERR (trans); goto out; } -btrfs_inode_safe_disk_i_size_write (BTRFS_I (inode),0 ); +btrfs_inode_safe_disk_i_size_write (inode,0 ); }if (trans) {int ret2; trans->block_rsv = &fs_info->trans_block_rsv; - ret2 =btrfs_update_inode (trans, root,BTRFS_I (inode)); + ret2 =btrfs_update_inode (trans, root, inode);if (ret2 && !ret) ret = ret2;
@@ -8806,7 +8805,7 @@ static int btrfs_truncate(struct inode *inode, bool skip_writeback)* extents beyond i_size to drop. */ if (control.extents_found >0 ) -btrfs_set_inode_full_sync (BTRFS_I (inode)); +btrfs_set_inode_full_sync (inode);return ret; }
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 18/40 btrfs: pass btrfs_inode to btrfs_inode_lock
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/btrfs_inode.h | 2 +- fs/btrfs/defrag.c | 4 ++-- fs/btrfs/delayed-inode.c | 2 +- fs/btrfs/file.c | 16 ++++++++-------- fs/btrfs/inode.c | 14 +++++++------- fs/btrfs/ioctl.c | 2 +- fs/btrfs/reflink.c | 2 +- fs/btrfs/relocation.c | 2 +- 8 files changed, 22 insertions(+), 22 deletions(-)
fs/btrfs/btrfs_inode.h +1 -1
@@ -545,7 +545,7 @@ enum btrfs_ilock_type { ENUM_BIT(BTRFS_ILOCK_MMAP), }; -int btrfs_inode_lock (struct inode *inode,unsigned int ilock_flags); +int btrfs_inode_lock (struct btrfs_inode *inode,unsigned int ilock_flags);void btrfs_inode_unlock (struct inode *inode,unsigned int ilock_flags);void btrfs_update_inode_bytes (struct btrfs_inode *inode,const u64 add_bytes,const u64 del_bytes);
fs/btrfs/defrag.c +2 -2
@@ -1295,7 +1295,7 @@ int btrfs_defrag_file(struct inode *inode, struct file_ra_state *ra, (SZ_256K >> PAGE_SHIFT)) << PAGE_SHIFT) - 1; cluster_end =min (cluster_end, last_byte); -btrfs_inode_lock (inode,0 ); +btrfs_inode_lock (BTRFS_I (inode),0 );if (IS_SWAPFILE (inode)) { ret = -ETXTBSY ;btrfs_inode_unlock (inode,0 );
@@ -1351,7 +1351,7 @@ int btrfs_defrag_file(struct inode *inode, struct file_ra_state *ra, ret = sectors_defragged; }if (do_compress) { -btrfs_inode_lock (inode,0 ); +btrfs_inode_lock (BTRFS_I (inode),0 );BTRFS_I (inode)->defrag_compress =BTRFS_COMPRESS_NONE ;btrfs_inode_unlock (inode,0 ); }
fs/btrfs/delayed-inode.c +1 -1
@@ -1647,7 +1647,7 @@ bool btrfs_readdir_get_delayed_items(struct inode *inode,* item->readdir_list. */ btrfs_inode_unlock (inode,BTRFS_ILOCK_SHARED ); -btrfs_inode_lock (inode,0 ); +btrfs_inode_lock (BTRFS_I (inode),0 );mutex_lock (&delayed_node->mutex); item =__btrfs_first_delayed_insertion_item (delayed_node);
fs/btrfs/file.c +8 -8
@@ -1193,7 +1193,7 @@ static noinline ssize_t btrfs_buffered_write(struct kiocb *iocb,if (nowait) ilock_flags |=BTRFS_ILOCK_TRY ; - ret =btrfs_inode_lock (inode, ilock_flags); + ret =btrfs_inode_lock (BTRFS_I (inode), ilock_flags);if (ret <0 )return ret;
@@ -1463,7 +1463,7 @@ static ssize_t btrfs_direct_write(struct kiocb *iocb, struct iov_iter *from) ilock_flags |=BTRFS_ILOCK_SHARED ; relock: - err =btrfs_inode_lock (inode, ilock_flags); + err =btrfs_inode_lock (BTRFS_I (inode), ilock_flags);if (err <0 )return err;
@@ -1611,7 +1611,7 @@ static ssize_t btrfs_encoded_write(struct kiocb *iocb, struct iov_iter *from,loff_t count;ssize_t ret; -btrfs_inode_lock (inode,0 ); +btrfs_inode_lock (BTRFS_I (inode),0 ); count = encoded->len; ret =generic_write_checks_count (iocb, &count);if (ret ==0 && count != encoded->len) {
@@ -1801,7 +1801,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)if (ret) goto out; -btrfs_inode_lock (inode,BTRFS_ILOCK_MMAP ); +btrfs_inode_lock (BTRFS_I (inode),BTRFS_ILOCK_MMAP );atomic_inc (&root->log_batch);
@@ -2591,7 +2591,7 @@ static int btrfs_punch_hole(struct file *file, loff_t offset, loff_t len)bool truncated_block = false;bool updated_inode = false; -btrfs_inode_lock (inode,BTRFS_ILOCK_MMAP ); +btrfs_inode_lock (BTRFS_I (inode),BTRFS_ILOCK_MMAP ); ret =btrfs_wait_ordered_range (inode, offset, len);if (ret)
@@ -3049,7 +3049,7 @@ static long btrfs_fallocate(struct file *file, int mode,if (mode &FALLOC_FL_PUNCH_HOLE )return btrfs_punch_hole (file, offset, len); -btrfs_inode_lock (inode,BTRFS_ILOCK_MMAP ); +btrfs_inode_lock (BTRFS_I (inode),BTRFS_ILOCK_MMAP );if (!(mode &FALLOC_FL_KEEP_SIZE ) && offset + len > inode->i_size) { ret =inode_newsize_ok (inode, offset + len);
@@ -3686,7 +3686,7 @@ static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int whence)return generic_file_llseek (file, offset, whence);case SEEK_DATA :case SEEK_HOLE : -btrfs_inode_lock (inode,BTRFS_ILOCK_SHARED ); +btrfs_inode_lock (BTRFS_I (inode),BTRFS_ILOCK_SHARED ); offset =find_desired_extent (BTRFS_I (inode), offset, whence);btrfs_inode_unlock (inode,BTRFS_ILOCK_SHARED );break ;
@@ -3743,7 +3743,7 @@ static ssize_t btrfs_direct_read(struct kiocb *iocb, struct iov_iter *to)if (check_direct_read (btrfs_sb (inode->i_sb), to, iocb->ki_pos))return 0 ; -btrfs_inode_lock (inode,BTRFS_ILOCK_SHARED ); +btrfs_inode_lock (BTRFS_I (inode),BTRFS_ILOCK_SHARED ); again:/* * This is similar to what we do for direct IO writes, see the comment
fs/btrfs/inode.c +7 -7
@@ -172,27 +172,27 @@ static void __cold btrfs_print_data_csum_error(struct btrfs_inode *inode,* return -EAGAIN * BTRFS_ILOCK_MMAP - acquire a write lock on the i_mmap_lock */ -int btrfs_inode_lock (struct inode *inode,unsigned int ilock_flags) +int btrfs_inode_lock (struct btrfs_inode *inode,unsigned int ilock_flags) {if (ilock_flags &BTRFS_ILOCK_SHARED ) {if (ilock_flags &BTRFS_ILOCK_TRY ) { -if (!inode_trylock_shared (inode)) +if (!inode_trylock_shared (&inode->vfs_inode))return -EAGAIN ;else return 0 ; } -inode_lock_shared (inode); +inode_lock_shared (&inode->vfs_inode); }else {if (ilock_flags &BTRFS_ILOCK_TRY ) { -if (!inode_trylock (inode)) +if (!inode_trylock (&inode->vfs_inode))return -EAGAIN ;else return 0 ; } -inode_lock (inode); +inode_lock (&inode->vfs_inode); }if (ilock_flags &BTRFS_ILOCK_MMAP ) -down_write (&BTRFS_I (inode)->i_mmap_lock); +down_write (&inode->i_mmap_lock);return 0 ; }
@@ -10528,7 +10528,7 @@ ssize_t btrfs_encoded_read(struct kiocb *iocb, struct iov_iter *iter,file_accessed (iocb->ki_filp); -btrfs_inode_lock (&inode->vfs_inode,BTRFS_ILOCK_SHARED ); +btrfs_inode_lock (inode,BTRFS_ILOCK_SHARED );if (iocb->ki_pos >= inode->vfs_inode.i_size) {btrfs_inode_unlock (&inode->vfs_inode,BTRFS_ILOCK_SHARED );
fs/btrfs/ioctl.c +1 -1
@@ -2525,7 +2525,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, goto out_dput; } -btrfs_inode_lock (inode,0 ); +btrfs_inode_lock (BTRFS_I (inode),0 ); err =btrfs_delete_subvolume (dir, dentry);btrfs_inode_unlock (inode,0 );if (!err)
fs/btrfs/reflink.c +1 -1
@@ -893,7 +893,7 @@ loff_t btrfs_remap_file_range(struct file *src_file, loff_t off,return -EINVAL ;if (same_inode) { -btrfs_inode_lock (src_inode,BTRFS_ILOCK_MMAP ); +btrfs_inode_lock (BTRFS_I (src_inode),BTRFS_ILOCK_MMAP ); }else {lock_two_nondirectories (src_inode, dst_inode);btrfs_double_mmap_lock (src_inode, dst_inode);
fs/btrfs/relocation.c +1 -1
@@ -2874,7 +2874,7 @@ static noinline_for_stack int prealloc_file_extent_cluster(if (ret)return ret; -btrfs_inode_lock (&inode->vfs_inode,0 ); +btrfs_inode_lock (inode,0 );for (nr =0 ; nr < cluster->nr; nr++) {struct extent_state *cached_state =NULL ;
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 19/40 btrfs: pass btrfs_inode to btrfs_inode_unlock
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/btrfs_inode.h | 2 +- fs/btrfs/defrag.c | 8 ++++---- fs/btrfs/delayed-inode.c | 2 +- fs/btrfs/file.c | 32 ++++++++++++++++---------------- fs/btrfs/inode.c | 18 +++++++++--------- fs/btrfs/ioctl.c | 6 +++--- fs/btrfs/reflink.c | 2 +- fs/btrfs/relocation.c | 2 +- 8 files changed, 36 insertions(+), 36 deletions(-)
fs/btrfs/btrfs_inode.h +1 -1
@@ -546,7 +546,7 @@ enum btrfs_ilock_type { };int btrfs_inode_lock (struct btrfs_inode *inode,unsigned int ilock_flags); -void btrfs_inode_unlock (struct inode *inode,unsigned int ilock_flags); +void btrfs_inode_unlock (struct btrfs_inode *inode,unsigned int ilock_flags);void btrfs_update_inode_bytes (struct btrfs_inode *inode,const u64 add_bytes,const u64 del_bytes);void btrfs_assert_inode_range_clean (struct btrfs_inode *inode,u64 start,u64 end);
fs/btrfs/defrag.c +4 -4
@@ -1298,11 +1298,11 @@ int btrfs_defrag_file(struct inode *inode, struct file_ra_state *ra,btrfs_inode_lock (BTRFS_I (inode),0 );if (IS_SWAPFILE (inode)) { ret = -ETXTBSY ; -btrfs_inode_unlock (inode,0 ); +btrfs_inode_unlock (BTRFS_I (inode),0 );break ; }if (!(inode->i_sb->s_flags &SB_ACTIVE )) { -btrfs_inode_unlock (inode,0 ); +btrfs_inode_unlock (BTRFS_I (inode),0 );break ; }if (do_compress)
@@ -1315,7 +1315,7 @@ int btrfs_defrag_file(struct inode *inode, struct file_ra_state *ra,if (sectors_defragged > prev_sectors_defragged)balance_dirty_pages_ratelimited (inode->i_mapping); -btrfs_inode_unlock (inode,0 ); +btrfs_inode_unlock (BTRFS_I (inode),0 );if (ret <0 )break ; cur =max (cluster_end +1 , last_scanned);
@@ -1353,7 +1353,7 @@ int btrfs_defrag_file(struct inode *inode, struct file_ra_state *ra,if (do_compress) {btrfs_inode_lock (BTRFS_I (inode),0 );BTRFS_I (inode)->defrag_compress =BTRFS_COMPRESS_NONE ; -btrfs_inode_unlock (inode,0 ); +btrfs_inode_unlock (BTRFS_I (inode),0 ); }return ret; }
fs/btrfs/delayed-inode.c +1 -1
@@ -1646,7 +1646,7 @@ bool btrfs_readdir_get_delayed_items(struct inode *inode,* We can only do one readdir with delayed items at a time because of * item->readdir_list. */ -btrfs_inode_unlock (inode,BTRFS_ILOCK_SHARED ); +btrfs_inode_unlock (BTRFS_I (inode),BTRFS_ILOCK_SHARED );btrfs_inode_lock (BTRFS_I (inode),0 );mutex_lock (&delayed_node->mutex);
fs/btrfs/file.c +16 -16
@@ -1423,7 +1423,7 @@ static noinline ssize_t btrfs_buffered_write(struct kiocb *iocb, iocb->ki_pos += num_written; } out: -btrfs_inode_unlock (inode, ilock_flags); +btrfs_inode_unlock (BTRFS_I (inode), ilock_flags);return num_written ? num_written : ret; }
@@ -1469,13 +1469,13 @@ static ssize_t btrfs_direct_write(struct kiocb *iocb, struct iov_iter *from) err =generic_write_checks (iocb, from);if (err <=0 ) { -btrfs_inode_unlock (inode, ilock_flags); +btrfs_inode_unlock (BTRFS_I (inode), ilock_flags);return err; } err =btrfs_write_check (iocb, from, err);if (err <0 ) { -btrfs_inode_unlock (inode, ilock_flags); +btrfs_inode_unlock (BTRFS_I (inode), ilock_flags); goto out; }
@@ -1486,13 +1486,13 @@ static ssize_t btrfs_direct_write(struct kiocb *iocb, struct iov_iter *from)*/ if ((ilock_flags &BTRFS_ILOCK_SHARED ) && pos +iov_iter_count (from) >i_size_read (inode)) { -btrfs_inode_unlock (inode, ilock_flags); +btrfs_inode_unlock (BTRFS_I (inode), ilock_flags); ilock_flags &= ~BTRFS_ILOCK_SHARED ; goto relock; }if (check_direct_IO (fs_info, from, pos)) { -btrfs_inode_unlock (inode, ilock_flags); +btrfs_inode_unlock (BTRFS_I (inode), ilock_flags); goto buffered; }
@@ -1523,7 +1523,7 @@ static ssize_t btrfs_direct_write(struct kiocb *iocb, struct iov_iter *from)* iocb, and that needs to lock the inode. So unlock it before calling * iomap_dio_complete() to avoid a deadlock. */ -btrfs_inode_unlock (inode, ilock_flags); +btrfs_inode_unlock (BTRFS_I (inode), ilock_flags);if (IS_ERR_OR_NULL (dio)) err =PTR_ERR_OR_ZERO (dio);
@@ -1630,7 +1630,7 @@ static ssize_t btrfs_encoded_write(struct kiocb *iocb, struct iov_iter *from, ret =btrfs_do_encoded_write (iocb, from, encoded); out: -btrfs_inode_unlock (inode,0 ); +btrfs_inode_unlock (BTRFS_I (inode),0 );return ret; }
@@ -1825,7 +1825,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)*/ ret =start_ordered_ops (inode, start, end);if (ret) { -btrfs_inode_unlock (inode,BTRFS_ILOCK_MMAP ); +btrfs_inode_unlock (BTRFS_I (inode),BTRFS_ILOCK_MMAP ); goto out; }
@@ -1928,7 +1928,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)* file again, but that will end up using the synchronization * inside btrfs_sync_log to keep things safe. */ -btrfs_inode_unlock (inode,BTRFS_ILOCK_MMAP ); +btrfs_inode_unlock (BTRFS_I (inode),BTRFS_ILOCK_MMAP );if (ret ==BTRFS_NO_LOG_SYNC ) { ret =btrfs_end_transaction (trans);
@@ -1996,7 +1996,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) out_release_extents:btrfs_release_log_ctx_extents (&ctx); -btrfs_inode_unlock (inode,BTRFS_ILOCK_MMAP ); +btrfs_inode_unlock (BTRFS_I (inode),BTRFS_ILOCK_MMAP ); goto out; }
@@ -2639,7 +2639,7 @@ static int btrfs_punch_hole(struct file *file, loff_t offset, loff_t len) truncated_block = true; ret =btrfs_truncate_block (BTRFS_I (inode), offset,0 ,0 );if (ret) { -btrfs_inode_unlock (inode,BTRFS_ILOCK_MMAP ); +btrfs_inode_unlock (BTRFS_I (inode),BTRFS_ILOCK_MMAP );return ret; } }
@@ -2738,7 +2738,7 @@ static int btrfs_punch_hole(struct file *file, loff_t offset, loff_t len) ret = ret2; } } -btrfs_inode_unlock (inode,BTRFS_ILOCK_MMAP ); +btrfs_inode_unlock (BTRFS_I (inode),BTRFS_ILOCK_MMAP );return ret; }
@@ -3099,7 +3099,7 @@ static long btrfs_fallocate(struct file *file, int mode,if (mode &FALLOC_FL_ZERO_RANGE ) { ret =btrfs_zero_range (inode, offset, len, mode); -btrfs_inode_unlock (inode,BTRFS_ILOCK_MMAP ); +btrfs_inode_unlock (BTRFS_I (inode),BTRFS_ILOCK_MMAP );return ret; }
@@ -3197,7 +3197,7 @@ static long btrfs_fallocate(struct file *file, int mode,unlock_extent (&BTRFS_I (inode)->io_tree, alloc_start, locked_end, &cached_state); out: -btrfs_inode_unlock (inode,BTRFS_ILOCK_MMAP ); +btrfs_inode_unlock (BTRFS_I (inode),BTRFS_ILOCK_MMAP );extent_changeset_free (data_reserved);return ret; }
@@ -3688,7 +3688,7 @@ static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int whence)case SEEK_HOLE :btrfs_inode_lock (BTRFS_I (inode),BTRFS_ILOCK_SHARED ); offset =find_desired_extent (BTRFS_I (inode), offset, whence); -btrfs_inode_unlock (inode,BTRFS_ILOCK_SHARED ); +btrfs_inode_unlock (BTRFS_I (inode),BTRFS_ILOCK_SHARED );break ; }
@@ -3792,7 +3792,7 @@ static ssize_t btrfs_direct_read(struct kiocb *iocb, struct iov_iter *to) goto again; } } -btrfs_inode_unlock (inode,BTRFS_ILOCK_SHARED ); +btrfs_inode_unlock (BTRFS_I (inode),BTRFS_ILOCK_SHARED );return ret <0 ? ret : read; }
fs/btrfs/inode.c +9 -9
@@ -202,14 +202,14 @@ int btrfs_inode_lock(struct btrfs_inode *inode, unsigned int ilock_flags)* ilock_flags should contain the same bits set as passed to btrfs_inode_lock() * to decide whether the lock acquired is shared or exclusive. */ -void btrfs_inode_unlock (struct inode *inode,unsigned int ilock_flags) +void btrfs_inode_unlock (struct btrfs_inode *inode,unsigned int ilock_flags) {if (ilock_flags &BTRFS_ILOCK_MMAP ) -up_write (&BTRFS_I (inode)->i_mmap_lock); +up_write (&inode->i_mmap_lock);if (ilock_flags &BTRFS_ILOCK_SHARED ) -inode_unlock_shared (inode); +inode_unlock_shared (&inode->vfs_inode);else -inode_unlock (inode); +inode_unlock (&inode->vfs_inode); }/*
@@ -10276,7 +10276,7 @@ static ssize_t btrfs_encoded_read_inline(read_extent_buffer (leaf, tmp, ptr, count);btrfs_release_path (path);unlock_extent (io_tree, start, lockend, cached_state); -btrfs_inode_unlock (&inode->vfs_inode,BTRFS_ILOCK_SHARED ); +btrfs_inode_unlock (inode,BTRFS_ILOCK_SHARED ); *unlocked = true; ret =copy_to_iter (tmp, count, iter);
@@ -10479,7 +10479,7 @@ static ssize_t btrfs_encoded_read_regular(struct kiocb *iocb, goto out;unlock_extent (io_tree, start, lockend, cached_state); -btrfs_inode_unlock (&inode->vfs_inode,BTRFS_ILOCK_SHARED ); +btrfs_inode_unlock (inode,BTRFS_ILOCK_SHARED ); *unlocked = true;if (compressed) {
@@ -10531,7 +10531,7 @@ ssize_t btrfs_encoded_read(struct kiocb *iocb, struct iov_iter *iter,btrfs_inode_lock (inode,BTRFS_ILOCK_SHARED );if (iocb->ki_pos >= inode->vfs_inode.i_size) { -btrfs_inode_unlock (&inode->vfs_inode,BTRFS_ILOCK_SHARED ); +btrfs_inode_unlock (inode,BTRFS_ILOCK_SHARED );return 0 ; } start =ALIGN_DOWN (iocb->ki_pos, fs_info->sectorsize);
@@ -10629,7 +10629,7 @@ ssize_t btrfs_encoded_read(struct kiocb *iocb, struct iov_iter *iter,if (disk_bytenr ==EXTENT_MAP_HOLE ) {unlock_extent (io_tree, start, lockend, &cached_state); -btrfs_inode_unlock (&inode->vfs_inode,BTRFS_ILOCK_SHARED ); +btrfs_inode_unlock (inode,BTRFS_ILOCK_SHARED ); unlocked = true; ret =iov_iter_zero (count, iter);if (ret != count)
@@ -10652,7 +10652,7 @@ ssize_t btrfs_encoded_read(struct kiocb *iocb, struct iov_iter *iter,unlock_extent (io_tree, start, lockend, &cached_state); out_unlock_inode:if (!unlocked) -btrfs_inode_unlock (&inode->vfs_inode,BTRFS_ILOCK_SHARED ); +btrfs_inode_unlock (inode,BTRFS_ILOCK_SHARED );return ret; }
fs/btrfs/ioctl.c +3 -3
@@ -1002,7 +1002,7 @@ static noinline int btrfs_mksubvol(const struct path *parent, out_dput:dput (dentry); out_unlock: -btrfs_inode_unlock (dir,0 ); +btrfs_inode_unlock (BTRFS_I (dir),0 );return error; }
@@ -2527,14 +2527,14 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,btrfs_inode_lock (BTRFS_I (inode),0 ); err =btrfs_delete_subvolume (dir, dentry); -btrfs_inode_unlock (inode,0 ); +btrfs_inode_unlock (BTRFS_I (inode),0 );if (!err)d_delete_notify (dir, dentry); out_dput:dput (dentry); out_unlock_dir: -btrfs_inode_unlock (dir,0 ); +btrfs_inode_unlock (BTRFS_I (dir),0 ); free_subvol_name:kfree (subvol_name_ptr); free_parent:
fs/btrfs/reflink.c +1 -1
@@ -911,7 +911,7 @@ loff_t btrfs_remap_file_range(struct file *src_file, loff_t off, out_unlock:if (same_inode) { -btrfs_inode_unlock (src_inode,BTRFS_ILOCK_MMAP ); +btrfs_inode_unlock (BTRFS_I (src_inode),BTRFS_ILOCK_MMAP ); }else {btrfs_double_mmap_unlock (src_inode, dst_inode);unlock_two_nondirectories (src_inode, dst_inode);
fs/btrfs/relocation.c +1 -1
@@ -2894,7 +2894,7 @@ static noinline_for_stack int prealloc_file_extent_cluster(if (ret)break ; } -btrfs_inode_unlock (&inode->vfs_inode,0 ); +btrfs_inode_unlock (inode,0 );if (cur_offset < prealloc_end) btrfs_free_reserved_data_space_noquota(inode->root->fs_info,
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 20/40 btrfs: pass btrfs_inode to btrfs_dirty_inode
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/inode.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
fs/btrfs/inode.c +10 -10
@@ -286,7 +286,7 @@ static inline void btrfs_cleanup_ordered_extents(struct btrfs_inode *inode,return btrfs_mark_ordered_io_finished (inode,NULL , offset, bytes, false); } -static int btrfs_dirty_inode (struct inode *inode); +static int btrfs_dirty_inode (struct btrfs_inode *inode);static int btrfs_init_inode_security (struct btrfs_trans_handle *trans,struct btrfs_new_inode_args *args)
@@ -5312,7 +5312,7 @@ static int btrfs_setattr(struct user_namespace *mnt_userns, struct dentry *dentrif (attr->ia_valid) {setattr_copy (mnt_userns, inode, attr);inode_inc_iversion (inode); - err =btrfs_dirty_inode (inode); + err =btrfs_dirty_inode (BTRFS_I (inode));if (!err && attr->ia_valid &ATTR_MODE ) err =posix_acl_chmod (mnt_userns, inode, inode->i_mode);
@@ -6143,21 +6143,21 @@ static int btrfs_real_readdir(struct file *file, struct dir_context *ctx)* FIXME, needs more benchmarking...there are no reasons other than performance * to keep or drop this code. */ -static int btrfs_dirty_inode (struct inode *inode) +static int btrfs_dirty_inode (struct btrfs_inode *inode) { -struct btrfs_fs_info *fs_info =btrfs_sb (inode->i_sb); -struct btrfs_root *root =BTRFS_I (inode)->root; +struct btrfs_root *root = inode->root; +struct btrfs_fs_info *fs_info = root->fs_info;struct btrfs_trans_handle *trans;int ret; -if (test_bit (BTRFS_INODE_DUMMY , &BTRFS_I (inode)->runtime_flags)) +if (test_bit (BTRFS_INODE_DUMMY , &inode->runtime_flags))return 0 ; trans =btrfs_join_transaction (root);if (IS_ERR (trans))return PTR_ERR (trans); - ret =btrfs_update_inode (trans, root,BTRFS_I (inode)); + ret =btrfs_update_inode (trans, root, inode);if (ret && (ret == -ENOSPC || ret == -EDQUOT )) {/* whoops, lets try again with the full transaction */ btrfs_end_transaction (trans);
@@ -6165,10 +6165,10 @@ static int btrfs_dirty_inode(struct inode *inode)if (IS_ERR (trans))return PTR_ERR (trans); - ret =btrfs_update_inode (trans, root,BTRFS_I (inode)); + ret =btrfs_update_inode (trans, root, inode); }btrfs_end_transaction (trans); -if (BTRFS_I (inode)->delayed_node) +if (inode->delayed_node)btrfs_balance_delayed_items (fs_info);return ret;
@@ -6195,7 +6195,7 @@ static int btrfs_update_time(struct inode *inode, struct timespec64 *now, inode->i_mtime = *now;if (flags &S_ATIME ) inode->i_atime = *now; -return dirty ?btrfs_dirty_inode (inode) :0 ; +return dirty ?btrfs_dirty_inode (BTRFS_I (inode)) :0 ; }/*
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 21/40 btrfs: pass btrfs_inode to btrfs_add_delalloc_inodes
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/inode.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
fs/btrfs/inode.c +6 -9
@@ -2369,16 +2369,14 @@ void btrfs_merge_delalloc_extent(struct inode *inode, struct extent_state *new, }static void btrfs_add_delalloc_inodes (struct btrfs_root *root, -struct inode *inode) +struct btrfs_inode *inode) { -struct btrfs_fs_info *fs_info =btrfs_sb (inode->i_sb); +struct btrfs_fs_info *fs_info = inode->root->fs_info;spin_lock (&root->delalloc_lock); -if (list_empty (&BTRFS_I (inode)->delalloc_inodes)) { -list_add_tail (&BTRFS_I (inode)->delalloc_inodes, - &root->delalloc_inodes); -set_bit (BTRFS_INODE_IN_DELALLOC_LIST , - &BTRFS_I (inode)->runtime_flags); +if (list_empty (&inode->delalloc_inodes)) { +list_add_tail (&inode->delalloc_inodes, &root->delalloc_inodes); +set_bit (BTRFS_INODE_IN_DELALLOC_LIST , &inode->runtime_flags); root->nr_delalloc_inodes++;if (root->nr_delalloc_inodes ==1 ) {spin_lock (&fs_info->delalloc_root_lock);
@@ -2391,7 +2389,6 @@ static void btrfs_add_delalloc_inodes(struct btrfs_root *root,spin_unlock (&root->delalloc_lock); } -void __btrfs_del_delalloc_inode (struct btrfs_root *root,struct btrfs_inode *inode) {
@@ -2458,7 +2455,7 @@ void btrfs_set_delalloc_extent(struct inode *inode, struct extent_state *state,BTRFS_I (inode)->defrag_bytes += len;if (do_list && !test_bit (BTRFS_INODE_IN_DELALLOC_LIST , &BTRFS_I (inode)->runtime_flags)) -btrfs_add_delalloc_inodes (root, inode); +btrfs_add_delalloc_inodes (root,BTRFS_I (inode));spin_unlock (&BTRFS_I (inode)->lock); }
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 22/40 btrfs: switch btrfs_writepage_fixup::inode to btrfs_inode
In reply to David SterbaThe btrfs_writepage_fixup structure is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/inode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/btrfs/inode.c +3 -3
@@ -2890,7 +2890,7 @@ int btrfs_set_extent_delalloc(struct btrfs_inode *inode, u64 start, u64 end,/* see btrfs_writepage_start_hook for details on why this is required */ struct btrfs_writepage_fixup {struct page *page; -struct inode *inode; +struct btrfs_inode *inode;struct btrfs_work work; };
@@ -2909,7 +2909,7 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work) fixup = container_of(work, struct btrfs_writepage_fixup, work); page = fixup->page; - inode =BTRFS_I (fixup->inode); + inode = fixup->inode; page_start =page_offset (page); page_end =page_offset (page) +PAGE_SIZE -1 ;
@@ -3068,7 +3068,7 @@ int btrfs_writepage_cow_fixup(struct page *page)get_page (page);btrfs_init_work (&fixup->work, btrfs_writepage_fixup_worker,NULL ,NULL ); fixup->page = page; - fixup->inode = inode; + fixup->inode =BTRFS_I (inode);btrfs_queue_work (fs_info->fixup_workers, &fixup->work);return -EAGAIN ;
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 23/40 btrfs: pass btrfs_inode to btrfs_check_data_csum
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/btrfs_inode.h | 4 +--- fs/btrfs/compression.c | 2 +- fs/btrfs/inode.c | 15 +++++++-------- 3 files changed, 9 insertions(+), 12 deletions(-)
fs/btrfs/btrfs_inode.h +1 -3
@@ -421,13 +421,11 @@ blk_status_t btrfs_submit_bio_start_direct_io(struct btrfs_inode *inode, u64 dio_file_offset);int btrfs_check_sector_csum (struct btrfs_fs_info *fs_info,struct page *page,u32 pgoff,u8 *csum,const u8 *const csum_expected); -int btrfs_check_data_csum (struct inode *inode,struct btrfs_bio *bbio, +int btrfs_check_data_csum (struct btrfs_inode *inode,struct btrfs_bio *bbio,u32 bio_offset,struct page *page,u32 pgoff);unsigned int btrfs_verify_data_csum (struct btrfs_bio *bbio,u32 bio_offset,struct page *page,u64 start,u64 end); -int btrfs_check_data_csum (struct inode *inode,struct btrfs_bio *bbio, -u32 bio_offset,struct page *page,u32 pgoff); noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,u64 *orig_start,u64 *orig_block_len,u64 *ram_bytes,bool nowait,bool strict);
fs/btrfs/compression.c +1 -1
@@ -186,7 +186,7 @@ static void end_compressed_bio_read(struct btrfs_bio *bbio)u64 start = bbio->file_offset + offset;if (!status && - (!csum || !btrfs_check_data_csum (inode, bbio, offset, + (!csum || !btrfs_check_data_csum (bi, bbio, offset, bv.bv_page, bv.bv_offset))) {btrfs_clean_io_failure (bi, start, bv.bv_page, bv.bv_offset);
fs/btrfs/inode.c +7 -8
@@ -3490,10 +3490,10 @@ static u8 *btrfs_csum_ptr(const struct btrfs_fs_info *fs_info, u8 *csums, u64 of* When csum mismatch is detected, we will also report the error and fill the * corrupted range with zero. (Thus it needs the extra parameters) */ -int btrfs_check_data_csum (struct inode *inode,struct btrfs_bio *bbio, +int btrfs_check_data_csum (struct btrfs_inode *inode,struct btrfs_bio *bbio,u32 bio_offset,struct page *page,u32 pgoff) { -struct btrfs_fs_info *fs_info =btrfs_sb (inode->i_sb); +struct btrfs_fs_info *fs_info = inode->root->fs_info;u32 len = fs_info->sectorsize;u8 *csum_expected;u8 csum[BTRFS_CSUM_SIZE ];
@@ -3507,8 +3507,7 @@ int btrfs_check_data_csum(struct inode *inode, struct btrfs_bio *bbio,return 0 ; zeroit: -btrfs_print_data_csum_error (BTRFS_I (inode), - bbio->file_offset + bio_offset, +btrfs_print_data_csum_error (inode, bbio->file_offset + bio_offset, csum, csum_expected, bbio->mirror_num);if (bbio->device) btrfs_dev_stat_inc_and_print(bbio->device,
@@ -3573,7 +3572,7 @@ unsigned int btrfs_verify_data_csum(struct btrfs_bio *bbio, EXTENT_NODATASUM);continue ; } - ret =btrfs_check_data_csum (inode, bbio, bio_offset, page, pg_off); + ret =btrfs_check_data_csum (BTRFS_I (inode), bbio, bio_offset, page, pg_off);if (ret <0 ) {const int nr_bit = (pg_off -offset_in_page (start)) >> root->fs_info->sectorsize_bits;
@@ -7942,8 +7941,8 @@ static blk_status_t btrfs_check_read_dio_bio(struct btrfs_dio_private *dip,u64 start = bbio->file_offset + offset;if (uptodate && - (!csum || !btrfs_check_data_csum (inode, bbio, offset, bv.bv_page, - bv.bv_offset))) { + (!csum || !btrfs_check_data_csum (BTRFS_I (inode), bbio, offset, + bv.bv_page, bv.bv_offset))) {btrfs_clean_io_failure (BTRFS_I (inode), start, bv.bv_page, bv.bv_offset); }else {
@@ -10333,7 +10332,7 @@ static blk_status_t btrfs_encoded_read_verify_csum(struct btrfs_bio *bbio) pgoff = bvec->bv_offset;for (i =0 ; i < nr_sectors; i++) {ASSERT (pgoff <PAGE_SIZE ); -if (btrfs_check_data_csum (&inode->vfs_inode, bbio, bio_offset, +if (btrfs_check_data_csum (inode, bbio, bio_offset, bvec->bv_page, pgoff))return BLK_STS_IOERR ; bio_offset += sectorsize;
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 24/40 btrfs: pass btrfs_inode to __unlink_start_trans
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/inode.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/btrfs/inode.c +4 -4
@@ -4415,9 +4415,9 @@ int btrfs_unlink_inode(struct btrfs_trans_handle *trans,* plenty of slack room in the global reserve to migrate, otherwise we cannot * allow the unlink to occur. */ -static struct btrfs_trans_handle *__unlink_start_trans (struct inode *dir) +static struct btrfs_trans_handle *__unlink_start_trans (struct btrfs_inode *dir) { -struct btrfs_root *root =BTRFS_I (dir)->root; +struct btrfs_root *root = dir->root;/* * 1 for the possible orphan item
@@ -4443,7 +4443,7 @@ static int btrfs_unlink(struct inode *dir, struct dentry *dentry)/* This needs to handle no-key deletions later on */ - trans =__unlink_start_trans (dir); + trans =__unlink_start_trans (BTRFS_I (dir));if (IS_ERR (trans)) { ret =PTR_ERR (trans); goto out;
@@ -4856,7 +4856,7 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry)/* This needs to handle no-key deletions later on */ - trans =__unlink_start_trans (dir); + trans =__unlink_start_trans (BTRFS_I (dir));if (IS_ERR (trans)) { err =PTR_ERR (trans); goto out_notrans;
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 25/40 btrfs: pass btrfs_inode to btrfs_delete_subvolume
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/btrfs_inode.h | 2 +- fs/btrfs/inode.c | 10 +++++----- fs/btrfs/ioctl.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)
fs/btrfs/btrfs_inode.h +1 -1
@@ -439,7 +439,7 @@ int btrfs_unlink_inode(struct btrfs_trans_handle *trans,int btrfs_add_link (struct btrfs_trans_handle *trans,struct btrfs_inode *parent_inode,struct btrfs_inode *inode,const struct fscrypt_str *name,int add_backref,u64 index); -int btrfs_delete_subvolume (struct inode *dir,struct dentry *dentry); +int btrfs_delete_subvolume (struct btrfs_inode *dir,struct dentry *dentry);int btrfs_truncate_block (struct btrfs_inode *inode,loff_t from,loff_t len,int front);
fs/btrfs/inode.c +5 -5
@@ -4697,10 +4697,10 @@ static void btrfs_prune_dentries(struct btrfs_root *root)spin_unlock (&root->inode_lock); } -int btrfs_delete_subvolume (struct inode *dir,struct dentry *dentry) +int btrfs_delete_subvolume (struct btrfs_inode *dir,struct dentry *dentry) {struct btrfs_fs_info *fs_info =btrfs_sb (dentry->d_sb); -struct btrfs_root *root =BTRFS_I (dir)->root; +struct btrfs_root *root = dir->root;struct inode *inode =d_inode (dentry);struct btrfs_root *dest =BTRFS_I (inode)->root;struct btrfs_trans_handle *trans;
@@ -4757,9 +4757,9 @@ int btrfs_delete_subvolume(struct inode *dir, struct dentry *dentry) trans->block_rsv = &block_rsv; trans->bytes_reserved = block_rsv.size; -btrfs_record_snapshot_destroy (trans,BTRFS_I (dir)); +btrfs_record_snapshot_destroy (trans, dir); - ret =btrfs_unlink_subvol (trans, dir, dentry); + ret =btrfs_unlink_subvol (trans, &dir->vfs_inode, dentry);if (ret) {btrfs_abort_transaction (trans, ret); goto out_end_trans;
@@ -4847,7 +4847,7 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry) "extent tree v2 doesn't support snapshot deletion yet");return -EOPNOTSUPP ; } -return btrfs_delete_subvolume (dir, dentry); +return btrfs_delete_subvolume (BTRFS_I (dir), dentry); } err =fscrypt_setup_filename (dir, &dentry->d_name,1 , &fname);
fs/btrfs/ioctl.c +1 -1
@@ -2526,7 +2526,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, }btrfs_inode_lock (BTRFS_I (inode),0 ); - err =btrfs_delete_subvolume (dir, dentry); + err =btrfs_delete_subvolume (BTRFS_I (dir), dentry);btrfs_inode_unlock (BTRFS_I (inode),0 );if (!err)d_delete_notify (dir, dentry);
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 26/40 btrfs: drop private_data parameter from extent_io_tree_init
In reply to David SterbaAll callers except one pass NULL, so the parameter can be dropped and the inode::io_tree initialization can be open coded.
--- fs/btrfs/disk-io.c | 8 ++++---- fs/btrfs/extent-io-tree.c | 5 ++--- fs/btrfs/extent-io-tree.h | 3 +-- fs/btrfs/inode.c | 5 +++-- fs/btrfs/relocation.c | 3 +-- fs/btrfs/tests/btrfs-tests.c | 2 +- fs/btrfs/tests/extent-io-tests.c | 4 ++-- fs/btrfs/transaction.c | 4 ++-- fs/btrfs/volumes.c | 3 +-- 9 files changed, 17 insertions(+), 20 deletions(-)
fs/btrfs/disk-io.c +4 -4
@@ -1044,9 +1044,9 @@ static void __setup_root(struct btrfs_root *root, struct btrfs_fs_info *fs_info, root->anon_dev =0 ;if (!dummy) {extent_io_tree_init (fs_info, &root->dirty_log_pages, -IO_TREE_ROOT_DIRTY_LOG_PAGES ,NULL ); +IO_TREE_ROOT_DIRTY_LOG_PAGES );extent_io_tree_init (fs_info, &root->log_csum_range, -IO_TREE_LOG_CSUM_RANGE ,NULL ); +IO_TREE_LOG_CSUM_RANGE ); }spin_lock_init (&root->root_item_lock);
@@ -2252,7 +2252,7 @@ static void btrfs_init_btree_inode(struct btrfs_fs_info *fs_info)RB_CLEAR_NODE (&BTRFS_I (inode)->rb_node);extent_io_tree_init (fs_info, &BTRFS_I (inode)->io_tree, -IO_TREE_BTREE_INODE_IO ,NULL ); +IO_TREE_BTREE_INODE_IO );extent_map_tree_init (&BTRFS_I (inode)->extent_tree);BTRFS_I (inode)->root =btrfs_grab_root (fs_info->tree_root);
@@ -3076,7 +3076,7 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info) fs_info->block_group_cache_tree =RB_ROOT_CACHED ;extent_io_tree_init (fs_info, &fs_info->excluded_extents, -IO_TREE_FS_EXCLUDED_EXTENTS ,NULL ); +IO_TREE_FS_EXCLUDED_EXTENTS );mutex_init (&fs_info->ordered_operations_mutex);mutex_init (&fs_info->tree_log_mutex);
fs/btrfs/extent-io-tree.c +2 -3
@@ -94,13 +94,12 @@ struct tree_entry { };void extent_io_tree_init (struct btrfs_fs_info *fs_info, -struct extent_io_tree *tree,unsigned int owner, -void *private_data) +struct extent_io_tree *tree,unsigned int owner) { tree->fs_info = fs_info; tree->state =RB_ROOT ;spin_lock_init (&tree->lock); - tree->private_data = private_data; + tree->private_data =NULL ; tree->owner = owner;if (owner ==IO_TREE_INODE_FILE_EXTENT )lockdep_set_class (&tree->lock, &file_extent_tree_class);
fs/btrfs/extent-io-tree.h +1 -2
@@ -104,8 +104,7 @@ struct extent_state { };void extent_io_tree_init (struct btrfs_fs_info *fs_info, -struct extent_io_tree *tree,unsigned int owner, -void *private_data); +struct extent_io_tree *tree,unsigned int owner);void extent_io_tree_release (struct extent_io_tree *tree); int lock_extent(struct extent_io_tree *tree, u64 start, u64 end,
fs/btrfs/inode.c +3 -2
@@ -8870,9 +8870,10 @@ struct inode *btrfs_alloc_inode(struct super_block *sb) inode = &ei->vfs_inode;extent_map_tree_init (&ei->extent_tree); -extent_io_tree_init (fs_info, &ei->io_tree,IO_TREE_INODE_IO , inode); +extent_io_tree_init (fs_info, &ei->io_tree,IO_TREE_INODE_IO ); + ei->io_tree.private_data = inode;extent_io_tree_init (fs_info, &ei->file_extent_tree, -IO_TREE_INODE_FILE_EXTENT ,NULL ); +IO_TREE_INODE_FILE_EXTENT ); ei->io_failure_tree =RB_ROOT ;atomic_set (&ei->sync_writers,0 );mutex_init (&ei->log_mutex);
fs/btrfs/relocation.c +1 -2
@@ -3925,8 +3925,7 @@ static struct reloc_control *alloc_reloc_control(struct btrfs_fs_info *fs_info)INIT_LIST_HEAD (&rc->dirty_subvol_roots);btrfs_backref_init_cache (fs_info, &rc->backref_cache,1 );mapping_tree_init (&rc->reloc_root_tree); -extent_io_tree_init (fs_info, &rc->processed_blocks, -IO_TREE_RELOC_BLOCKS ,NULL ); +extent_io_tree_init (fs_info, &rc->processed_blocks,IO_TREE_RELOC_BLOCKS );return rc; }
fs/btrfs/tests/btrfs-tests.c +1 -1
@@ -102,7 +102,7 @@ struct btrfs_device *btrfs_alloc_dummy_device(struct btrfs_fs_info *fs_info)if (!dev)return ERR_PTR (-ENOMEM ); -extent_io_tree_init (NULL , &dev->alloc_state,0 ,NULL ); +extent_io_tree_init (NULL , &dev->alloc_state,0 );INIT_LIST_HEAD (&dev->dev_list);list_add (&dev->dev_list, &fs_info->fs_devices->devices);
fs/btrfs/tests/extent-io-tests.c +2 -2
@@ -132,7 +132,7 @@ static int test_find_delalloc(u32 sectorsize)* Passing NULL as we don't have fs_info but tracepoints are not used * at this point */ -extent_io_tree_init (NULL , tmp,IO_TREE_SELFTEST ,NULL ); +extent_io_tree_init (NULL , tmp,IO_TREE_SELFTEST );/* * First go through and create and mark all of our pages dirty, we pin
@@ -489,7 +489,7 @@ static int test_find_first_clear_extent_bit(void)test_msg ("running find_first_clear_extent_bit test" ); -extent_io_tree_init (NULL , &tree,IO_TREE_SELFTEST ,NULL ); +extent_io_tree_init (NULL , &tree,IO_TREE_SELFTEST );/* Test correct handling of empty tree */ find_first_clear_extent_bit (&tree,0 , &start, &end,CHUNK_TRIMMED );
fs/btrfs/transaction.c +2 -2
@@ -378,9 +378,9 @@ static noinline int join_transaction(struct btrfs_fs_info *fs_info,spin_lock_init (&cur_trans->releasing_ebs_lock);list_add_tail (&cur_trans->list, &fs_info->trans_list);extent_io_tree_init (fs_info, &cur_trans->dirty_pages, -IO_TREE_TRANS_DIRTY_PAGES ,NULL ); +IO_TREE_TRANS_DIRTY_PAGES );extent_io_tree_init (fs_info, &cur_trans->pinned_extents, -IO_TREE_FS_PINNED_EXTENTS ,NULL ); +IO_TREE_FS_PINNED_EXTENTS ); fs_info->generation++; cur_trans->transid = fs_info->generation; fs_info->running_transaction = cur_trans;
fs/btrfs/volumes.c +1 -2
@@ -7036,8 +7036,7 @@ struct btrfs_device *btrfs_alloc_device(struct btrfs_fs_info *fs_info,atomic_set (&dev->dev_stats_ccnt,0 );btrfs_device_data_ordered_init (dev); -extent_io_tree_init (fs_info, &dev->alloc_state, -IO_TREE_DEVICE_ALLOC_STATE ,NULL ); +extent_io_tree_init (fs_info, &dev->alloc_state,IO_TREE_DEVICE_ALLOC_STATE );if (devid) tmp = *devid;
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 27/40 btrfs: switch extent_io_tree::private_data to btrfs_inode and rename
In reply to David SterbaThe extent_io_tree::private_data was meant to be a preparatory work for the metadata inode rework but that never materialized. Now it's used only for an inode so it's better to change the appropriate type and rename it.
--- fs/btrfs/extent-io-tree.c | 32 ++++++++++++++++---------------- fs/btrfs/extent-io-tree.h | 3 ++- fs/btrfs/inode.c | 2 +- include/trace/events/btrfs.h | 27 ++++++++++++--------------- 4 files changed, 31 insertions(+), 33 deletions(-)
fs/btrfs/extent-io-tree.c +16 -16
@@ -58,17 +58,17 @@ static inline void __btrfs_debug_check_extent_io_range(const char *caller,struct extent_io_tree *tree, u64 start, u64 end) { - struct inode *inode = tree->private_data; + struct btrfs_inode *inode = tree->inode;u64 isize;if (!inode)return ; - isize =i_size_read (inode); + isize =i_size_read (&inode->vfs_inode);if (end >=PAGE_SIZE && (end %2 ) ==0 && end != isize -1 ) { -btrfs_debug_rl (BTRFS_I (inode)->root->fs_info, +btrfs_debug_rl (inode->root->fs_info,"%s: ino %llu isize %llu odd range [%llu,%llu]" , - caller,btrfs_ino (BTRFS_I (inode)), isize, start, end); + caller,btrfs_ino (inode), isize, start, end); } }#else
@@ -99,7 +99,7 @@ void extent_io_tree_init(struct btrfs_fs_info *fs_info, tree->fs_info = fs_info; tree->state =RB_ROOT ;spin_lock_init (&tree->lock); - tree->private_data =NULL ; + tree->inode =NULL ; tree->owner = owner;if (owner ==IO_TREE_INODE_FILE_EXTENT )lockdep_set_class (&tree->lock, &file_extent_tree_class);
@@ -346,9 +346,9 @@ static void merge_state(struct extent_io_tree *tree, struct extent_state *state) other =prev_state (state);if (other && other->end == state->start -1 && other->state == state->state) { -if (tree->private_data) -btrfs_merge_delalloc_extent (tree->private_data, - state, other); +if (tree->inode) +btrfs_merge_delalloc_extent (&tree->inode->vfs_inode, state, + other); state->start = other->start;rb_erase (&other->rb_node, &tree->state);RB_CLEAR_NODE (&other->rb_node);
@@ -357,8 +357,8 @@ static void merge_state(struct extent_io_tree *tree, struct extent_state *state) other =next_state (state);if (other && other->start == state->end +1 && other->state == state->state) { -if (tree->private_data) -btrfs_merge_delalloc_extent (tree->private_data, state, +if (tree->inode) +btrfs_merge_delalloc_extent (&tree->inode->vfs_inode, state, other); state->end = other->end;rb_erase (&other->rb_node, &tree->state);
@@ -374,8 +374,8 @@ static void set_state_bits(struct extent_io_tree *tree,u32 bits_to_set = bits & ~EXTENT_CTLBITS ;int ret; -if (tree->private_data) -btrfs_set_delalloc_extent (tree->private_data, state, bits); +if (tree->inode) +btrfs_set_delalloc_extent (&tree->inode->vfs_inode, state, bits); ret =add_extent_changeset (state, bits_to_set, changeset,1 );BUG_ON (ret <0 );
@@ -462,8 +462,8 @@ static int split_state(struct extent_io_tree *tree, struct extent_state *orig,struct rb_node *parent =NULL ;struct rb_node **node; -if (tree->private_data) -btrfs_split_delalloc_extent (tree->private_data, orig, split); +if (tree->inode) +btrfs_split_delalloc_extent (&tree->inode->vfs_inode, orig, split); prealloc->start = orig->start; prealloc->end = split -1 ;
@@ -510,8 +510,8 @@ static struct extent_state *clear_state_bit(struct extent_io_tree *tree,u32 bits_to_clear = bits & ~EXTENT_CTLBITS ;int ret; -if (tree->private_data) -btrfs_clear_delalloc_extent (tree->private_data, state, bits); +if (tree->inode) +btrfs_clear_delalloc_extent (&tree->inode->vfs_inode, state, bits); ret =add_extent_changeset (state, bits_to_clear, changeset,0 );BUG_ON (ret <0 );
fs/btrfs/extent-io-tree.h +2 -1
@@ -80,7 +80,8 @@ enum {struct extent_io_tree {struct rb_root state;struct btrfs_fs_info *fs_info; -void *private_data; +/* Inode associated with this tree, or NULL. */ +struct btrfs_inode *inode;/* Who owns this io tree, should be one of IO_TREE_* */ u8 owner;
fs/btrfs/inode.c +1 -1
@@ -8871,7 +8871,7 @@ struct inode *btrfs_alloc_inode(struct super_block *sb) inode = &ei->vfs_inode;extent_map_tree_init (&ei->extent_tree);extent_io_tree_init (fs_info, &ei->io_tree,IO_TREE_INODE_IO ); - ei->io_tree.private_data = inode; + ei->io_tree.inode = ei;extent_io_tree_init (fs_info, &ei->file_extent_tree,IO_TREE_INODE_FILE_EXTENT ); ei->io_failure_tree =RB_ROOT ;
include/trace/events/btrfs.h +12 -15
@@ -1993,12 +1993,11 @@ TRACE_EVENT(btrfs_set_extent_bit,TP_fast_assign_btrfs (tree->fs_info, __entry->owner = tree->owner; -if (tree->private_data) { -const struct inode *inode = tree->private_data; +if (tree->inode) { +const struct btrfs_inode *inode = tree->inode; - __entry->ino =btrfs_ino (BTRFS_I (inode)); - __entry->rootid = -BTRFS_I (inode)->root->root_key.objectid; + __entry->ino =btrfs_ino (inode); + __entry->rootid = inode->root->root_key.objectid; }else { __entry->ino =0 ; __entry->rootid =0 ;
@@ -2032,12 +2031,11 @@ TRACE_EVENT(btrfs_clear_extent_bit,TP_fast_assign_btrfs (tree->fs_info, __entry->owner = tree->owner; -if (tree->private_data) { -const struct inode *inode = tree->private_data; +if (tree->inode) { +const struct btrfs_inode *inode = tree->inode; - __entry->ino =btrfs_ino (BTRFS_I (inode)); - __entry->rootid = -BTRFS_I (inode)->root->root_key.objectid; + __entry->ino =btrfs_ino (inode); + __entry->rootid = inode->root->root_key.objectid; }else { __entry->ino =0 ; __entry->rootid =0 ;
@@ -2072,12 +2070,11 @@ TRACE_EVENT(btrfs_convert_extent_bit,TP_fast_assign_btrfs (tree->fs_info, __entry->owner = tree->owner; -if (tree->private_data) { -const struct inode *inode = tree->private_data; +if (tree->inode) { +const struct btrfs_inode *inode = tree->inode; - __entry->ino =btrfs_ino (BTRFS_I (inode)); - __entry->rootid = -BTRFS_I (inode)->root->root_key.objectid; + __entry->ino =btrfs_ino (inode); + __entry->rootid = inode->root->root_key.objectid; }else { __entry->ino =0 ; __entry->rootid =0 ;
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 28/40 btrfs: pass btrfs_inode to btrfs_merge_delalloc_extent
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/btrfs_inode.h | 2 +- fs/btrfs/extent-io-tree.c | 6 ++---- fs/btrfs/inode.c | 16 ++++++++-------- 3 files changed, 11 insertions(+), 13 deletions(-)
fs/btrfs/btrfs_inode.h +1 -1
@@ -475,7 +475,7 @@ struct inode *btrfs_new_subvol_inode(struct user_namespace *mnt_userns, u32 bits);void btrfs_clear_delalloc_extent (struct inode *inode,struct extent_state *state,u32 bits); -void btrfs_merge_delalloc_extent (struct inode *inode,struct extent_state *new, +void btrfs_merge_delalloc_extent (struct btrfs_inode *inode,struct extent_state *new,struct extent_state *other);void btrfs_split_delalloc_extent (struct inode *inode,struct extent_state *orig,u64 split);
fs/btrfs/extent-io-tree.c +2 -4
@@ -347,8 +347,7 @@ static void merge_state(struct extent_io_tree *tree, struct extent_state *state)if (other && other->end == state->start -1 && other->state == state->state) {if (tree->inode) -btrfs_merge_delalloc_extent (&tree->inode->vfs_inode, state, - other); +btrfs_merge_delalloc_extent (tree->inode, state, other); state->start = other->start;rb_erase (&other->rb_node, &tree->state);RB_CLEAR_NODE (&other->rb_node);
@@ -358,8 +357,7 @@ static void merge_state(struct extent_io_tree *tree, struct extent_state *state)if (other && other->start == state->end +1 && other->state == state->state) {if (tree->inode) -btrfs_merge_delalloc_extent (&tree->inode->vfs_inode, state, - other); +btrfs_merge_delalloc_extent (tree->inode, state, other); state->end = other->end;rb_erase (&other->rb_node, &tree->state);RB_CLEAR_NODE (&other->rb_node);
fs/btrfs/inode.c +8 -8
@@ -2314,10 +2314,10 @@ void btrfs_split_delalloc_extent(struct inode *inode,* that are just merged onto old extents, such as when we are doing sequential * writes, so we can properly account for the metadata space we'll need. */ -void btrfs_merge_delalloc_extent (struct inode *inode,struct extent_state *new, +void btrfs_merge_delalloc_extent (struct btrfs_inode *inode,struct extent_state *new,struct extent_state *other) { -struct btrfs_fs_info *fs_info =btrfs_sb (inode->i_sb); +struct btrfs_fs_info *fs_info = inode->root->fs_info;u64 new_size, old_size;u32 num_extents;
@@ -2332,9 +2332,9 @@ void btrfs_merge_delalloc_extent(struct inode *inode, struct extent_state *new,/* we're not bigger than the max, unreserve the space and go */ if (new_size <= fs_info->max_extent_size) { -spin_lock (&BTRFS_I (inode)->lock); -btrfs_mod_outstanding_extents (BTRFS_I (inode),-1 ); -spin_unlock (&BTRFS_I (inode)->lock); +spin_lock (&inode->lock); +btrfs_mod_outstanding_extents (inode,-1 ); +spin_unlock (&inode->lock);return ; }
@@ -2363,9 +2363,9 @@ void btrfs_merge_delalloc_extent(struct inode *inode, struct extent_state *new,if (count_max_extents (fs_info, new_size) >= num_extents)return ; -spin_lock (&BTRFS_I (inode)->lock); -btrfs_mod_outstanding_extents (BTRFS_I (inode),-1 ); -spin_unlock (&BTRFS_I (inode)->lock); +spin_lock (&inode->lock); +btrfs_mod_outstanding_extents (inode,-1 ); +spin_unlock (&inode->lock); } static void btrfs_add_delalloc_inodes(struct btrfs_root *root,
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 29/40 btrfs: pass btrfs_inode to btrfs_set_delalloc_extent
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/btrfs_inode.h | 2 +- fs/btrfs/extent-io-tree.c | 2 +- fs/btrfs/inode.c | 33 ++++++++++++++++----------------- 3 files changed, 18 insertions(+), 19 deletions(-)
fs/btrfs/btrfs_inode.h +1 -1
@@ -471,7 +471,7 @@ int btrfs_create_new_inode(struct btrfs_trans_handle *trans,void btrfs_new_inode_args_destroy (struct btrfs_new_inode_args *args);struct inode *btrfs_new_subvol_inode (struct user_namespace *mnt_userns,struct inode *dir); -void btrfs_set_delalloc_extent (struct inode *inode,struct extent_state *state, +void btrfs_set_delalloc_extent (struct btrfs_inode *inode,struct extent_state *state,u32 bits);void btrfs_clear_delalloc_extent (struct inode *inode,struct extent_state *state,u32 bits);
fs/btrfs/extent-io-tree.c +1 -1
@@ -373,7 +373,7 @@ static void set_state_bits(struct extent_io_tree *tree,int ret;if (tree->inode) -btrfs_set_delalloc_extent (&tree->inode->vfs_inode, state, bits); +btrfs_set_delalloc_extent (tree->inode, state, bits); ret =add_extent_changeset (state, bits_to_set, changeset,1 );BUG_ON (ret <0 );
fs/btrfs/inode.c +16 -17
@@ -2421,10 +2421,10 @@ static void btrfs_del_delalloc_inode(struct btrfs_root *root,* Properly track delayed allocation bytes in the inode and to maintain the * list of inodes that have pending delalloc work to be done. */ -void btrfs_set_delalloc_extent (struct inode *inode,struct extent_state *state, +void btrfs_set_delalloc_extent (struct btrfs_inode *inode,struct extent_state *state,u32 bits) { -struct btrfs_fs_info *fs_info =btrfs_sb (inode->i_sb); +struct btrfs_fs_info *fs_info = inode->root->fs_info;if ((bits &EXTENT_DEFRAG ) && !(bits &EXTENT_DELALLOC ))WARN_ON (1 );
@@ -2434,14 +2434,14 @@ void btrfs_set_delalloc_extent(struct inode *inode, struct extent_state *state,* bit, which is only set or cleared with irqs on */ if (!(state->state &EXTENT_DELALLOC ) && (bits &EXTENT_DELALLOC )) { -struct btrfs_root *root =BTRFS_I (inode)->root; +struct btrfs_root *root = inode->root;u64 len = state->end +1 - state->start;u32 num_extents =count_max_extents (fs_info, len); -bool do_list = !btrfs_is_free_space_inode (BTRFS_I (inode)); +bool do_list = !btrfs_is_free_space_inode (inode); -spin_lock (&BTRFS_I (inode)->lock); -btrfs_mod_outstanding_extents (BTRFS_I (inode), num_extents); -spin_unlock (&BTRFS_I (inode)->lock); +spin_lock (&inode->lock); +btrfs_mod_outstanding_extents (inode, num_extents); +spin_unlock (&inode->lock);/* For sanity tests */ if (btrfs_is_testing (fs_info))
@@ -2449,22 +2449,21 @@ void btrfs_set_delalloc_extent(struct inode *inode, struct extent_state *state,percpu_counter_add_batch (&fs_info->delalloc_bytes, len, fs_info->delalloc_batch); -spin_lock (&BTRFS_I (inode)->lock); -BTRFS_I (inode)->delalloc_bytes += len; +spin_lock (&inode->lock); + inode->delalloc_bytes += len;if (bits &EXTENT_DEFRAG ) -BTRFS_I (inode)->defrag_bytes += len; + inode->defrag_bytes += len;if (do_list && !test_bit (BTRFS_INODE_IN_DELALLOC_LIST , - &BTRFS_I (inode)->runtime_flags)) -btrfs_add_delalloc_inodes (root,BTRFS_I (inode)); -spin_unlock (&BTRFS_I (inode)->lock); + &inode->runtime_flags)) +btrfs_add_delalloc_inodes (root, inode); +spin_unlock (&inode->lock); }if (!(state->state &EXTENT_DELALLOC_NEW ) && (bits &EXTENT_DELALLOC_NEW )) { -spin_lock (&BTRFS_I (inode)->lock); -BTRFS_I (inode)->new_delalloc_bytes += state->end +1 - - state->start; -spin_unlock (&BTRFS_I (inode)->lock); +spin_lock (&inode->lock); + inode->new_delalloc_bytes += state->end +1 - state->start; +spin_unlock (&inode->lock); } }
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 30/40 btrfs: pass btrfs_inode to btrfs_split_delalloc_extent
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/btrfs_inode.h | 2 +- fs/btrfs/extent-io-tree.c | 2 +- fs/btrfs/inode.c | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-)
fs/btrfs/btrfs_inode.h +1 -1
@@ -477,7 +477,7 @@ void btrfs_clear_delalloc_extent(struct inode *inode, struct extent_state *state, u32 bits);void btrfs_merge_delalloc_extent (struct btrfs_inode *inode,struct extent_state *new,struct extent_state *other); -void btrfs_split_delalloc_extent (struct inode *inode, +void btrfs_split_delalloc_extent (struct btrfs_inode *inode,struct extent_state *orig,u64 split);void btrfs_set_range_writeback (struct btrfs_inode *inode,u64 start,u64 end);vm_fault_t btrfs_page_mkwrite (struct vm_fault *vmf);
fs/btrfs/extent-io-tree.c +1 -1
@@ -461,7 +461,7 @@ static int split_state(struct extent_io_tree *tree, struct extent_state *orig,struct rb_node **node;if (tree->inode) -btrfs_split_delalloc_extent (&tree->inode->vfs_inode, orig, split); +btrfs_split_delalloc_extent (tree->inode, orig, split); prealloc->start = orig->start; prealloc->end = split -1 ;
fs/btrfs/inode.c +5 -5
@@ -2277,10 +2277,10 @@ int btrfs_run_delalloc_range(struct btrfs_inode *inode, struct page *locked_pagereturn ret; } -void btrfs_split_delalloc_extent (struct inode *inode, +void btrfs_split_delalloc_extent (struct btrfs_inode *inode,struct extent_state *orig,u64 split) { -struct btrfs_fs_info *fs_info =btrfs_sb (inode->i_sb); +struct btrfs_fs_info *fs_info = inode->root->fs_info;u64 size;/* not delalloc, ignore it */
@@ -2304,9 +2304,9 @@ void btrfs_split_delalloc_extent(struct inode *inode,return ; } -spin_lock (&BTRFS_I (inode)->lock); -btrfs_mod_outstanding_extents (BTRFS_I (inode),1 ); -spin_unlock (&BTRFS_I (inode)->lock); +spin_lock (&inode->lock); +btrfs_mod_outstanding_extents (inode,1 ); +spin_unlock (&inode->lock); }/*
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 31/40 btrfs: pass btrfs_inode to btrfs_clear_delalloc_extent
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/btrfs_inode.h | 2 +- fs/btrfs/extent-io-tree.c | 2 +- fs/btrfs/inode.c | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-)
fs/btrfs/btrfs_inode.h +1 -1
@@ -473,7 +473,7 @@ struct inode *btrfs_new_subvol_inode(struct user_namespace *mnt_userns, struct inode *dir);void btrfs_set_delalloc_extent (struct btrfs_inode *inode,struct extent_state *state,u32 bits); -void btrfs_clear_delalloc_extent (struct inode *inode, +void btrfs_clear_delalloc_extent (struct btrfs_inode *inode,struct extent_state *state,u32 bits);void btrfs_merge_delalloc_extent (struct btrfs_inode *inode,struct extent_state *new,struct extent_state *other);
fs/btrfs/extent-io-tree.c +1 -1
@@ -509,7 +509,7 @@ static struct extent_state *clear_state_bit(struct extent_io_tree *tree,int ret;if (tree->inode) -btrfs_clear_delalloc_extent (&tree->inode->vfs_inode, state, bits); +btrfs_clear_delalloc_extent (tree->inode, state, bits); ret =add_extent_changeset (state, bits_to_clear, changeset,0 );BUG_ON (ret <0 );
fs/btrfs/inode.c +2 -3
@@ -2471,11 +2471,10 @@ void btrfs_set_delalloc_extent(struct btrfs_inode *inode, struct extent_state *s* Once a range is no longer delalloc this function ensures that proper * accounting happens. */ -void btrfs_clear_delalloc_extent (struct inode *vfs_inode, +void btrfs_clear_delalloc_extent (struct btrfs_inode *inode,struct extent_state *state,u32 bits) { -struct btrfs_inode *inode =BTRFS_I (vfs_inode); -struct btrfs_fs_info *fs_info =btrfs_sb (vfs_inode->i_sb); +struct btrfs_fs_info *fs_info = inode->root->fs_info;u64 len = state->end +1 - state->start;u32 num_extents =count_max_extents (fs_info, len);
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 32/40 btrfs: pass btrfs_inode to btrfs_unlink_subvol
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/inode.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
fs/btrfs/inode.c +16 -16
@@ -4469,9 +4469,9 @@ static int btrfs_unlink(struct inode *dir, struct dentry *dentry) }static int btrfs_unlink_subvol (struct btrfs_trans_handle *trans, -struct inode *dir,struct dentry *dentry) +struct btrfs_inode *dir,struct dentry *dentry) { -struct btrfs_root *root =BTRFS_I (dir)->root; +struct btrfs_root *root = dir->root;struct btrfs_inode *inode =BTRFS_I (d_inode (dentry));struct btrfs_path *path;struct extent_buffer *leaf;
@@ -4480,10 +4480,10 @@ static int btrfs_unlink_subvol(struct btrfs_trans_handle *trans,u64 index;int ret;u64 objectid; -u64 dir_ino =btrfs_ino (BTRFS_I (dir)); +u64 dir_ino =btrfs_ino (dir);struct fscrypt_name fname; - ret =fscrypt_setup_filename (dir, &dentry->d_name,1 , &fname); + ret =fscrypt_setup_filename (&dir->vfs_inode, &dentry->d_name,1 , &fname);if (ret)return ret;
@@ -4556,17 +4556,17 @@ static int btrfs_unlink_subvol(struct btrfs_trans_handle *trans, } } - ret =btrfs_delete_delayed_dir_index (trans,BTRFS_I (dir), index); + ret =btrfs_delete_delayed_dir_index (trans, dir, index);if (ret) {btrfs_abort_transaction (trans, ret); goto out; } -btrfs_i_size_write (BTRFS_I (dir), dir->i_size - fname.disk_name.len *2 ); -inode_inc_iversion (dir); - dir->i_mtime =current_time (dir); - dir->i_ctime = dir->i_mtime; - ret =btrfs_update_inode_fallback (trans, root,BTRFS_I (dir)); +btrfs_i_size_write (dir, dir->vfs_inode.i_size - fname.disk_name.len *2 ); +inode_inc_iversion (&dir->vfs_inode); + dir->vfs_inode.i_mtime =current_time (&dir->vfs_inode); + dir->vfs_inode.i_ctime = dir->vfs_inode.i_mtime; + ret =btrfs_update_inode_fallback (trans, root, dir);if (ret)btrfs_abort_transaction (trans, ret); out:
@@ -4757,7 +4757,7 @@ int btrfs_delete_subvolume(struct btrfs_inode *dir, struct dentry *dentry)btrfs_record_snapshot_destroy (trans, dir); - ret =btrfs_unlink_subvol (trans, &dir->vfs_inode, dentry); + ret =btrfs_unlink_subvol (trans, dir, dentry);if (ret) {btrfs_abort_transaction (trans, ret); goto out_end_trans;
@@ -4861,7 +4861,7 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry) }if (unlikely (btrfs_ino (BTRFS_I (inode)) ==BTRFS_EMPTY_SUBVOL_DIR_OBJECTID )) { - err =btrfs_unlink_subvol (trans, dir, dentry); + err =btrfs_unlink_subvol (trans,BTRFS_I (dir), dentry); goto out; }
@@ -9207,7 +9207,7 @@ static int btrfs_rename_exchange(struct inode *old_dir,/* src is a subvolume */ if (old_ino ==BTRFS_FIRST_FREE_OBJECTID ) { - ret =btrfs_unlink_subvol (trans, old_dir, old_dentry); + ret =btrfs_unlink_subvol (trans,BTRFS_I (old_dir), old_dentry); }else {/* src is an inode */ ret = __btrfs_unlink_inode(trans, BTRFS_I(old_dir), BTRFS_I(old_dentry->d_inode),
@@ -9222,7 +9222,7 @@ static int btrfs_rename_exchange(struct inode *old_dir,/* dest is a subvolume */ if (new_ino ==BTRFS_FIRST_FREE_OBJECTID ) { - ret =btrfs_unlink_subvol (trans, new_dir, new_dentry); + ret =btrfs_unlink_subvol (trans,BTRFS_I (new_dir), new_dentry); }else {/* dest is an inode */ ret = __btrfs_unlink_inode(trans, BTRFS_I(new_dir), BTRFS_I(new_dentry->d_inode),
@@ -9469,7 +9469,7 @@ static int btrfs_rename(struct user_namespace *mnt_userns, BTRFS_I(old_inode), 1);if (unlikely (old_ino ==BTRFS_FIRST_FREE_OBJECTID )) { - ret =btrfs_unlink_subvol (trans, old_dir, old_dentry); + ret =btrfs_unlink_subvol (trans,BTRFS_I (old_dir), old_dentry); }else { ret = __btrfs_unlink_inode(trans, BTRFS_I(old_dir), BTRFS_I(d_inode(old_dentry)),
@@ -9487,7 +9487,7 @@ static int btrfs_rename(struct user_namespace *mnt_userns, new_inode->i_ctime =current_time (new_inode);if (unlikely (btrfs_ino (BTRFS_I (new_inode)) ==BTRFS_EMPTY_SUBVOL_DIR_OBJECTID )) { - ret =btrfs_unlink_subvol (trans, new_dir, new_dentry); + ret =btrfs_unlink_subvol (trans,BTRFS_I (new_dir), new_dentry);BUG_ON (new_inode->i_nlink ==0 ); }else { ret = btrfs_unlink_inode(trans, BTRFS_I(new_dir),
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 33/40 btrfs: pass btrfs_inode to btrfs_inode_by_name
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/inode.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
fs/btrfs/inode.c +6 -6
@@ -5564,12 +5564,12 @@ void btrfs_evict_inode(struct inode *inode)* If no dir entries were found, returns -ENOENT. * If found a corrupted location in dir entry, returns -EUCLEAN. */ -static int btrfs_inode_by_name (struct inode *dir,struct dentry *dentry, +static int btrfs_inode_by_name (struct btrfs_inode *dir,struct dentry *dentry,struct btrfs_key *location,u8 *type) {struct btrfs_dir_item *di;struct btrfs_path *path; -struct btrfs_root *root =BTRFS_I (dir)->root; +struct btrfs_root *root = dir->root;int ret =0 ;struct fscrypt_name fname;
@@ -5577,13 +5577,13 @@ static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry,if (!path)return -ENOMEM ; - ret =fscrypt_setup_filename (dir, &dentry->d_name,1 , &fname); + ret =fscrypt_setup_filename (&dir->vfs_inode, &dentry->d_name,1 , &fname);if (ret) goto out;/* This needs to handle no-key deletions later on */ - di =btrfs_lookup_dir_item (NULL , root, path,btrfs_ino (BTRFS_I (dir)), + di =btrfs_lookup_dir_item (NULL , root, path,btrfs_ino (dir), &fname.disk_name,0 );if (IS_ERR_OR_NULL (di)) { ret = di ?PTR_ERR (di) : -ENOENT ;
@@ -5596,7 +5596,7 @@ static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry, ret = -EUCLEAN ;btrfs_warn (root->fs_info,"%s gets something invalid in DIR_ITEM (name %s, directory ino %llu, location(%llu %u %llu))" , - __func__, fname.disk_name.name,btrfs_ino (BTRFS_I (dir)), + __func__, fname.disk_name.name,btrfs_ino (dir), location->objectid, location->type, location->offset); }if (!ret)
@@ -5880,7 +5880,7 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)if (dentry->d_name.len >BTRFS_NAME_LEN )return ERR_PTR (-ENAMETOOLONG ); - ret =btrfs_inode_by_name (dir, dentry, &location, &di_type); + ret =btrfs_inode_by_name (BTRFS_I (dir), dentry, &location, &di_type);if (ret <0 )return ERR_PTR (ret);
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 34/40 btrfs: pass btrfs_inode to fixup_tree_root_location
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/inode.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/btrfs/inode.c +5 -5
@@ -5613,7 +5613,7 @@ static int btrfs_inode_by_name(struct btrfs_inode *dir, struct dentry *dentry,* is kind of like crossing a mount point. */ static int fixup_tree_root_location (struct btrfs_fs_info *fs_info, -struct inode *dir, +struct btrfs_inode *dir,struct dentry *dentry,struct btrfs_key *location,struct btrfs_root **sub_root)
@@ -5627,7 +5627,7 @@ static int fixup_tree_root_location(struct btrfs_fs_info *fs_info,int err =0 ;struct fscrypt_name fname; - ret =fscrypt_setup_filename (dir, &dentry->d_name,0 , &fname); + ret =fscrypt_setup_filename (&dir->vfs_inode, &dentry->d_name,0 , &fname);if (ret)return ret;
@@ -5638,7 +5638,7 @@ static int fixup_tree_root_location(struct btrfs_fs_info *fs_info, } err = -ENOENT ; - key.objectid =BTRFS_I (dir)->root->root_key.objectid; + key.objectid = dir->root->root_key.objectid; key.type =BTRFS_ROOT_REF_KEY ; key.offset = location->objectid;
@@ -5651,7 +5651,7 @@ static int fixup_tree_root_location(struct btrfs_fs_info *fs_info, leaf = path->nodes[0 ]; ref = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_root_ref); -if (btrfs_root_ref_dirid (leaf, ref) !=btrfs_ino (BTRFS_I (dir)) || +if (btrfs_root_ref_dirid (leaf, ref) !=btrfs_ino (dir) ||btrfs_root_ref_name_len (leaf, ref) != fname.disk_name.len) goto out;
@@ -5901,7 +5901,7 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)return inode; } - ret =fixup_tree_root_location (fs_info, dir, dentry, + ret =fixup_tree_root_location (fs_info,BTRFS_I (dir), dentry, &location, &sub_root);if (ret <0 ) {if (ret != -ENOENT )
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 35/40 btrfs: pass btrfs_inode to inode_tree_add
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/inode.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
fs/btrfs/inode.c +7 -7
@@ -5679,16 +5679,16 @@ static int fixup_tree_root_location(struct btrfs_fs_info *fs_info,return err; } -static void inode_tree_add (struct inode *inode) +static void inode_tree_add (struct btrfs_inode *inode) { -struct btrfs_root *root =BTRFS_I (inode)->root; +struct btrfs_root *root = inode->root;struct btrfs_inode *entry;struct rb_node **p;struct rb_node *parent; -struct rb_node *new = &BTRFS_I (inode)->rb_node; -u64 ino =btrfs_ino (BTRFS_I (inode)); +struct rb_node *new = &inode->rb_node; +u64 ino =btrfs_ino (inode); -if (inode_unhashed (inode)) +if (inode_unhashed (&inode->vfs_inode))return ; parent =NULL ;spin_lock (&root->inode_lock);
@@ -5800,7 +5800,7 @@ struct inode *btrfs_iget_path(struct super_block *s, u64 ino, ret =btrfs_read_locked_inode (inode, path);if (!ret) { -inode_tree_add (inode); +inode_tree_add (BTRFS_I (inode));unlock_new_inode (inode); }else {iget_failed (inode);
@@ -6567,7 +6567,7 @@ int btrfs_create_new_inode(struct btrfs_trans_handle *trans, } } -inode_tree_add (inode); +inode_tree_add (BTRFS_I (inode));trace_btrfs_inode_new (inode);btrfs_set_inode_last_trans (trans,BTRFS_I (inode));
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 36/40 btrfs: pass btrfs_inode to btrfs_inherit_iflags
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/inode.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
fs/btrfs/inode.c +11 -11
@@ -6344,27 +6344,27 @@ void btrfs_new_inode_args_destroy(struct btrfs_new_inode_args *args)* * Currently only the compression flags and the cow flags are inherited. */ -static void btrfs_inherit_iflags (struct inode *inode,struct inode *dir) +static void btrfs_inherit_iflags (struct btrfs_inode *inode,struct btrfs_inode *dir) {unsigned int flags; - flags =BTRFS_I (dir)->flags; + flags = dir->flags;if (flags &BTRFS_INODE_NOCOMPRESS ) { -BTRFS_I (inode)->flags &= ~BTRFS_INODE_COMPRESS ; -BTRFS_I (inode)->flags |=BTRFS_INODE_NOCOMPRESS ; + inode->flags &= ~BTRFS_INODE_COMPRESS ; + inode->flags |=BTRFS_INODE_NOCOMPRESS ; }else if (flags &BTRFS_INODE_COMPRESS ) { -BTRFS_I (inode)->flags &= ~BTRFS_INODE_NOCOMPRESS ; -BTRFS_I (inode)->flags |=BTRFS_INODE_COMPRESS ; + inode->flags &= ~BTRFS_INODE_NOCOMPRESS ; + inode->flags |=BTRFS_INODE_COMPRESS ; }if (flags &BTRFS_INODE_NODATACOW ) { -BTRFS_I (inode)->flags |=BTRFS_INODE_NODATACOW ; -if (S_ISREG (inode->i_mode)) -BTRFS_I (inode)->flags |=BTRFS_INODE_NODATASUM ; + inode->flags |=BTRFS_INODE_NODATACOW ; +if (S_ISREG (inode->vfs_inode.i_mode)) + inode->flags |=BTRFS_INODE_NODATASUM ; } -btrfs_sync_inode_flags_to_i_flags (inode); +btrfs_sync_inode_flags_to_i_flags (&inode->vfs_inode); } int btrfs_create_new_inode(struct btrfs_trans_handle *trans,
@@ -6423,7 +6423,7 @@ int btrfs_create_new_inode(struct btrfs_trans_handle *trans,* change it now without compatibility issues. */ if (!args->subvol) -btrfs_inherit_iflags (inode, dir); +btrfs_inherit_iflags (BTRFS_I (inode),BTRFS_I (dir));if (S_ISREG (inode->i_mode)) {if (btrfs_test_opt (fs_info,NODATASUM ))
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 37/40 btrfs: switch async_chunk::inode to btrfs_inode
In reply to David SterbaThe async_chunk::inode structure is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/inode.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
fs/btrfs/inode.c +6 -6
@@ -520,7 +520,7 @@ struct async_extent { };struct async_chunk { -struct inode *inode; +struct btrfs_inode *inode;struct page *locked_page;u64 start;u64 end;
@@ -648,7 +648,7 @@ static inline void inode_should_defrag(struct btrfs_inode *inode,*/ static noinline int compress_file_range(struct async_chunk *async_chunk) { -struct inode *inode = async_chunk->inode; +struct inode *inode = &async_chunk->inode->vfs_inode;struct btrfs_fs_info *fs_info =btrfs_sb (inode->i_sb);u64 blocksize = fs_info->sectorsize;u64 start = async_chunk->start;
@@ -1113,7 +1113,7 @@ static int submit_one_async_extent(struct btrfs_inode *inode,*/ static noinline void submit_compressed_extents(struct async_chunk *async_chunk) { -struct btrfs_inode *inode =BTRFS_I (async_chunk->inode); +struct btrfs_inode *inode = async_chunk->inode;struct btrfs_fs_info *fs_info = inode->root->fs_info;struct async_extent *async_extent;u64 alloc_hint =0 ;
@@ -1494,7 +1494,7 @@ static noinline void async_cow_start(struct btrfs_work *work) compressed_extents =compress_file_range (async_chunk);if (compressed_extents ==0 ) { -btrfs_add_delayed_iput (async_chunk->inode); +btrfs_add_delayed_iput (&async_chunk->inode->vfs_inode); async_chunk->inode =NULL ; } }
@@ -1534,7 +1534,7 @@ static noinline void async_cow_free(struct btrfs_work *work) async_chunk = container_of(work, struct async_chunk, work);if (async_chunk->inode) -btrfs_add_delayed_iput (async_chunk->inode); +btrfs_add_delayed_iput (&async_chunk->inode->vfs_inode);if (async_chunk->blkcg_css)css_put (async_chunk->blkcg_css);
@@ -1602,7 +1602,7 @@ static int cow_file_range_async(struct btrfs_inode *inode,*/ ihold (&inode->vfs_inode); async_chunk[i].async_cow = ctx; - async_chunk[i].inode = &inode->vfs_inode; + async_chunk[i].inode = inode; async_chunk[i].start = start; async_chunk[i].end = cur_end; async_chunk[i].write_flags = write_flags;
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 38/40 btrfs: use btrfs_inode inside compress_file_range
In reply to David SterbaThe function is mostly using internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/inode.c | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-)
fs/btrfs/inode.c +18 -19
@@ -648,8 +648,8 @@ static inline void inode_should_defrag(struct btrfs_inode *inode,*/ static noinline int compress_file_range(struct async_chunk *async_chunk) { -struct inode *inode = &async_chunk->inode->vfs_inode; -struct btrfs_fs_info *fs_info =btrfs_sb (inode->i_sb); +struct btrfs_inode *inode = async_chunk->inode; +struct btrfs_fs_info *fs_info = inode->root->fs_info;u64 blocksize = fs_info->sectorsize;u64 start = async_chunk->start;u64 end = async_chunk->end;
@@ -666,8 +666,7 @@ static noinline int compress_file_range(struct async_chunk *async_chunk)int compressed_extents =0 ;int redirty =0 ; -inode_should_defrag (BTRFS_I (inode), start, end, end - start +1 , -SZ_16K ); +inode_should_defrag (inode, start, end, end - start +1 ,SZ_16K );/* * We need to save i_size before now because it could change in between
@@ -679,7 +678,7 @@ static noinline int compress_file_range(struct async_chunk *async_chunk)* does that for us. */ barrier (); - i_size =i_size_read (inode); + i_size =i_size_read (&inode->vfs_inode);barrier (); actual_end =min_t (u64, i_size, end +1 ); again:
@@ -708,7 +707,7 @@ static noinline int compress_file_range(struct async_chunk *async_chunk)* isn't an inline extent, since it doesn't save disk space at all. */ if (total_compressed <= blocksize && - (start >0 || end +1 <BTRFS_I (inode)->disk_i_size)) + (start >0 || end +1 < inode->disk_i_size)) goto cleanup_and_bail_uncompressed;/*
@@ -732,7 +731,7 @@ static noinline int compress_file_range(struct async_chunk *async_chunk)* inode has not been flagged as nocompress. This flag can * change at any time if we discover bad compression ratios. */ -if (inode_need_compress (BTRFS_I (inode), start, end)) { +if (inode_need_compress (inode, start, end)) {WARN_ON (pages); pages =kcalloc (nr_pages,sizeof (struct page *),GFP_NOFS );if (!pages) {
@@ -741,10 +740,10 @@ static noinline int compress_file_range(struct async_chunk *async_chunk) goto cont; } -if (BTRFS_I (inode)->defrag_compress) - compress_type =BTRFS_I (inode)->defrag_compress; -else if (BTRFS_I (inode)->prop_compress) - compress_type =BTRFS_I (inode)->prop_compress; +if (inode->defrag_compress) + compress_type = inode->defrag_compress; +else if (inode->prop_compress) + compress_type = inode->prop_compress;/* * we need to call clear_page_dirty_for_io on each
@@ -759,14 +758,14 @@ static noinline int compress_file_range(struct async_chunk *async_chunk)* has moved, the end is the original one. */ if (!redirty) { -extent_range_clear_dirty_for_io (inode, start, end); +extent_range_clear_dirty_for_io (&inode->vfs_inode, start, end); redirty =1 ; }/* Compression level is applied here and only here */ ret = btrfs_compress_pages( compress_type | (fs_info->compress_level << 4), - inode->i_mapping, start, + inode->vfs_inode.i_mapping, start, pages, &nr_pages, &total_in,
@@ -795,12 +794,12 @@ static noinline int compress_file_range(struct async_chunk *async_chunk)/* we didn't compress the entire range, try * to make an uncompressed inline extent. */ - ret =cow_file_range_inline (BTRFS_I (inode), actual_end, + ret =cow_file_range_inline (inode, actual_end,0 ,BTRFS_COMPRESS_NONE ,NULL , false); }else {/* try making a compressed inline extent */ - ret =cow_file_range_inline (BTRFS_I (inode), actual_end, + ret =cow_file_range_inline (inode, actual_end, total_compressed, compress_type, pages, false);
@@ -823,7 +822,7 @@ static noinline int compress_file_range(struct async_chunk *async_chunk)* our outstanding extent for clearing delalloc for this * range. */ - extent_clear_unlock_delalloc(BTRFS_I(inode), start, end, + extent_clear_unlock_delalloc(inode, start, end, NULL, clear_flags, PAGE_UNLOCK |
@@ -898,8 +897,8 @@ static noinline int compress_file_range(struct async_chunk *async_chunk)/* flag the file so we don't compress in the future */ if (!btrfs_test_opt (fs_info,FORCE_COMPRESS ) && - !(BTRFS_I (inode)->prop_compress)) { -BTRFS_I (inode)->flags |=BTRFS_INODE_NOCOMPRESS ; + !(inode->prop_compress)) { + inode->flags |=BTRFS_INODE_NOCOMPRESS ; } } cleanup_and_bail_uncompressed:
@@ -917,7 +916,7 @@ static noinline int compress_file_range(struct async_chunk *async_chunk) }if (redirty) -extent_range_redirty_for_io (inode, start, end); +extent_range_redirty_for_io (&inode->vfs_inode, start, end);add_async_extent (async_chunk, start, end - start +1 ,0 ,NULL ,0 ,BTRFS_COMPRESS_NONE ); compressed_extents++;
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 39/40 btrfs: use btrfs_inode inside btrfs_verify_data_csum
In reply to David SterbaThe function is mostly using internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/inode.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
fs/btrfs/inode.c +6 -6
@@ -3529,10 +3529,10 @@ unsigned int btrfs_verify_data_csum(struct btrfs_bio *bbio, u32 bio_offset, struct page *page, u64 start, u64 end) { - struct inode *inode = page->mapping->host; -struct btrfs_fs_info *fs_info =btrfs_sb (inode->i_sb); -struct extent_io_tree *io_tree = &BTRFS_I (inode)->io_tree; -struct btrfs_root *root =BTRFS_I (inode)->root; + struct btrfs_inode *inode = BTRFS_I(page->mapping->host); +struct btrfs_root *root = inode->root; +struct btrfs_fs_info *fs_info = root->fs_info; +struct extent_io_tree *io_tree = &inode->io_tree;const u32 sectorsize = root->fs_info->sectorsize;u32 pg_off;unsigned int result =0 ;
@@ -3545,7 +3545,7 @@ unsigned int btrfs_verify_data_csum(struct btrfs_bio *bbio,if (bbio->csum ==NULL )return 0 ; -if (BTRFS_I (inode)->flags &BTRFS_INODE_NODATASUM ) +if (inode->flags &BTRFS_INODE_NODATASUM )return 0 ;if (unlikely (test_bit (BTRFS_FS_STATE_NO_CSUMS , &fs_info->fs_state)))
@@ -3569,7 +3569,7 @@ unsigned int btrfs_verify_data_csum(struct btrfs_bio *bbio, EXTENT_NODATASUM);continue ; } - ret =btrfs_check_data_csum (BTRFS_I (inode), bbio, bio_offset, page, pg_off); + ret =btrfs_check_data_csum (inode, bbio, bio_offset, page, pg_off);if (ret <0 ) {const int nr_bit = (pg_off -offset_in_page (start)) >> root->fs_info->sectorsize_bits;
Signature · 1 line
2.37.3
David Sterba
maintainerPATCH 40/40 btrfs: pass btrfs_inode to btrfs_add_delayed_iput
In reply to David SterbaThe function is for internal interfaces so we should use the btrfs_inode.
--- fs/btrfs/btrfs_inode.h | 2 +- fs/btrfs/extent_io.c | 2 +- fs/btrfs/free-space-cache.c | 4 ++-- fs/btrfs/inode.c | 19 +++++++++---------- fs/btrfs/ordered-data.c | 2 +- fs/btrfs/relocation.c | 4 ++-- fs/btrfs/tree-log.c | 24 ++++++++++++------------ 7 files changed, 28 insertions(+), 29 deletions(-)
fs/btrfs/btrfs_inode.h +1 -1
@@ -501,7 +501,7 @@ int btrfs_update_inode_fallback(struct btrfs_trans_handle *trans,int btrfs_orphan_add (struct btrfs_trans_handle *trans,struct btrfs_inode *inode);int btrfs_orphan_cleanup (struct btrfs_root *root);int btrfs_cont_expand (struct btrfs_inode *inode,loff_t oldsize,loff_t size); -void btrfs_add_delayed_iput (struct inode *inode); +void btrfs_add_delayed_iput (struct btrfs_inode *inode);void btrfs_run_delayed_iputs (struct btrfs_fs_info *fs_info);int btrfs_wait_on_delayed_iputs (struct btrfs_fs_info *fs_info); int btrfs_prealloc_file_range(struct inode *inode, int mode,
fs/btrfs/extent_io.c +1 -1
@@ -3228,7 +3228,7 @@ static int extent_write_cache_pages(struct address_space *mapping,if (wbc->range_cyclic || (wbc->nr_to_write >0 && range_whole)) mapping->writeback_index = done_index; -btrfs_add_delayed_iput (inode); +btrfs_add_delayed_iput (BTRFS_I (inode));return ret; }
fs/btrfs/free-space-cache.c +2 -2
@@ -260,7 +260,7 @@ int btrfs_remove_free_space_inode(struct btrfs_trans_handle *trans, } ret =btrfs_orphan_add (trans,BTRFS_I (inode));if (ret) { -btrfs_add_delayed_iput (inode); +btrfs_add_delayed_iput (BTRFS_I (inode)); goto out; }clear_nlink (inode);
@@ -274,7 +274,7 @@ int btrfs_remove_free_space_inode(struct btrfs_trans_handle *trans,spin_unlock (&block_group->lock); }/* One for the lookup ref */ -btrfs_add_delayed_iput (inode); +btrfs_add_delayed_iput (BTRFS_I (inode)); key.objectid =BTRFS_FREE_SPACE_OBJECTID ; key.type =0 ;
fs/btrfs/inode.c +9 -10
@@ -1493,7 +1493,7 @@ static noinline void async_cow_start(struct btrfs_work *work) compressed_extents =compress_file_range (async_chunk);if (compressed_extents ==0 ) { -btrfs_add_delayed_iput (&async_chunk->inode->vfs_inode); +btrfs_add_delayed_iput (async_chunk->inode); async_chunk->inode =NULL ; } }
@@ -1533,7 +1533,7 @@ static noinline void async_cow_free(struct btrfs_work *work) async_chunk = container_of(work, struct async_chunk, work);if (async_chunk->inode) -btrfs_add_delayed_iput (&async_chunk->inode->vfs_inode); +btrfs_add_delayed_iput (async_chunk->inode);if (async_chunk->blkcg_css)css_put (async_chunk->blkcg_css);
@@ -3016,7 +3016,7 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work)* that could need flushing space. Recursing back to fixup worker would * deadlock. */ -btrfs_add_delayed_iput (&inode->vfs_inode); +btrfs_add_delayed_iput (inode); }/*
@@ -3590,18 +3590,17 @@ unsigned int btrfs_verify_data_csum(struct btrfs_bio *bbio,* the inode to the delayed iput machinery. Delayed iputs are processed at * transaction commit time/superblock commit/cleaner kthread. */ -void btrfs_add_delayed_iput (struct inode *inode) +void btrfs_add_delayed_iput (struct btrfs_inode *inode) { -struct btrfs_fs_info *fs_info =btrfs_sb (inode->i_sb); -struct btrfs_inode *binode =BTRFS_I (inode); +struct btrfs_fs_info *fs_info = inode->root->fs_info; -if (atomic_add_unless (&inode->i_count,-1 ,1 )) +if (atomic_add_unless (&inode->vfs_inode.i_count,-1 ,1 ))return ;atomic_inc (&fs_info->nr_delayed_iputs);spin_lock (&fs_info->delayed_iput_lock); -ASSERT (list_empty (&binode->delayed_iput)); -list_add_tail (&binode->delayed_iput, &fs_info->delayed_iputs); +ASSERT (list_empty (&inode->delayed_iput)); +list_add_tail (&inode->delayed_iput, &fs_info->delayed_iputs);spin_unlock (&fs_info->delayed_iput_lock);if (!test_bit (BTRFS_FS_CLEANER_RUNNING , &fs_info->flags))wake_up_process (fs_info->cleaner_kthread);
@@ -9660,7 +9659,7 @@ static int start_delalloc_inodes(struct btrfs_root *root, &work->work); }else { ret =filemap_fdatawrite_wbc (inode->i_mapping, wbc); -btrfs_add_delayed_iput (inode); +btrfs_add_delayed_iput (BTRFS_I (inode));if (ret || wbc->nr_to_write <=0 ) goto out; }
fs/btrfs/ordered-data.c +1 -1
@@ -504,7 +504,7 @@ void btrfs_put_ordered_extent(struct btrfs_ordered_extent *entry)ASSERT (list_empty (&entry->log_list));ASSERT (RB_EMPTY_NODE (&entry->rb_node));if (entry->inode) -btrfs_add_delayed_iput (entry->inode); +btrfs_add_delayed_iput (BTRFS_I (entry->inode));while (!list_empty (&entry->list)) { cur = entry->list.next; sum = list_entry(cur, struct btrfs_ordered_sum, list);
fs/btrfs/relocation.c +2 -2
@@ -1117,7 +1117,7 @@ int replace_file_extents(struct btrfs_trans_handle *trans, inode =find_next_inode (root, key.objectid); first =0 ; }else if (inode &&btrfs_ino (BTRFS_I (inode)) < key.objectid) { -btrfs_add_delayed_iput (inode); +btrfs_add_delayed_iput (BTRFS_I (inode)); inode =find_next_inode (root, key.objectid); }if (inode &&btrfs_ino (BTRFS_I (inode)) == key.objectid) {
@@ -1181,7 +1181,7 @@ int replace_file_extents(struct btrfs_trans_handle *trans,if (dirty)btrfs_mark_buffer_dirty (leaf);if (inode) -btrfs_add_delayed_iput (inode); +btrfs_add_delayed_iput (BTRFS_I (inode));return ret; }
fs/btrfs/tree-log.c +12 -12
@@ -5422,7 +5422,7 @@ static int log_new_dir_dentries(struct btrfs_trans_handle *trans, }if (!need_log_inode (trans,BTRFS_I (di_inode))) { -btrfs_add_delayed_iput (di_inode); +btrfs_add_delayed_iput (BTRFS_I (di_inode));break ; }
@@ -5431,7 +5431,7 @@ static int log_new_dir_dentries(struct btrfs_trans_handle *trans, log_mode =LOG_INODE_ALL ; ret =btrfs_log_inode (trans,BTRFS_I (di_inode), log_mode, ctx); -btrfs_add_delayed_iput (di_inode); +btrfs_add_delayed_iput (BTRFS_I (di_inode));if (ret) goto out;if (ctx->log_new_dentries) {
@@ -5625,11 +5625,11 @@ static int add_conflicting_inode(struct btrfs_trans_handle *trans,* so that the log ends up with the new name and without the old name. */ if (!need_log_inode (trans,BTRFS_I (inode))) { -btrfs_add_delayed_iput (inode); +btrfs_add_delayed_iput (BTRFS_I (inode));return 0 ; } -btrfs_add_delayed_iput (inode); +btrfs_add_delayed_iput (BTRFS_I (inode)); ino_elem =kmalloc (sizeof (*ino_elem),GFP_NOFS );if (!ino_elem)
@@ -5704,7 +5704,7 @@ static int log_conflicting_inodes(struct btrfs_trans_handle *trans,*/ ret =btrfs_log_inode (trans,BTRFS_I (inode),LOG_INODE_ALL , ctx); -btrfs_add_delayed_iput (inode); +btrfs_add_delayed_iput (BTRFS_I (inode));if (ret)break ;continue ;
@@ -5721,7 +5721,7 @@ static int log_conflicting_inodes(struct btrfs_trans_handle *trans,* that, we can avoid doing it again. */ if (!need_log_inode (trans,BTRFS_I (inode))) { -btrfs_add_delayed_iput (inode); +btrfs_add_delayed_iput (BTRFS_I (inode));continue ; }
@@ -5733,7 +5733,7 @@ static int log_conflicting_inodes(struct btrfs_trans_handle *trans,* log with the new name before we unpin it. */ ret =btrfs_log_inode (trans,BTRFS_I (inode),LOG_INODE_EXISTS , ctx); -btrfs_add_delayed_iput (inode); +btrfs_add_delayed_iput (BTRFS_I (inode));if (ret)break ; }
@@ -6243,7 +6243,7 @@ static int log_new_delayed_dentries(struct btrfs_trans_handle *trans, }if (!need_log_inode (trans,BTRFS_I (di_inode))) { -btrfs_add_delayed_iput (di_inode); +btrfs_add_delayed_iput (BTRFS_I (di_inode));continue ; }
@@ -6256,7 +6256,7 @@ static int log_new_delayed_dentries(struct btrfs_trans_handle *trans,if (!ret && ctx->log_new_dentries) ret =log_new_dir_dentries (trans,BTRFS_I (di_inode), ctx); -btrfs_add_delayed_iput (di_inode); +btrfs_add_delayed_iput (BTRFS_I (di_inode));if (ret)break ;
@@ -6717,7 +6717,7 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans, }if (!need_log_inode (trans,BTRFS_I (dir_inode))) { -btrfs_add_delayed_iput (dir_inode); +btrfs_add_delayed_iput (BTRFS_I (dir_inode));continue ; }
@@ -6727,7 +6727,7 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans,if (!ret && ctx->log_new_dentries) ret =log_new_dir_dentries (trans,BTRFS_I (dir_inode), ctx); -btrfs_add_delayed_iput (dir_inode); +btrfs_add_delayed_iput (BTRFS_I (dir_inode));if (ret) goto out; }
@@ -6772,7 +6772,7 @@ static int log_new_ancestors(struct btrfs_trans_handle *trans, need_log_inode(trans, BTRFS_I(inode))) ret =btrfs_log_inode (trans,BTRFS_I (inode),LOG_INODE_EXISTS , ctx); -btrfs_add_delayed_iput (inode); +btrfs_add_delayed_iput (BTRFS_I (inode));if (ret)return ret;
Signature · 1 line
2.37.3
Quoted 9 lines · David Sterba
Many patches but also quite short, switching struct inode to struct
btrfs_nodefor structures and related functions in the io path, removing some indirect function calls and typedefs.David Sterba (40):
btrfs: change how repair action is passed tobtrfs_repair_one_sector
btrfs: drop parametercompression_typefrom
btrfs_submit_dio_repair_bio
btrfs: change how submit bio callback is passed tobtrfs_wq_submit_bio
[patch 04/40]
Quoted 31 lines
btrfs: simplify
btree_submit_bio_startandbtrfs_submit_bio_start
parametersbtrfs: switch
async_submit_bio::inodetobtrfs_inode
btrfs: passbtrfs_inodetobtrfs_submit_bio_start
btrfs: passbtrfs_inodetobtrfs_submit_bio_start_direct_io
btrfs: passbtrfs_inodetobtrfs_wq_submit_bio
btrfs: passbtrfs_inodetobtrfs_submit_metadata_bio
btrfs: passbtrfs_inodetobtrfs_submit_data_write_bio
btrfs: passbtrfs_inodetobtrfs_submit_data_read_bio
btrfs: passbtrfs_inodetobtrfs_submit_dio_repair_bio
btrfs: passbtrfs_inodetosubmit_one_bio
btrfs: passbtrfs_inodetobtrfs_repair_one_sector
btrfs: switchbtrfs_dio_private::inodetobtrfs_inode
btrfs: passbtrfs_inodetobtrfs_submit_dio_bio
btrfs: passbtrfs_inodetobtrfs_truncate
btrfs: passbtrfs_inodetobtrfs_inode_lock
btrfs: passbtrfs_inodetobtrfs_inode_unlock
btrfs: passbtrfs_inodetobtrfs_dirty_inode
btrfs: passbtrfs_inodetobtrfs_add_delalloc_inodes
btrfs: switchbtrfs_writepage_fixup::inodetobtrfs_inode
btrfs: passbtrfs_inodetobtrfs_check_data_csum
btrfs: passbtrfs_inodeto__unlink_start_trans
btrfs: passbtrfs_inodetobtrfs_delete_subvolume
btrfs: dropprivate_dataparameter fromextent_io_tree_init
btrfs: switchextent_io_tree::private_datatobtrfs_inodeand rename
btrfs: passbtrfs_inodetobtrfs_merge_delalloc_extent
btrfs: passbtrfs_inodetobtrfs_set_delalloc_extent
btrfs: passbtrfs_inodetobtrfs_split_delalloc_extent
btrfs: passbtrfs_inodetobtrfs_clear_delalloc_extent
btrfs: passbtrfs_inodetobtrfs_unlink_subvol
Quoted 8 lines
btrfs: pass
btrfs_inodetobtrfs_inode_by_name
btrfs: passbtrfs_inodetofixup_tree_root_location
btrfs: passbtrfs_inodetoinode_tree_add
btrfs: passbtrfs_inodetobtrfs_inherit_iflags
btrfs: switchasync_chunk::inodetobtrfs_inode
btrfs: usebtrfs_inodeinsidecompress_file_range
btrfs: usebtrfs_inodeinsidebtrfs_verify_data_csum
btrfs: passbtrfs_inodetobtrfs_add_delayed_iput
With patch 04/40 fixed.
For the series.
Just a note, the naming convention for the local variables... as inode represents struct btrfs_inode, we shouldn't use the same name for struct inode. Instead, vfs_inode is better. And binode is gone.
Thanks, Anand
Quoted 25 lines
fs/btrfs/btrfs_inode.h | 29 +- fs/btrfs/compression.c | 6 +- fs/btrfs/defrag.c | 12 +- fs/btrfs/delayed-inode.c | 4 +- fs/btrfs/disk-io.c | 52 ++-- fs/btrfs/disk-io.h | 15 +- fs/btrfs/extent-io-tree.c | 35 ++- fs/btrfs/extent-io-tree.h | 6 +- fs/btrfs/extent_io.c | 35 +-- fs/btrfs/extent_io.h | 11 +- fs/btrfs/file.c | 48 ++-- fs/btrfs/free-space-cache.c | 4 +- fs/btrfs/inode.c | 445 +++++++++++++++---------------- fs/btrfs/ioctl.c | 10 +- fs/btrfs/ordered-data.c | 2 +- fs/btrfs/reflink.c | 4 +- fs/btrfs/relocation.c | 11 +- fs/btrfs/tests/btrfs-tests.c | 2 +- fs/btrfs/tests/extent-io-tests.c | 4 +- fs/btrfs/transaction.c | 4 +- fs/btrfs/tree-log.c | 24 +- fs/btrfs/volumes.c | 3 +- include/trace/events/btrfs.h | 27 +- 23 files changed, 393 insertions(+), 400 deletions(-)
Quoted 6 lines · Anand Jain
On 02/11/2022 04:11, David Sterba wrote:
For the series.Just a note, the naming convention for the local variables... as inode represents struct
btrfs_inode, we shouldn't use the same name for struct inode. Instead,vfs_inodeis better. And binode is gone.
Yeah the naming could be done like that. Some functions interact only with inode so I won't mind using that name but in case there are both it would be better to use the vfs_ prefix.