Skip to contentSkip to conversation

btrfs: Make first argument of btrfs_run_delalloc_range directly an inode

PATCH In review Nikolay Borisov 2 participants 3 messages Dec 19, 2018 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: Make first argument of btrfs_run_delalloc_range directly an inode

Since this function is no longer a callback there is no need to have its first argument obfuscated with a void *. Change it directly to a pointer to an inode. No functional changes.

---
David,

This little fixlet could be folded in
6907b1c2ac72 ("btrfs: Remove extent_io_ops::fill_delalloc") if it's not too late.

This could be folded to

 fs/btrfs/ctree.h | 2 +-
 fs/btrfs/inode.c | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
fs/btrfs/ctree.h +1 -1
index 2dc94698c2fa..f681c49a46b5 100644
@@ -3256,7 +3256,7 @@ int btrfs_prealloc_file_range_trans(struct inode *inode,
 				    struct btrfs_trans_handle *trans, int mode,
 				    u64 start, u64 num_bytes, u64 min_size,
 				    loff_t actual_len, u64 *alloc_hint);
-int btrfs_run_delalloc_range(void *private_data, struct page *locked_page,
+int btrfs_run_delalloc_rangei(struct inode *inode, struct page *locked_page,
 		u64 start, u64 end, int *page_started, unsigned long *nr_written,
 		struct writeback_control *wbc);
 int btrfs_writepage_cow_fixup(struct page *page, u64 start, u64 end);
fs/btrfs/inode.c +1 -2
index 0b9855c2df21..63ad72c48ace 100644
@@ -1586,11 +1586,10 @@ static inline int need_force_cow(struct inode *inode, u64 start, u64 end)
  * Function to process delayed allocation (create CoW) for ranges which are
  * being touched for the first time.
  */
-int btrfs_run_delalloc_range(void *private_data, struct page *locked_page,
+int btrfs_run_delalloc_range(struct inode *inode, struct page *locked_page,
 		u64 start, u64 end, int *page_started, unsigned long *nr_written,
 		struct writeback_control *wbc)
 {
-	struct inode *inode = private_data;
 	int ret;
 	int force_cow = need_force_cow(inode, start, end);
 	unsigned int write_flags = wbc_to_write_flags(wbc);
Signature · 1 line
2.17.1
#1 lore raw
Quoted 23 lines · Nikolay Borisov

Since this function is no longer a callback there is no need to have its first argument obfuscated with a void *. Change it directly to a pointer to an inode. No functional changes.

---
David,

This little fixlet could be folded in
6907b1c2ac72 ("btrfs: Remove extent_io_ops::fill_delalloc") if it's not too late.

This could be folded to

 fs/btrfs/ctree.h | 2 +-
 fs/btrfs/inode.c | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
fs/btrfs/ctree.h +0 -0
index 2dc94698c2fa..f681c49a46b5 100644

fs/btrfs/ctree.h int btrfs_prealloc_file_range_trans(struct inode *inode, · line 3259

Quoted 5 lines
fs/btrfs/ctree.h +1 -1
@@ -3256,7 +3256,7 @@ int btrfs_prealloc_file_range_trans(struct inode *inode,
 				    struct btrfs_trans_handle *trans, int mode,
 				    u64 start, u64 num_bytes, u64 min_size,
 				    loff_t actual_len, u64 *alloc_hint);
-int btrfs_run_delalloc_range(void *private_data, struct page *locked_page,
+int btrfs_run_delalloc_rangei(struct inode *inode, struct page *locked_page,
                               ^^

This 'i' is an artefact of my vim disregard it when merging.

Quoted 21 lines
fs/btrfs/ctree.h +0 -0
 		u64 start, u64 end, int *page_started, unsigned long *nr_written,
 		struct writeback_control *wbc);
 int btrfs_writepage_cow_fixup(struct page *page, u64 start, u64 end);
fs/btrfs/inode.c +1 -2
index 0b9855c2df21..63ad72c48ace 100644
@@ -1586,11 +1586,10 @@ static inline int need_force_cow(struct inode *inode, u64 start, u64 end)
  * Function to process delayed allocation (create CoW) for ranges which are
  * being touched for the first time.
  */
-int btrfs_run_delalloc_range(void *private_data, struct page *locked_page,
+int btrfs_run_delalloc_range(struct inode *inode, struct page *locked_page,
 		u64 start, u64 end, int *page_started, unsigned long *nr_written,
 		struct writeback_control *wbc)
 {
-	struct inode *inode = private_data;
 	int ret;
 	int force_cow = need_force_cow(inode, start, end);
 	unsigned int write_flags = wbc_to_write_flags(wbc);
#2 lore raw
In reply to Nikolay Borisov
Quoted 11 lines · Nikolay Borisov

Since this function is no longer a callback there is no need to have its first argument obfuscated with a void *. Change it directly to a pointer to an inode. No functional changes.

---
David,

This little fixlet could be folded in
6907b1c2ac72 ("btrfs: Remove extent_io_ops::fill_delalloc") if it's not too late.

It is too late. The patch to fix is deep in the pull rquest branch, I'd do such updates not less than a week before sending a pull request and certainly not on the day I'm about to do so. Qeued for 4.22.