Re: [PATCH] Btrfs: disk-io: replace root args iff only fs_info used

2014-11-21 Thread David Sterba
On Sat, Nov 22, 2014 at 01:37:10AM +0900, Daniel Dressler wrote:
> What would a cover letter be like? Would that be a separate email to
> the list, or maybe the first email in a patch series?

It's a separate mail that does not carry any diff but an overview of
the following patches. The patches are threaded under that mail. This is
what the git command does for you:

  git format-patch -o output --thread --cover-letter from..to

and in the directory 'output' you'll find the cover letter plus patches.
The cover contains some stub and should be edited.  Then send them via
'git send-email'.

> Sorry I've twice looked for the integration repo. I found some that
> look like it could be but those had older commits. Could you direct me
> to the exact branch I'd love to work against it. These patches were
> done against linux-next.

The integration is in Chris' git, but the branch may not be the most
recent compared to Linus' tree or the pending for-linus branches. This
depens on the phase of the development cycle or the stability of the
patches in the integration branch as it's supposed to be base of the
next pull.

What you did is fine under current conditions. If the integration is
made public you can check if your patches are merged or not and then
refresh the patch series eventually.

> I think small one function patches might be best. I have the codebase
> mapped out and each file's functions-to-be-cleaned count varies
> wildly. If I did batch files together and split large files apart
> there would be no rhyme or reason for the groupings. With single
> function patches it is very clear what changes are justified since
> they should only occur in the affected function or in a call-site.
> With multiple functions the call-site changes get mixed up would it
> would be harder to review.

Up to you.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Btrfs: disk-io: replace root args iff only fs_info used

2014-11-21 Thread Daniel Dressler
Thank you David this is helpful feedback.

What would a cover letter be like? Would that be a separate email to
the list, or maybe the first email in a patch series?

Sorry I've twice looked for the integration repo. I found some that
look like it could be but those had older commits. Could you direct me
to the exact branch I'd love to work against it. These patches were
done against linux-next.

I think small one function patches might be best. I have the codebase
mapped out and each file's functions-to-be-cleaned count varies
wildly. If I did batch files together and split large files apart
there would be no rhyme or reason for the groupings. With single
function patches it is very clear what changes are justified since
they should only occur in the affected function or in a call-site.
With multiple functions the call-site changes get mixed up would it
would be harder to review.

Daniel


2014-11-22 1:15 GMT+09:00 David Sterba :
> On Fri, Nov 21, 2014 at 05:15:07PM +0900, Daniel Dressler wrote:
>> This is the 3rd independent patch of a larger
>> project to cleanup btrfs's internal usage of
>> btrfs_root. Many functions take btrfs_root
>> only to grab the fs_info struct.
>>
>> By requiring a root these functions cause
>> programmer overhead. That these functions can
>> accept any valid root is not obvious until
>> inspection.
>>
>> This patch reduces the specificity of such
>> functions to accept the fs_info directly.
>>
>> These patches can be applied independently
>> and thus are not being submitted as a patch
>> series. There should be about 26 patches by
>> the project's completion. Each patch will
>> cleanup between 1 and 34 functions apiece.
>> Each patch covers a single file's functions.
>
> It's good to have this kind of introduction but it really belongs ot the
> cover letter not the individual patches.
>>
>> This patch affects the following function(s):
>>   1) csum_tree_block
>>   2) csum_dirty_buffer
>>   3) check_tree_block_fsid
>>   4) btrfs_find_tree_block
>>   5) clean_tree_block
>
> Now that I see that, I'm not sure that my previous comment about 'one
> patch per function' is the right way to go. This patch looks good as it
> stands. The change is simple enough that I won't be opposed to grouping
> even more functions together as long as it stays revieweable.
>
> The patches are likely to clash with a lot of pending patches, so you
> may want to base it on the integration branch next time. This would make
> maintainers' life easier and also raises chances to merge the patches.
>
> Reviewed-by: David Sterba 
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Btrfs: disk-io: replace root args iff only fs_info used

2014-11-21 Thread David Sterba
On Fri, Nov 21, 2014 at 05:15:07PM +0900, Daniel Dressler wrote:
> This is the 3rd independent patch of a larger
> project to cleanup btrfs's internal usage of
> btrfs_root. Many functions take btrfs_root
> only to grab the fs_info struct.
> 
> By requiring a root these functions cause
> programmer overhead. That these functions can
> accept any valid root is not obvious until
> inspection.
> 
> This patch reduces the specificity of such
> functions to accept the fs_info directly.
> 
> These patches can be applied independently
> and thus are not being submitted as a patch
> series. There should be about 26 patches by
> the project's completion. Each patch will
> cleanup between 1 and 34 functions apiece.
> Each patch covers a single file's functions.

It's good to have this kind of introduction but it really belongs ot the
cover letter not the individual patches.
> 
> This patch affects the following function(s):
>   1) csum_tree_block
>   2) csum_dirty_buffer
>   3) check_tree_block_fsid
>   4) btrfs_find_tree_block
>   5) clean_tree_block

Now that I see that, I'm not sure that my previous comment about 'one
patch per function' is the right way to go. This patch looks good as it
stands. The change is simple enough that I won't be opposed to grouping
even more functions together as long as it stays revieweable.

The patches are likely to clash with a lot of pending patches, so you
may want to base it on the integration branch next time. This would make
maintainers' life easier and also raises chances to merge the patches.

Reviewed-by: David Sterba 
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Btrfs: disk-io: replace root args iff only fs_info used

2014-11-21 Thread Daniel Dressler
This is the 3rd independent patch of a larger
project to cleanup btrfs's internal usage of
btrfs_root. Many functions take btrfs_root
only to grab the fs_info struct.

By requiring a root these functions cause
programmer overhead. That these functions can
accept any valid root is not obvious until
inspection.

This patch reduces the specificity of such
functions to accept the fs_info directly.

These patches can be applied independently
and thus are not being submitted as a patch
series. There should be about 26 patches by
the project's completion. Each patch will
cleanup between 1 and 34 functions apiece.
Each patch covers a single file's functions.

This patch affects the following function(s):
  1) csum_tree_block
  2) csum_dirty_buffer
  3) check_tree_block_fsid
  4) btrfs_find_tree_block
  5) clean_tree_block

Signed-off-by: Daniel Dressler 
---
 fs/btrfs/ctree.c   | 26 +-
 fs/btrfs/disk-io.c | 32 
 fs/btrfs/disk-io.h |  4 ++--
 fs/btrfs/extent-tree.c |  6 +++---
 4 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 19bc616..e76a6ba 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1075,7 +1075,7 @@ static noinline int update_ref_for_cow(struct 
btrfs_trans_handle *trans,
ret = btrfs_dec_ref(trans, root, buf, 1);
BUG_ON(ret); /* -ENOMEM */
}
-   clean_tree_block(trans, root, buf);
+   clean_tree_block(trans, root->fs_info, buf);
*last_ref = 1;
}
return 0;
@@ -1681,7 +1681,7 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans,
continue;
}
 
-   cur = btrfs_find_tree_block(root, blocknr);
+   cur = btrfs_find_tree_block(root->fs_info, blocknr);
if (cur)
uptodate = btrfs_buffer_uptodate(cur, gen, 0);
else
@@ -1946,7 +1946,7 @@ static noinline int balance_level(struct 
btrfs_trans_handle *trans,
 
path->locks[level] = 0;
path->nodes[level] = NULL;
-   clean_tree_block(trans, root, mid);
+   clean_tree_block(trans, root->fs_info, mid);
btrfs_tree_unlock(mid);
/* once for the path */
free_extent_buffer(mid);
@@ -2000,7 +2000,7 @@ static noinline int balance_level(struct 
btrfs_trans_handle *trans,
if (wret < 0 && wret != -ENOSPC)
ret = wret;
if (btrfs_header_nritems(right) == 0) {
-   clean_tree_block(trans, root, right);
+   clean_tree_block(trans, root->fs_info, right);
btrfs_tree_unlock(right);
del_ptr(root, path, level + 1, pslot + 1);
root_sub_used(root, right->len);
@@ -2044,7 +2044,7 @@ static noinline int balance_level(struct 
btrfs_trans_handle *trans,
BUG_ON(wret == 1);
}
if (btrfs_header_nritems(mid) == 0) {
-   clean_tree_block(trans, root, mid);
+   clean_tree_block(trans, root->fs_info, mid);
btrfs_tree_unlock(mid);
del_ptr(root, path, level + 1, pslot);
root_sub_used(root, mid->len);
@@ -2262,7 +2262,7 @@ static void reada_for_search(struct btrfs_root *root,
 
search = btrfs_node_blockptr(node, slot);
blocksize = root->nodesize;
-   eb = btrfs_find_tree_block(root, search);
+   eb = btrfs_find_tree_block(root->fs_info, search);
if (eb) {
free_extent_buffer(eb);
return;
@@ -2324,7 +2324,7 @@ static noinline void reada_for_balance(struct btrfs_root 
*root,
if (slot > 0) {
block1 = btrfs_node_blockptr(parent, slot - 1);
gen = btrfs_node_ptr_generation(parent, slot - 1);
-   eb = btrfs_find_tree_block(root, block1);
+   eb = btrfs_find_tree_block(root->fs_info, block1);
/*
 * if we get -eagain from btrfs_buffer_uptodate, we
 * don't want to return eagain here.  That will loop
@@ -2337,7 +2337,7 @@ static noinline void reada_for_balance(struct btrfs_root 
*root,
if (slot + 1 < nritems) {
block2 = btrfs_node_blockptr(parent, slot + 1);
gen = btrfs_node_ptr_generation(parent, slot + 1);
-   eb = btrfs_find_tree_block(root, block2);
+   eb = btrfs_find_tree_block(root->fs_info, block2);
if (eb && btrfs_buffer_uptodate(eb, gen, 1) != 0)
block2 = 0;
free_extent_buffer(eb);
@@ -2455,7 +2455,7 @@ read_block_for_search(struct btrfs_trans_handle *trans,
blocknr = btrfs_node_blockptr(b, slot);
gen = btrfs_node_ptr_generation(b, slot);
 
-   tmp = btrfs_find_tr