mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-28 16:56:26 +00:00
btrfs: drop transaction parameter from btrfs_add_inode_defrag()
There's only one caller inode_should_defrag() that passes NULL to btrfs_add_inode_defrag() so we can drop it an simplify the code. Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
91c9f2855e
commit
11e3107d47
@ -120,13 +120,11 @@ static inline int need_auto_defrag(struct btrfs_fs_info *fs_info)
|
||||
* Insert a defrag record for this inode if auto defrag is enabled. No errors
|
||||
* returned as they're not considered fatal.
|
||||
*/
|
||||
void btrfs_add_inode_defrag(struct btrfs_trans_handle *trans,
|
||||
struct btrfs_inode *inode, u32 extent_thresh)
|
||||
void btrfs_add_inode_defrag(struct btrfs_inode *inode, u32 extent_thresh)
|
||||
{
|
||||
struct btrfs_root *root = inode->root;
|
||||
struct btrfs_fs_info *fs_info = root->fs_info;
|
||||
struct inode_defrag *defrag;
|
||||
u64 transid;
|
||||
int ret;
|
||||
|
||||
if (!need_auto_defrag(fs_info))
|
||||
@ -135,17 +133,12 @@ void btrfs_add_inode_defrag(struct btrfs_trans_handle *trans,
|
||||
if (test_bit(BTRFS_INODE_IN_DEFRAG, &inode->runtime_flags))
|
||||
return;
|
||||
|
||||
if (trans)
|
||||
transid = trans->transid;
|
||||
else
|
||||
transid = btrfs_get_root_last_trans(root);
|
||||
|
||||
defrag = kmem_cache_zalloc(btrfs_inode_defrag_cachep, GFP_NOFS);
|
||||
if (!defrag)
|
||||
return;
|
||||
|
||||
defrag->ino = btrfs_ino(inode);
|
||||
defrag->transid = transid;
|
||||
defrag->transid = btrfs_get_root_last_trans(root);
|
||||
defrag->root = btrfs_root_id(root);
|
||||
defrag->extent_thresh = extent_thresh;
|
||||
|
||||
|
@ -18,8 +18,7 @@ int btrfs_defrag_file(struct inode *inode, struct file_ra_state *ra,
|
||||
u64 newer_than, unsigned long max_to_defrag);
|
||||
int __init btrfs_auto_defrag_init(void);
|
||||
void __cold btrfs_auto_defrag_exit(void);
|
||||
void btrfs_add_inode_defrag(struct btrfs_trans_handle *trans,
|
||||
struct btrfs_inode *inode, u32 extent_thresh);
|
||||
void btrfs_add_inode_defrag(struct btrfs_inode *inode, u32 extent_thresh);
|
||||
int btrfs_run_defrag_inodes(struct btrfs_fs_info *fs_info);
|
||||
void btrfs_cleanup_defrag_inodes(struct btrfs_fs_info *fs_info);
|
||||
int btrfs_defrag_root(struct btrfs_root *root);
|
||||
|
@ -885,7 +885,7 @@ static inline void inode_should_defrag(struct btrfs_inode *inode,
|
||||
/* If this is a small write inside eof, kick off a defrag */
|
||||
if (num_bytes < small_write &&
|
||||
(start > 0 || end + 1 < inode->disk_i_size))
|
||||
btrfs_add_inode_defrag(NULL, inode, small_write);
|
||||
btrfs_add_inode_defrag(inode, small_write);
|
||||
}
|
||||
|
||||
static int extent_range_clear_dirty_for_io(struct inode *inode, u64 start, u64 end)
|
||||
|
Loading…
Reference in New Issue
Block a user