linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Btrfs: remove unused delalloc_end parameter
@ 2017-03-06 23:32 fdmanana
  2017-03-07 16:05 ` David Sterba
  0 siblings, 1 reply; 4+ messages in thread
From: fdmanana @ 2017-03-06 23:32 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

The delalloc_end parameter for extent_clear_unlock_delalloc() is never
used, and only making the code for all callers longer and more complex.
Just remove it.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/extent_io.c |  2 +-
 fs/btrfs/extent_io.h |  2 +-
 fs/btrfs/inode.c     | 32 +++++++++++++-------------------
 3 files changed, 15 insertions(+), 21 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 28e8192..2cce08b 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1760,7 +1760,7 @@ static int __process_pages_contig(struct address_space *mapping,
 }
 
 void extent_clear_unlock_delalloc(struct inode *inode, u64 start, u64 end,
-				 u64 delalloc_end, struct page *locked_page,
+				 struct page *locked_page,
 				 unsigned clear_bits,
 				 unsigned long page_ops)
 {
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index 3e4fad4..b12f4db 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -452,7 +452,7 @@ int map_private_extent_buffer(struct extent_buffer *eb, unsigned long offset,
 void extent_range_clear_dirty_for_io(struct inode *inode, u64 start, u64 end);
 void extent_range_redirty_for_io(struct inode *inode, u64 start, u64 end);
 void extent_clear_unlock_delalloc(struct inode *inode, u64 start, u64 end,
-				 u64 delalloc_end, struct page *locked_page,
+				 struct page *locked_page,
 				 unsigned bits_to_clear,
 				 unsigned long page_ops);
 struct bio *
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index b2bc07a..07bee7d 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -106,7 +106,7 @@ static int btrfs_truncate(struct inode *inode);
 static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent);
 static noinline int cow_file_range(struct inode *inode,
 				   struct page *locked_page,
-				   u64 start, u64 end, u64 delalloc_end,
+				   u64 start, u64 end,
 				   int *page_started, unsigned long *nr_written,
 				   int unlock, struct btrfs_dedupe_hash *hash);
 static struct extent_map *create_io_em(struct inode *inode, u64 start, u64 len,
@@ -558,7 +558,7 @@ static noinline void compress_file_range(struct inode *inode,
 			 * we don't need to create any more async work items.
 			 * Unlock and free up our temp pages.
 			 */
-			extent_clear_unlock_delalloc(inode, start, end, end,
+			extent_clear_unlock_delalloc(inode, start, end,
 						     NULL, clear_flags,
 						     PAGE_UNLOCK |
 						     PAGE_CLEAR_DIRTY |
@@ -713,8 +713,6 @@ static noinline void submit_compressed_extents(struct inode *inode,
 					     async_extent->start,
 					     async_extent->start +
 					     async_extent->ram_size - 1,
-					     async_extent->start +
-					     async_extent->ram_size - 1,
 					     &page_started, &nr_written, 0,
 					     NULL);
 
@@ -810,8 +808,6 @@ static noinline void submit_compressed_extents(struct inode *inode,
 		extent_clear_unlock_delalloc(inode, async_extent->start,
 				async_extent->start +
 				async_extent->ram_size - 1,
-				async_extent->start +
-				async_extent->ram_size - 1,
 				NULL, EXTENT_LOCKED | EXTENT_DELALLOC,
 				PAGE_UNLOCK | PAGE_CLEAR_DIRTY |
 				PAGE_SET_WRITEBACK);
@@ -831,7 +827,7 @@ static noinline void submit_compressed_extents(struct inode *inode,
 			tree->ops->writepage_end_io_hook(p, start, end,
 							 NULL, 0);
 			p->mapping = NULL;
-			extent_clear_unlock_delalloc(inode, start, end, end,
+			extent_clear_unlock_delalloc(inode, start, end,
 						     NULL, 0,
 						     PAGE_END_WRITEBACK |
 						     PAGE_SET_ERROR);
@@ -849,8 +845,6 @@ static noinline void submit_compressed_extents(struct inode *inode,
 	extent_clear_unlock_delalloc(inode, async_extent->start,
 				     async_extent->start +
 				     async_extent->ram_size - 1,
-				     async_extent->start +
-				     async_extent->ram_size - 1,
 				     NULL, EXTENT_LOCKED | EXTENT_DELALLOC |
 				     EXTENT_DEFRAG | EXTENT_DO_ACCOUNTING,
 				     PAGE_UNLOCK | PAGE_CLEAR_DIRTY |
@@ -908,7 +902,7 @@ static u64 get_extent_allocation_hint(struct inode *inode, u64 start,
  */
 static noinline int cow_file_range(struct inode *inode,
 				   struct page *locked_page,
-				   u64 start, u64 end, u64 delalloc_end,
+				   u64 start, u64 end,
 				   int *page_started, unsigned long *nr_written,
 				   int unlock, struct btrfs_dedupe_hash *hash)
 {
@@ -942,7 +936,7 @@ static noinline int cow_file_range(struct inode *inode,
 					BTRFS_COMPRESS_NONE, NULL);
 		if (ret == 0) {
 			extent_clear_unlock_delalloc(inode, start, end,
-				     delalloc_end, NULL,
+				     NULL,
 				     EXTENT_LOCKED | EXTENT_DELALLOC |
 				     EXTENT_DEFRAG, PAGE_UNLOCK |
 				     PAGE_CLEAR_DIRTY | PAGE_SET_WRITEBACK |
@@ -1019,7 +1013,7 @@ static noinline int cow_file_range(struct inode *inode,
 
 		extent_clear_unlock_delalloc(inode, start,
 					     start + ram_size - 1,
-					     delalloc_end, locked_page,
+					     locked_page,
 					     EXTENT_LOCKED | EXTENT_DELALLOC,
 					     op);
 		disk_num_bytes -= cur_alloc_size;
@@ -1036,7 +1030,7 @@ static noinline int cow_file_range(struct inode *inode,
 	btrfs_dec_block_group_reservations(fs_info, ins.objectid);
 	btrfs_free_reserved_extent(fs_info, ins.objectid, ins.offset, 1);
 out_unlock:
-	extent_clear_unlock_delalloc(inode, start, end, delalloc_end,
+	extent_clear_unlock_delalloc(inode, start, end,
 				     locked_page,
 				     EXTENT_LOCKED | EXTENT_DO_ACCOUNTING |
 				     EXTENT_DELALLOC | EXTENT_DEFRAG,
@@ -1212,7 +1206,7 @@ static noinline int run_delalloc_nocow(struct inode *inode,
 
 	path = btrfs_alloc_path();
 	if (!path) {
-		extent_clear_unlock_delalloc(inode, start, end, end,
+		extent_clear_unlock_delalloc(inode, start, end,
 					     locked_page,
 					     EXTENT_LOCKED | EXTENT_DELALLOC |
 					     EXTENT_DO_ACCOUNTING |
@@ -1366,7 +1360,7 @@ static noinline int run_delalloc_nocow(struct inode *inode,
 		if (cow_start != (u64)-1) {
 			ret = cow_file_range(inode, locked_page,
 					     cow_start, found_key.offset - 1,
-					     end, page_started, nr_written, 1,
+					     page_started, nr_written, 1,
 					     NULL);
 			if (ret) {
 				if (!nolock && nocow)
@@ -1425,7 +1419,7 @@ static noinline int run_delalloc_nocow(struct inode *inode,
 		}
 
 		extent_clear_unlock_delalloc(inode, cur_offset,
-					     cur_offset + num_bytes - 1, end,
+					     cur_offset + num_bytes - 1,
 					     locked_page, EXTENT_LOCKED |
 					     EXTENT_DELALLOC |
 					     EXTENT_CLEAR_DATA_RESV,
@@ -1445,7 +1439,7 @@ static noinline int run_delalloc_nocow(struct inode *inode,
 	}
 
 	if (cow_start != (u64)-1) {
-		ret = cow_file_range(inode, locked_page, cow_start, end, end,
+		ret = cow_file_range(inode, locked_page, cow_start, end,
 				     page_started, nr_written, 1, NULL);
 		if (ret)
 			goto error;
@@ -1453,7 +1447,7 @@ static noinline int run_delalloc_nocow(struct inode *inode,
 
 error:
 	if (ret && cur_offset < end)
-		extent_clear_unlock_delalloc(inode, cur_offset, end, end,
+		extent_clear_unlock_delalloc(inode, cur_offset, end,
 					     locked_page, EXTENT_LOCKED |
 					     EXTENT_DELALLOC | EXTENT_DEFRAG |
 					     EXTENT_DO_ACCOUNTING, PAGE_UNLOCK |
@@ -1501,7 +1495,7 @@ static int run_delalloc_range(struct inode *inode, struct page *locked_page,
 		ret = run_delalloc_nocow(inode, locked_page, start, end,
 					 page_started, 0, nr_written);
 	} else if (!inode_need_compress(inode)) {
-		ret = cow_file_range(inode, locked_page, start, end, end,
+		ret = cow_file_range(inode, locked_page, start, end,
 				      page_started, nr_written, 1, NULL);
 	} else {
 		set_bit(BTRFS_INODE_HAS_ASYNC_EXTENT,
-- 
2.7.0.rc3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] Btrfs: remove unused delalloc_end parameter
  2017-03-06 23:32 [PATCH 1/2] Btrfs: remove unused delalloc_end parameter fdmanana
@ 2017-03-07 16:05 ` David Sterba
  2017-03-07 18:35   ` Filipe Manana
  0 siblings, 1 reply; 4+ messages in thread
From: David Sterba @ 2017-03-07 16:05 UTC (permalink / raw)
  To: fdmanana; +Cc: linux-btrfs

On Mon, Mar 06, 2017 at 11:32:47PM +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> The delalloc_end parameter for extent_clear_unlock_delalloc() is never
> used, and only making the code for all callers longer and more complex.
> Just remove it.

It's been added on purpose

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=dda3245eca18c73413a854a834c41fc770feb0dd

"btrfs: expand cow_file_range() to support in-band dedup and
subpage-blocksize"

so we can merge both mentioned patchsets for testing.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] Btrfs: remove unused delalloc_end parameter
  2017-03-07 16:05 ` David Sterba
@ 2017-03-07 18:35   ` Filipe Manana
  2017-03-09 12:35     ` David Sterba
  0 siblings, 1 reply; 4+ messages in thread
From: Filipe Manana @ 2017-03-07 18:35 UTC (permalink / raw)
  To: dsterba@suse.cz, Filipe Manana, linux-btrfs@vger.kernel.org

On Tue, Mar 7, 2017 at 4:05 PM, David Sterba <dsterba@suse.cz> wrote:
> On Mon, Mar 06, 2017 at 11:32:47PM +0000, fdmanana@kernel.org wrote:
>> From: Filipe Manana <fdmanana@suse.com>
>>
>> The delalloc_end parameter for extent_clear_unlock_delalloc() is never
>> used, and only making the code for all callers longer and more complex.
>> Just remove it.
>
> It's been added on purpose
>
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=dda3245eca18c73413a854a834c41fc770feb0dd
>
> "btrfs: expand cow_file_range() to support in-band dedup and
> subpage-blocksize"
>
> so we can merge both mentioned patchsets for testing.

I definitely missed that. To be honest I was finding it strange that
none of the usual cleanup fanatics noticed it before.

Anyway I'm sending a v2 of the 2nd patch so that it works correctly on
top of Qu's patchset that I reviewed recently. I've added Qu's patches
to my 4.11 integration branch just so that I could work on top of
them, feel free to pick stuff from there if convenient or ignore
otherwise.

Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] Btrfs: remove unused delalloc_end parameter
  2017-03-07 18:35   ` Filipe Manana
@ 2017-03-09 12:35     ` David Sterba
  0 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2017-03-09 12:35 UTC (permalink / raw)
  To: Filipe Manana; +Cc: dsterba@suse.cz, linux-btrfs@vger.kernel.org

On Tue, Mar 07, 2017 at 06:35:02PM +0000, Filipe Manana wrote:
> On Tue, Mar 7, 2017 at 4:05 PM, David Sterba <dsterba@suse.cz> wrote:
> > On Mon, Mar 06, 2017 at 11:32:47PM +0000, fdmanana@kernel.org wrote:
> >> From: Filipe Manana <fdmanana@suse.com>
> >>
> >> The delalloc_end parameter for extent_clear_unlock_delalloc() is never
> >> used, and only making the code for all callers longer and more complex.
> >> Just remove it.
> >
> > It's been added on purpose
> >
> > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=dda3245eca18c73413a854a834c41fc770feb0dd
> >
> > "btrfs: expand cow_file_range() to support in-band dedup and
> > subpage-blocksize"
> >
> > so we can merge both mentioned patchsets for testing.
> 
> I definitely missed that. To be honest I was finding it strange that
> none of the usual cleanup fanatics noticed it before.

I was disappointed for a minute that I couldn't remove it, you bet.

> Anyway I'm sending a v2 of the 2nd patch so that it works correctly on
> top of Qu's patchset that I reviewed recently. I've added Qu's patches
> to my 4.11 integration branch just so that I could work on top of
> them, feel free to pick stuff from there if convenient or ignore
> otherwise.

Let's keep it in your branch then.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-09 12:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-06 23:32 [PATCH 1/2] Btrfs: remove unused delalloc_end parameter fdmanana
2017-03-07 16:05 ` David Sterba
2017-03-07 18:35   ` Filipe Manana
2017-03-09 12:35     ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).