* [PATCH v1 0/3] btrfs: cleanup: pass fs_info instead of root where possible
@ 2011-05-31 10:16 Arne Jansen
2011-05-31 10:16 ` [PATCH v1 1/3] btrfs: remove struct btrfs_root parameter where unused Arne Jansen
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Arne Jansen @ 2011-05-31 10:16 UTC (permalink / raw)
To: chris.mason, linux-btrfs; +Cc: julia
This series aims to clean up passing of struct btrfs_root and struct
btrfs_fs_info. It first removes the root pointer from functions and macros
where it's not needed, afterwards it passes fs_info instead of root to
functions which only need root->fs_info.
It is based on 3.0-rc1.
These patches are based on the following two Coccinelle-scripts, but also
involve some hand editing.
a) Remove root parameter where it's completely unneeded. Fix up callers.
@r@
identifier fn != btrfs_inc_extent_ref;
identifier root;
parameter list[n] P;
@@
fn(P
- , struct btrfs_root *root
,...)
{
... when != root
}
@@
identifier r.fn;
expression list[r.n] E;
identifier x;
@@
fn(E
- ,x
,...)
b) Change root parameter to fs_info where only root->fs_info is needed. Fix up
callers.
@ s exists @
identifier fn;
identifier root, sf;
identifier member != fs_info;
position p;
expression E;
parameter list[n] P;
@@
fn@p(P,struct btrfs_root *root,...)
{
...
(
root->member
|
sf(...,root,...)
|
(root && ...)
|
(root == ...)
|
E = root
)
... when any
}
@ t @
identifier fn != {process_one_buffer,btrfs_inc_extent_ref,btrfs_free_extent};
identifier root;
parameter list[n] P;
position p != s.p;
@@
fn@p(P,
- struct btrfs_root *root
+ struct btrfs_fs_info *fs_info
,...)
{
<...
- root->fs_info
+ fs_info
...>
}
@@
identifier t.fn;
expression list[t.n] E;
expression x;
@@
fn(E,
- x
+ x->fs_info
,...)
@@
function fn;
identifier fs_info;
identifier x;
parameter list[n] P;
@@
fn(P, struct btrfs_fs_info *fs_info, ... ) {
...
- struct btrfs_fs_info *x = fs_info;
<...
- x
+ fs_info
...>
}
Thanks to Julia Lawall for helping to build the scripts.
Arne Jansen (3):
btrfs: remove struct btrfs_root parameter where unused
btrfs: pass fs_info to btrfs_test_opt instead of root
btrfs: cleanup: pass fs_info instead of root where possible
fs/btrfs/compression.c | 11 +-
fs/btrfs/ctree.c | 76 +++++----
fs/btrfs/ctree.h | 66 ++++----
fs/btrfs/delayed-inode.c | 43 +++---
fs/btrfs/disk-io.c | 281 +++++++++++++++---------------
fs/btrfs/disk-io.h | 24 ++--
fs/btrfs/extent-tree.c | 409 ++++++++++++++++++++++---------------------
fs/btrfs/file-item.c | 5 +-
fs/btrfs/file.c | 16 +-
fs/btrfs/free-space-cache.c | 12 +-
fs/btrfs/free-space-cache.h | 2 +-
fs/btrfs/inode.c | 108 ++++++------
fs/btrfs/ioctl.c | 57 +++---
fs/btrfs/ordered-data.c | 48 +++---
fs/btrfs/ordered-data.h | 6 +-
fs/btrfs/print-tree.c | 2 +-
fs/btrfs/relocation.c | 40 +++--
fs/btrfs/scrub.c | 68 +++-----
fs/btrfs/super.c | 34 ++--
fs/btrfs/transaction.c | 183 ++++++++++----------
fs/btrfs/transaction.h | 12 +-
fs/btrfs/tree-defrag.c | 2 +-
fs/btrfs/tree-log.c | 40 +++--
fs/btrfs/volumes.c | 246 +++++++++++++-------------
fs/btrfs/volumes.h | 10 +-
25 files changed, 912 insertions(+), 889 deletions(-)
--
1.7.3.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v1 1/3] btrfs: remove struct btrfs_root parameter where unused
2011-05-31 10:16 [PATCH v1 0/3] btrfs: cleanup: pass fs_info instead of root where possible Arne Jansen
@ 2011-05-31 10:16 ` Arne Jansen
2011-06-01 0:02 ` Tsutomu Itoh
2011-05-31 10:16 ` [PATCH v1 2/3] btrfs: pass fs_info to btrfs_test_opt instead of root Arne Jansen
2011-05-31 10:38 ` [PATCH v1 0/3] btrfs: cleanup: pass fs_info instead of root where possible Arne Jansen
2 siblings, 1 reply; 5+ messages in thread
From: Arne Jansen @ 2011-05-31 10:16 UTC (permalink / raw)
To: chris.mason, linux-btrfs; +Cc: julia
The following functions had a struct btrfs_root * parameter which went
unused:
btrfs_set_block_group_rw
btrfs_destroy_delayed_refs
btrfs_csum_data
extent_data_ref_count
copy_to_sk
Signed-off-by: Arne Jansen <sensille@gmx.net>
---
fs/btrfs/compression.c | 3 +--
fs/btrfs/ctree.c | 20 ++++++++++----------
fs/btrfs/ctree.h | 5 +----
fs/btrfs/disk-io.c | 14 ++++++--------
fs/btrfs/disk-io.h | 2 +-
fs/btrfs/extent-tree.c | 16 ++++++----------
fs/btrfs/file-item.c | 3 +--
fs/btrfs/free-space-cache.c | 6 +++---
fs/btrfs/inode.c | 7 +++----
fs/btrfs/ioctl.c | 5 ++---
fs/btrfs/relocation.c | 2 +-
fs/btrfs/scrub.c | 7 +++----
12 files changed, 38 insertions(+), 52 deletions(-)
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index bfe42b0..2182cc5 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -105,7 +105,6 @@ static int check_compressed_csum(struct inode *inode,
u64 disk_start)
{
int ret;
- struct btrfs_root *root = BTRFS_I(inode)->root;
struct page *page;
unsigned long i;
char *kaddr;
@@ -120,7 +119,7 @@ static int check_compressed_csum(struct inode *inode,
csum = ~(u32)0;
kaddr = kmap_atomic(page, KM_USER0);
- csum = btrfs_csum_data(root, kaddr, csum, PAGE_CACHE_SIZE);
+ csum = btrfs_csum_data(kaddr, csum, PAGE_CACHE_SIZE);
btrfs_csum_final(csum, (char *)&csum);
kunmap_atomic(kaddr, KM_USER0);
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index b0e18d9..670bed7 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -339,7 +339,7 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans,
BUG_ON(ret);
}
if (new_flags != 0) {
- ret = btrfs_set_disk_extent_flags(trans, root,
+ ret = btrfs_set_disk_extent_flags(trans,
buf->start,
buf->len,
new_flags, 0);
@@ -1763,7 +1763,7 @@ done:
* fixing up the blocks in ram so the tree is consistent.
*/
static int fixup_low_keys(struct btrfs_trans_handle *trans,
- struct btrfs_root *root, struct btrfs_path *path,
+ struct btrfs_path *path,
struct btrfs_disk_key *key, int level)
{
int i;
@@ -1814,7 +1814,7 @@ int btrfs_set_item_key_safe(struct btrfs_trans_handle *trans,
btrfs_set_item_key(eb, &disk_key, slot);
btrfs_mark_buffer_dirty(eb);
if (slot == 0)
- fixup_low_keys(trans, root, path, &disk_key, 1);
+ fixup_low_keys(trans, path, &disk_key, 1);
return 0;
}
@@ -2579,7 +2579,7 @@ static noinline int __push_leaf_left(struct btrfs_trans_handle *trans,
clean_tree_block(trans, root, right);
btrfs_item_key(right, &disk_key, 0);
- wret = fixup_low_keys(trans, root, path, &disk_key, 1);
+ wret = fixup_low_keys(trans, path, &disk_key, 1);
if (wret)
ret = wret;
@@ -2966,7 +2966,7 @@ again:
path->nodes[0] = right;
path->slots[0] = 0;
if (path->slots[1] == 0) {
- wret = fixup_low_keys(trans, root,
+ wret = fixup_low_keys(trans,
path, &disk_key, 1);
if (wret)
ret = wret;
@@ -3301,7 +3301,7 @@ int btrfs_truncate_item(struct btrfs_trans_handle *trans,
btrfs_set_disk_key_offset(&disk_key, offset + size_diff);
btrfs_set_item_key(leaf, &disk_key, slot);
if (slot == 0)
- fixup_low_keys(trans, root, path, &disk_key, 1);
+ fixup_low_keys(trans, path, &disk_key, 1);
}
item = btrfs_item_nr(leaf, slot);
@@ -3532,7 +3532,7 @@ int btrfs_insert_some_items(struct btrfs_trans_handle *trans,
ret = 0;
if (slot == 0) {
btrfs_cpu_key_to_disk(&disk_key, cpu_key);
- ret = fixup_low_keys(trans, root, path, &disk_key, 1);
+ ret = fixup_low_keys(trans, path, &disk_key, 1);
}
if (btrfs_leaf_free_space(root, leaf) < 0) {
@@ -3638,7 +3638,7 @@ int setup_items_for_insert(struct btrfs_trans_handle *trans,
ret = 0;
if (slot == 0) {
btrfs_cpu_key_to_disk(&disk_key, cpu_key);
- ret = fixup_low_keys(trans, root, path, &disk_key, 1);
+ ret = fixup_low_keys(trans, path, &disk_key, 1);
}
btrfs_unlock_up_safe(path, 1);
btrfs_mark_buffer_dirty(leaf);
@@ -3745,7 +3745,7 @@ static int del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root,
struct btrfs_disk_key disk_key;
btrfs_node_key(parent, &disk_key, 0);
- wret = fixup_low_keys(trans, root, path, &disk_key, level + 1);
+ wret = fixup_low_keys(trans, path, &disk_key, level + 1);
if (wret)
ret = wret;
}
@@ -3862,7 +3862,7 @@ int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root,
struct btrfs_disk_key disk_key;
btrfs_item_key(leaf, &disk_key, 0);
- wret = fixup_low_keys(trans, root, path,
+ wret = fixup_low_keys(trans, path,
&disk_key, 1);
if (wret)
ret = wret;
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 6c093fa..b51a06c 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2148,7 +2148,6 @@ struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans,
u64 bytenr, u32 blocksize,
int level);
int btrfs_alloc_reserved_file_extent(struct btrfs_trans_handle *trans,
- struct btrfs_root *root,
u64 root_objectid, u64 owner,
u64 offset, struct btrfs_key *ins);
int btrfs_alloc_logged_file_extent(struct btrfs_trans_handle *trans,
@@ -2166,7 +2165,6 @@ int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
int btrfs_dec_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
struct extent_buffer *buf, int full_backref);
int btrfs_set_disk_extent_flags(struct btrfs_trans_handle *trans,
- struct btrfs_root *root,
u64 bytenr, u64 num_bytes, u64 flags,
int is_data);
int btrfs_free_extent(struct btrfs_trans_handle *trans,
@@ -2240,8 +2238,7 @@ void btrfs_block_rsv_release(struct btrfs_root *root,
u64 num_bytes);
int btrfs_set_block_group_ro(struct btrfs_root *root,
struct btrfs_block_group_cache *cache);
-int btrfs_set_block_group_rw(struct btrfs_root *root,
- struct btrfs_block_group_cache *cache);
+int btrfs_set_block_group_rw(struct btrfs_block_group_cache *cache);
void btrfs_put_block_group_cache(struct btrfs_fs_info *info);
u64 btrfs_account_ro_block_groups_free_space(struct btrfs_space_info *sinfo);
int btrfs_error_unpin_extent_range(struct btrfs_root *root,
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 98b6a71..c67a1e6 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -51,8 +51,7 @@ static void btrfs_check_super_valid(struct btrfs_fs_info *fs_info,
int read_only);
static int btrfs_destroy_ordered_operations(struct btrfs_root *root);
static int btrfs_destroy_ordered_extents(struct btrfs_root *root);
-static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
- struct btrfs_root *root);
+static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans);
static int btrfs_destroy_pending_snapshots(struct btrfs_transaction *t);
static int btrfs_destroy_delalloc_inodes(struct btrfs_root *root);
static int btrfs_destroy_marked_extents(struct btrfs_root *root,
@@ -194,7 +193,7 @@ out:
return em;
}
-u32 btrfs_csum_data(struct btrfs_root *root, char *data, u32 seed, size_t len)
+u32 btrfs_csum_data(char *data, u32 seed, size_t len)
{
return crc32c(seed, data, len);
}
@@ -233,7 +232,7 @@ static int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf,
if (err)
return 1;
cur_len = min(len, map_len - (offset - map_start));
- crc = btrfs_csum_data(root, kaddr + offset - map_start,
+ crc = btrfs_csum_data(kaddr + offset - map_start,
crc, cur_len);
len -= cur_len;
offset += cur_len;
@@ -2259,7 +2258,7 @@ static int write_dev_supers(struct btrfs_device *device,
btrfs_set_super_bytenr(sb, bytenr);
crc = ~(u32)0;
- crc = btrfs_csum_data(NULL, (char *)sb +
+ crc = btrfs_csum_data((char *)sb +
BTRFS_CSUM_SIZE, crc,
BTRFS_SUPER_INFO_SIZE -
BTRFS_CSUM_SIZE);
@@ -2830,8 +2829,7 @@ static int btrfs_destroy_ordered_extents(struct btrfs_root *root)
return 0;
}
-static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
- struct btrfs_root *root)
+static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans)
{
struct rb_node *node;
struct btrfs_delayed_ref_root *delayed_refs;
@@ -3037,7 +3035,7 @@ static int btrfs_cleanup_transaction(struct btrfs_root *root)
btrfs_destroy_ordered_extents(root);
- btrfs_destroy_delayed_refs(t, root);
+ btrfs_destroy_delayed_refs(t);
btrfs_block_rsv_release(root,
&root->fs_info->trans_block_rsv,
diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h
index a0b610a..b5e0a55 100644
--- a/fs/btrfs/disk-io.h
+++ b/fs/btrfs/disk-io.h
@@ -67,7 +67,7 @@ void btrfs_mark_buffer_dirty(struct extent_buffer *buf);
int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid);
int btrfs_set_buffer_uptodate(struct extent_buffer *buf);
int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid);
-u32 btrfs_csum_data(struct btrfs_root *root, char *data, u32 seed, size_t len);
+u32 btrfs_csum_data(char *data, u32 seed, size_t len);
void btrfs_csum_final(u32 crc, char *result);
int btrfs_bio_wq_end_io(struct btrfs_fs_info *info, struct bio *bio,
int metadata);
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 169bd62..2236c77 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -1232,8 +1232,7 @@ static noinline int remove_extent_data_ref(struct btrfs_trans_handle *trans,
return ret;
}
-static noinline u32 extent_data_ref_count(struct btrfs_root *root,
- struct btrfs_path *path,
+static noinline u32 extent_data_ref_count(struct btrfs_path *path,
struct btrfs_extent_inline_ref *iref)
{
struct btrfs_key key;
@@ -2322,7 +2321,6 @@ out:
}
int btrfs_set_disk_extent_flags(struct btrfs_trans_handle *trans,
- struct btrfs_root *root,
u64 bytenr, u64 num_bytes, u64 flags,
int is_data)
{
@@ -4495,7 +4493,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
} else {
if (found_extent) {
BUG_ON(is_data && refs_to_drop !=
- extent_data_ref_count(root, path, iref));
+ extent_data_ref_count(path, iref));
if (iref) {
BUG_ON(path->slots[0] != extent_slot);
} else {
@@ -4533,7 +4531,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
* removes it from the tree.
*/
static noinline int check_ref_cleanup(struct btrfs_trans_handle *trans,
- struct btrfs_root *root, u64 bytenr)
+ u64 bytenr)
{
struct btrfs_delayed_ref_head *head;
struct btrfs_delayed_ref_root *delayed_refs;
@@ -4630,7 +4628,7 @@ void btrfs_free_tree_block(struct btrfs_trans_handle *trans,
if (btrfs_header_generation(buf) == trans->transid) {
if (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID) {
- ret = check_ref_cleanup(trans, root, buf->start);
+ ret = check_ref_cleanup(trans, buf->start);
if (!ret)
goto pin;
}
@@ -5502,7 +5500,6 @@ static int alloc_reserved_tree_block(struct btrfs_trans_handle *trans,
}
int btrfs_alloc_reserved_file_extent(struct btrfs_trans_handle *trans,
- struct btrfs_root *root,
u64 root_objectid, u64 owner,
u64 offset, struct btrfs_key *ins)
{
@@ -5886,7 +5883,7 @@ static noinline int walk_down_proc(struct btrfs_trans_handle *trans,
BUG_ON(ret);
ret = btrfs_dec_ref(trans, root, eb, 0);
BUG_ON(ret);
- ret = btrfs_set_disk_extent_flags(trans, root, eb->start,
+ ret = btrfs_set_disk_extent_flags(trans, eb->start,
eb->len, flag, 0);
BUG_ON(ret);
wc->flags[level] |= flag;
@@ -6612,8 +6609,7 @@ u64 btrfs_account_ro_block_groups_free_space(struct btrfs_space_info *sinfo)
return free_bytes;
}
-int btrfs_set_block_group_rw(struct btrfs_root *root,
- struct btrfs_block_group_cache *cache)
+int btrfs_set_block_group_rw(struct btrfs_block_group_cache *cache)
{
struct btrfs_space_info *sinfo = cache->space_info;
u64 num_bytes;
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
index 90d4ee5..dd8afad 100644
--- a/fs/btrfs/file-item.c
+++ b/fs/btrfs/file-item.c
@@ -439,8 +439,7 @@ int btrfs_csum_one_bio(struct btrfs_root *root, struct inode *inode,
data = kmap_atomic(bvec->bv_page, KM_USER0);
sector_sum->sum = ~(u32)0;
- sector_sum->sum = btrfs_csum_data(root,
- data + bvec->bv_offset,
+ sector_sum->sum = btrfs_csum_data(data + bvec->bv_offset,
sector_sum->sum,
bvec->bv_len);
kunmap_atomic(data, KM_USER0);
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 70d4579..898f184 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -361,7 +361,7 @@ int __load_free_space_cache(struct btrfs_root *root, struct inode *inode,
/* First lets check our crc before we do anything fun */
cur_crc = ~(u32)0;
- cur_crc = btrfs_csum_data(root, addr + start_offset, cur_crc,
+ cur_crc = btrfs_csum_data(addr + start_offset, cur_crc,
PAGE_CACHE_SIZE - start_offset);
btrfs_csum_final(cur_crc, (char *)&cur_crc);
if (cur_crc != *crc) {
@@ -730,7 +730,7 @@ int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
entry++;
}
*crc = ~(u32)0;
- *crc = btrfs_csum_data(root, addr + start_offset, *crc,
+ *crc = btrfs_csum_data(addr + start_offset, *crc,
PAGE_CACHE_SIZE - start_offset);
kunmap(page);
@@ -757,7 +757,7 @@ int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
addr = kmap(page);
memcpy(addr, entry->bitmap, PAGE_CACHE_SIZE);
*crc = ~(u32)0;
- *crc = btrfs_csum_data(root, addr, *crc, PAGE_CACHE_SIZE);
+ *crc = btrfs_csum_data(addr, *crc, PAGE_CACHE_SIZE);
kunmap(page);
btrfs_csum_final(*crc, (char *)crc);
crc++;
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 39a9d57..25e73f1 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1692,7 +1692,7 @@ static int insert_reserved_file_extent(struct btrfs_trans_handle *trans,
ins.objectid = disk_bytenr;
ins.offset = disk_num_bytes;
ins.type = BTRFS_EXTENT_ITEM_KEY;
- ret = btrfs_alloc_reserved_file_extent(trans, root,
+ ret = btrfs_alloc_reserved_file_extent(trans,
root->root_key.objectid,
btrfs_ino(inode), file_pos, &ins);
BUG_ON(ret);
@@ -2009,7 +2009,7 @@ static int btrfs_readpage_end_io_hook(struct page *page, u64 start, u64 end,
if (ret)
goto zeroit;
- csum = btrfs_csum_data(root, kaddr + offset, csum, end - start + 1);
+ csum = btrfs_csum_data(kaddr + offset, csum, end - start + 1);
btrfs_csum_final(csum, (char *)&csum);
if (csum != private)
goto zeroit;
@@ -5678,7 +5678,6 @@ static void btrfs_endio_direct_read(struct bio *bio, int err)
struct bio_vec *bvec_end = bio->bi_io_vec + bio->bi_vcnt - 1;
struct bio_vec *bvec = bio->bi_io_vec;
struct inode *inode = dip->inode;
- struct btrfs_root *root = BTRFS_I(inode)->root;
u64 start;
u32 *private = dip->csums;
@@ -5692,7 +5691,7 @@ static void btrfs_endio_direct_read(struct bio *bio, int err)
local_irq_save(flags);
kaddr = kmap_atomic(page, KM_IRQ0);
- csum = btrfs_csum_data(root, kaddr + bvec->bv_offset,
+ csum = btrfs_csum_data(kaddr + bvec->bv_offset,
csum, bvec->bv_len);
btrfs_csum_final(csum, (char *)&csum);
kunmap_atomic(kaddr, KM_IRQ0);
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 85e818c..db439a3 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1505,8 +1505,7 @@ static noinline int key_in_sk(struct btrfs_key *key,
return 1;
}
-static noinline int copy_to_sk(struct btrfs_root *root,
- struct btrfs_path *path,
+static noinline int copy_to_sk(struct btrfs_path *path,
struct btrfs_key *key,
struct btrfs_ioctl_search_key *sk,
char *buf,
@@ -1640,7 +1639,7 @@ static noinline int search_ioctl(struct inode *inode,
ret = 0;
goto err;
}
- ret = copy_to_sk(root, path, &key, sk, args->buf,
+ ret = copy_to_sk(path, &key, sk, args->buf,
&sk_offset, &num_found);
btrfs_release_path(path);
if (ret || num_found >= sk->nr_items)
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index ca38eca..d084400 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -4043,7 +4043,7 @@ int btrfs_relocate_block_group(struct btrfs_root *extent_root, u64 group_start)
WARN_ON(btrfs_block_group_used(&rc->block_group->item) > 0);
out:
if (err && rw)
- btrfs_set_block_group_rw(extent_root, rc->block_group);
+ btrfs_set_block_group_rw(rc->block_group);
iput(rc->data_inode);
btrfs_put_block_group(rc->block_group);
kfree(rc);
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 6dfed0c..1541915 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -467,12 +467,11 @@ static int scrub_checksum_data(struct scrub_dev *sdev,
u8 csum[BTRFS_CSUM_SIZE];
u32 crc = ~(u32)0;
int fail = 0;
- struct btrfs_root *root = sdev->dev->dev_root;
if (!spag->have_csum)
return 0;
- crc = btrfs_csum_data(root, buffer, crc, PAGE_SIZE);
+ crc = btrfs_csum_data(buffer, crc, PAGE_SIZE);
btrfs_csum_final(crc, csum);
if (memcmp(csum, spag->csum, sdev->csum_size))
fail = 1;
@@ -519,7 +518,7 @@ static int scrub_checksum_tree_block(struct scrub_dev *sdev,
BTRFS_UUID_SIZE))
++fail;
- crc = btrfs_csum_data(root, buffer + BTRFS_CSUM_SIZE, crc,
+ crc = btrfs_csum_data(buffer + BTRFS_CSUM_SIZE, crc,
PAGE_SIZE - BTRFS_CSUM_SIZE);
btrfs_csum_final(crc, csum);
if (memcmp(csum, h->csum, sdev->csum_size))
@@ -560,7 +559,7 @@ static int scrub_checksum_super(struct scrub_bio *sbio, void *buffer)
if (memcmp(s->fsid, fs_info->fsid, BTRFS_UUID_SIZE))
++fail;
- crc = btrfs_csum_data(root, buffer + BTRFS_CSUM_SIZE, crc,
+ crc = btrfs_csum_data(buffer + BTRFS_CSUM_SIZE, crc,
PAGE_SIZE - BTRFS_CSUM_SIZE);
btrfs_csum_final(crc, csum);
if (memcmp(csum, s->csum, sbio->sdev->csum_size))
--
1.7.3.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v1 2/3] btrfs: pass fs_info to btrfs_test_opt instead of root
2011-05-31 10:16 [PATCH v1 0/3] btrfs: cleanup: pass fs_info instead of root where possible Arne Jansen
2011-05-31 10:16 ` [PATCH v1 1/3] btrfs: remove struct btrfs_root parameter where unused Arne Jansen
@ 2011-05-31 10:16 ` Arne Jansen
2011-05-31 10:38 ` [PATCH v1 0/3] btrfs: cleanup: pass fs_info instead of root where possible Arne Jansen
2 siblings, 0 replies; 5+ messages in thread
From: Arne Jansen @ 2011-05-31 10:16 UTC (permalink / raw)
To: chris.mason, linux-btrfs; +Cc: julia
btrfs_test_opt only needs fs_info from the root passed. So just pass
the fs_info directly.
Signed-off-by: Arne Jansen <sensille@gmx.net>
---
fs/btrfs/ctree.h | 2 +-
fs/btrfs/disk-io.c | 8 +++---
fs/btrfs/extent-tree.c | 55 ++++++++++++++++++++++---------------------
fs/btrfs/file.c | 2 +-
fs/btrfs/free-space-cache.c | 2 +-
fs/btrfs/inode.c | 10 ++++----
fs/btrfs/ioctl.c | 2 +-
fs/btrfs/super.c | 30 +++++++++++-----------
fs/btrfs/transaction.c | 5 ++-
fs/btrfs/tree-defrag.c | 2 +-
fs/btrfs/tree-log.c | 2 +-
fs/btrfs/volumes.c | 9 ++++---
12 files changed, 66 insertions(+), 63 deletions(-)
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index b51a06c..b2fdcca 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1343,7 +1343,7 @@ struct btrfs_ioctl_defrag_range_args {
#define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt)
#define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt)
-#define btrfs_test_opt(root, opt) ((root)->fs_info->mount_opt & \
+#define btrfs_test_opt(fs_info, opt) ((fs_info)->mount_opt & \
BTRFS_MOUNT_##opt)
/*
* Inode flags
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index c67a1e6..4d28eaf 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1990,8 +1990,8 @@ struct btrfs_root *open_ctree(struct super_block *sb,
if (IS_ERR(fs_info->transaction_kthread))
goto fail_cleaner;
- if (!btrfs_test_opt(tree_root, SSD) &&
- !btrfs_test_opt(tree_root, NOSSD) &&
+ if (!btrfs_test_opt(fs_info, SSD) &&
+ !btrfs_test_opt(fs_info, NOSSD) &&
!fs_info->fs_devices->rotating) {
printk(KERN_INFO "Btrfs detected SSD devices, enabling SSD "
"mode\n");
@@ -2304,7 +2304,7 @@ int write_all_supers(struct btrfs_root *root, int max_mirrors)
u64 flags;
max_errors = btrfs_super_num_devices(&root->fs_info->super_copy) - 1;
- do_barriers = !btrfs_test_opt(root, NOBARRIER);
+ do_barriers = !btrfs_test_opt(root->fs_info, NOBARRIER);
sb = &root->fs_info->super_for_commit;
dev_item = &sb->dev_item;
@@ -3002,7 +3002,7 @@ static int btrfs_destroy_pinned_extent(struct btrfs_root *root,
break;
/* opt_discard */
- if (btrfs_test_opt(root, DISCARD))
+ if (btrfs_test_opt(root->fs_info, DISCARD))
ret = btrfs_error_discard_extent(root, start,
end + 1 - start,
NULL);
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 2236c77..27cc348 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4298,7 +4298,7 @@ int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans,
if (ret)
break;
- if (btrfs_test_opt(root, DISCARD))
+ if (btrfs_test_opt(fs_info, DISCARD))
ret = btrfs_discard_extent(root, start,
end + 1 - start, NULL);
@@ -4811,7 +4811,8 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
int data)
{
int ret = 0;
- struct btrfs_root *root = orig_root->fs_info->extent_root;
+ struct btrfs_fs_info *fs_info = orig_root->fs_info;
+ struct btrfs_root *root = fs_info->extent_root;
struct btrfs_free_cluster *last_ptr = NULL;
struct btrfs_block_group_cache *block_group = NULL;
int empty_cluster = 2 * 1024 * 1024;
@@ -4833,7 +4834,7 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
ins->objectid = 0;
ins->offset = 0;
- space_info = __find_space_info(root->fs_info, data);
+ space_info = __find_space_info(fs_info, data);
if (!space_info) {
printk(KERN_ERR "No space info for %d\n", data);
return -ENOSPC;
@@ -4850,14 +4851,14 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
allowed_chunk_alloc = 1;
if (data & BTRFS_BLOCK_GROUP_METADATA && use_cluster) {
- last_ptr = &root->fs_info->meta_alloc_cluster;
- if (!btrfs_test_opt(root, SSD))
+ last_ptr = &fs_info->meta_alloc_cluster;
+ if (!btrfs_test_opt(fs_info, SSD))
empty_cluster = 64 * 1024;
}
if ((data & BTRFS_BLOCK_GROUP_DATA) && use_cluster &&
- btrfs_test_opt(root, SSD)) {
- last_ptr = &root->fs_info->data_alloc_cluster;
+ btrfs_test_opt(fs_info, SSD)) {
+ last_ptr = &fs_info->data_alloc_cluster;
}
if (last_ptr) {
@@ -4875,8 +4876,7 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
if (search_start == hint_byte) {
ideal_cache:
- block_group = btrfs_lookup_block_group(root->fs_info,
- search_start);
+ block_group = btrfs_lookup_block_group(fs_info, search_start);
/*
* we don't want to use the block group if it doesn't match our
* allocation bits, or if its not cached.
@@ -5307,6 +5307,7 @@ int btrfs_reserve_extent(struct btrfs_trans_handle *trans,
{
int ret;
u64 search_start = 0;
+ struct btrfs_fs_info *fs_info = root->fs_info;
data = btrfs_get_alloc_profile(root, data);
again:
@@ -5315,7 +5316,7 @@ again:
* is not called recursively on allocations
*/
if (empty_size || root->ref_cows)
- ret = do_chunk_alloc(trans, root->fs_info->extent_root,
+ ret = do_chunk_alloc(trans, fs_info->extent_root,
num_bytes + 2 * 1024 * 1024, data,
CHUNK_ALLOC_NO_FORCE);
@@ -5328,14 +5329,14 @@ again:
num_bytes = num_bytes >> 1;
num_bytes = num_bytes & ~(root->sectorsize - 1);
num_bytes = max(num_bytes, min_alloc_size);
- do_chunk_alloc(trans, root->fs_info->extent_root,
+ do_chunk_alloc(trans, fs_info->extent_root,
num_bytes, data, CHUNK_ALLOC_FORCE);
goto again;
}
- if (ret == -ENOSPC && btrfs_test_opt(root, ENOSPC_DEBUG)) {
+ if (ret == -ENOSPC && btrfs_test_opt(fs_info, ENOSPC_DEBUG)) {
struct btrfs_space_info *sinfo;
- sinfo = __find_space_info(root->fs_info, data);
+ sinfo = __find_space_info(fs_info, data);
printk(KERN_ERR "btrfs allocation failed flags %llu, "
"wanted %llu\n", (unsigned long long)data,
(unsigned long long)num_bytes);
@@ -5359,7 +5360,7 @@ int btrfs_free_reserved_extent(struct btrfs_root *root, u64 start, u64 len)
return -ENOSPC;
}
- if (btrfs_test_opt(root, DISCARD))
+ if (btrfs_test_opt(root->fs_info, DISCARD))
ret = btrfs_discard_extent(root, start, len, NULL);
btrfs_add_free_space(cache, start, len);
@@ -6863,7 +6864,7 @@ int btrfs_read_block_groups(struct btrfs_root *root)
struct btrfs_path *path;
int ret;
struct btrfs_block_group_cache *cache;
- struct btrfs_fs_info *info = root->fs_info;
+ struct btrfs_fs_info *fs_info = root->fs_info;
struct btrfs_space_info *space_info;
struct btrfs_key key;
struct btrfs_key found_key;
@@ -6871,7 +6872,7 @@ int btrfs_read_block_groups(struct btrfs_root *root)
int need_clear = 0;
u64 cache_gen;
- root = info->extent_root;
+ root = fs_info->extent_root;
key.objectid = 0;
key.offset = 0;
btrfs_set_key_type(&key, BTRFS_BLOCK_GROUP_ITEM_KEY);
@@ -6879,13 +6880,13 @@ int btrfs_read_block_groups(struct btrfs_root *root)
if (!path)
return -ENOMEM;
- cache_gen = btrfs_super_cache_generation(&root->fs_info->super_copy);
+ cache_gen = btrfs_super_cache_generation(&fs_info->super_copy);
if (cache_gen != 0 &&
- btrfs_super_generation(&root->fs_info->super_copy) != cache_gen)
+ btrfs_super_generation(&fs_info->super_copy) != cache_gen)
need_clear = 1;
- if (btrfs_test_opt(root, CLEAR_CACHE))
+ if (btrfs_test_opt(fs_info, CLEAR_CACHE))
need_clear = 1;
- if (!btrfs_test_opt(root, SPACE_CACHE) && cache_gen)
+ if (!btrfs_test_opt(fs_info, SPACE_CACHE) && cache_gen)
printk(KERN_INFO "btrfs: disk space caching is enabled\n");
while (1) {
@@ -6911,7 +6912,7 @@ int btrfs_read_block_groups(struct btrfs_root *root)
atomic_set(&cache->count, 1);
spin_lock_init(&cache->lock);
- cache->fs_info = info;
+ cache->fs_info = fs_info;
INIT_LIST_HEAD(&cache->list);
INIT_LIST_HEAD(&cache->cluster_list);
@@ -6951,14 +6952,14 @@ int btrfs_read_block_groups(struct btrfs_root *root)
} else if (btrfs_block_group_used(&cache->item) == 0) {
cache->last_byte_to_unpin = (u64)-1;
cache->cached = BTRFS_CACHE_FINISHED;
- add_new_free_space(cache, root->fs_info,
+ add_new_free_space(cache, fs_info,
found_key.objectid,
found_key.objectid +
found_key.offset);
free_excluded_extents(root, cache);
}
- ret = update_space_info(info, cache->flags, found_key.offset,
+ ret = update_space_info(fs_info, cache->flags, found_key.offset,
btrfs_block_group_used(&cache->item),
&space_info);
BUG_ON(ret);
@@ -6969,15 +6970,15 @@ int btrfs_read_block_groups(struct btrfs_root *root)
__link_block_group(space_info, cache);
- ret = btrfs_add_block_group_cache(root->fs_info, cache);
+ ret = btrfs_add_block_group_cache(fs_info, cache);
BUG_ON(ret);
- set_avail_alloc_bits(root->fs_info, cache->flags);
+ set_avail_alloc_bits(fs_info, cache->flags);
if (btrfs_chunk_readonly(root, cache->key.objectid))
set_block_group_ro(cache);
}
- list_for_each_entry_rcu(space_info, &root->fs_info->space_info, list) {
+ list_for_each_entry_rcu(space_info, &fs_info->space_info, list) {
if (!(get_alloc_profile(root, space_info->flags) &
(BTRFS_BLOCK_GROUP_RAID10 |
BTRFS_BLOCK_GROUP_RAID1 |
@@ -6993,7 +6994,7 @@ int btrfs_read_block_groups(struct btrfs_root *root)
set_block_group_ro(cache);
}
- init_global_block_rsv(info);
+ init_global_block_rsv(fs_info);
ret = 0;
error:
btrfs_free_path(path);
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index c6a22d7..3446d39 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -126,7 +126,7 @@ int btrfs_add_inode_defrag(struct btrfs_trans_handle *trans,
int ret = 0;
u64 transid;
- if (!btrfs_test_opt(root, AUTO_DEFRAG))
+ if (!btrfs_test_opt(root->fs_info, AUTO_DEFRAG))
return 0;
if (root->fs_info->closing)
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 898f184..a5c353f 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -2257,7 +2257,7 @@ int btrfs_find_space_cluster(struct btrfs_trans_handle *trans,
int ret;
/* for metadata, allow allocates with more holes */
- if (btrfs_test_opt(root, SSD_SPREAD)) {
+ if (btrfs_test_opt(root->fs_info, SSD_SPREAD)) {
min_bytes = bytes + empty_size;
} else if (block_group->flags & BTRFS_BLOCK_GROUP_METADATA) {
/*
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 25e73f1..c2264e6 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -389,7 +389,7 @@ again:
* change at any time if we discover bad compression ratios.
*/
if (!(BTRFS_I(inode)->flags & BTRFS_INODE_NOCOMPRESS) &&
- (btrfs_test_opt(root, COMPRESS) ||
+ (btrfs_test_opt(root->fs_info, COMPRESS) ||
(BTRFS_I(inode)->force_compress) ||
(BTRFS_I(inode)->flags & BTRFS_INODE_COMPRESS))) {
WARN_ON(pages);
@@ -500,7 +500,7 @@ again:
nr_pages_ret = 0;
/* flag the file so we don't compress in the future */
- if (!btrfs_test_opt(root, FORCE_COMPRESS) &&
+ if (!btrfs_test_opt(root->fs_info, FORCE_COMPRESS) &&
!(BTRFS_I(inode)->force_compress)) {
BTRFS_I(inode)->flags |= BTRFS_INODE_NOCOMPRESS;
}
@@ -1280,7 +1280,7 @@ static int run_delalloc_range(struct inode *inode, struct page *locked_page,
else if (BTRFS_I(inode)->flags & BTRFS_INODE_PREALLOC)
ret = run_delalloc_nocow(inode, locked_page, start, end,
page_started, 0, nr_written);
- else if (!btrfs_test_opt(root, COMPRESS) &&
+ else if (!btrfs_test_opt(root->fs_info, COMPRESS) &&
!(BTRFS_I(inode)->force_compress) &&
!(BTRFS_I(inode)->flags & BTRFS_INODE_COMPRESS))
ret = cow_file_range(inode, locked_page, start, end,
@@ -4516,9 +4516,9 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
btrfs_inherit_iflags(inode, dir);
if ((mode & S_IFREG)) {
- if (btrfs_test_opt(root, NODATASUM))
+ if (btrfs_test_opt(root->fs_info, NODATASUM))
BTRFS_I(inode)->flags |= BTRFS_INODE_NODATASUM;
- if (btrfs_test_opt(root, NODATACOW) ||
+ if (btrfs_test_opt(root->fs_info, NODATACOW) ||
(BTRFS_I(dir)->flags & BTRFS_INODE_NODATACOW))
BTRFS_I(inode)->flags |= BTRFS_INODE_NODATACOW;
}
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index db439a3..b8cae79 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1854,7 +1854,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
* rmdir(2).
*/
err = -EPERM;
- if (!btrfs_test_opt(root, USER_SUBVOL_RM_ALLOWED))
+ if (!btrfs_test_opt(root->fs_info, USER_SUBVOL_RM_ALLOWED))
goto out_dput;
/*
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 9b2e7e5..6a6472b 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -670,13 +670,13 @@ static int btrfs_show_options(struct seq_file *seq, struct vfsmount *vfs)
struct btrfs_fs_info *info = root->fs_info;
char *compress_type;
- if (btrfs_test_opt(root, DEGRADED))
+ if (btrfs_test_opt(info, DEGRADED))
seq_puts(seq, ",degraded");
- if (btrfs_test_opt(root, NODATASUM))
+ if (btrfs_test_opt(info, NODATASUM))
seq_puts(seq, ",nodatasum");
- if (btrfs_test_opt(root, NODATACOW))
+ if (btrfs_test_opt(info, NODATACOW))
seq_puts(seq, ",nodatacow");
- if (btrfs_test_opt(root, NOBARRIER))
+ if (btrfs_test_opt(info, NOBARRIER))
seq_puts(seq, ",nobarrier");
if (info->max_inline != 8192 * 1024)
seq_printf(seq, ",max_inline=%llu",
@@ -687,35 +687,35 @@ static int btrfs_show_options(struct seq_file *seq, struct vfsmount *vfs)
if (info->thread_pool_size != min_t(unsigned long,
num_online_cpus() + 2, 8))
seq_printf(seq, ",thread_pool=%d", info->thread_pool_size);
- if (btrfs_test_opt(root, COMPRESS)) {
+ if (btrfs_test_opt(info, COMPRESS)) {
if (info->compress_type == BTRFS_COMPRESS_ZLIB)
compress_type = "zlib";
else
compress_type = "lzo";
- if (btrfs_test_opt(root, FORCE_COMPRESS))
+ if (btrfs_test_opt(info, FORCE_COMPRESS))
seq_printf(seq, ",compress-force=%s", compress_type);
else
seq_printf(seq, ",compress=%s", compress_type);
}
- if (btrfs_test_opt(root, NOSSD))
+ if (btrfs_test_opt(info, NOSSD))
seq_puts(seq, ",nossd");
- if (btrfs_test_opt(root, SSD_SPREAD))
+ if (btrfs_test_opt(info, SSD_SPREAD))
seq_puts(seq, ",ssd_spread");
- else if (btrfs_test_opt(root, SSD))
+ else if (btrfs_test_opt(info, SSD))
seq_puts(seq, ",ssd");
- if (btrfs_test_opt(root, NOTREELOG))
+ if (btrfs_test_opt(info, NOTREELOG))
seq_puts(seq, ",notreelog");
- if (btrfs_test_opt(root, FLUSHONCOMMIT))
+ if (btrfs_test_opt(info, FLUSHONCOMMIT))
seq_puts(seq, ",flushoncommit");
- if (btrfs_test_opt(root, DISCARD))
+ if (btrfs_test_opt(info, DISCARD))
seq_puts(seq, ",discard");
if (!(root->fs_info->sb->s_flags & MS_POSIXACL))
seq_puts(seq, ",noacl");
- if (btrfs_test_opt(root, SPACE_CACHE))
+ if (btrfs_test_opt(info, SPACE_CACHE))
seq_puts(seq, ",space_cache");
- if (btrfs_test_opt(root, CLEAR_CACHE))
+ if (btrfs_test_opt(info, CLEAR_CACHE))
seq_puts(seq, ",clear_cache");
- if (btrfs_test_opt(root, USER_SUBVOL_RM_ALLOWED))
+ if (btrfs_test_opt(info, USER_SUBVOL_RM_ALLOWED))
seq_puts(seq, ",user_subvol_rm_allowed");
return 0;
}
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index dc80f71..baae99d 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -960,7 +960,8 @@ static void update_super_roots(struct btrfs_root *root)
super->root = root_item->bytenr;
super->generation = root_item->generation;
super->root_level = root_item->level;
- if (super->cache_generation != 0 || btrfs_test_opt(root, SPACE_CACHE))
+ if (super->cache_generation != 0 || btrfs_test_opt(root->fs_info,
+ SPACE_CACHE))
super->cache_generation = root_item->generation;
}
@@ -1117,7 +1118,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
int ret;
int should_grow = 0;
unsigned long now = get_seconds();
- int flush_on_commit = btrfs_test_opt(root, FLUSHONCOMMIT);
+ int flush_on_commit = btrfs_test_opt(root->fs_info, FLUSHONCOMMIT);
btrfs_run_ordered_operations(root, 0);
diff --git a/fs/btrfs/tree-defrag.c b/fs/btrfs/tree-defrag.c
index 3b580ee..38b0567 100644
--- a/fs/btrfs/tree-defrag.c
+++ b/fs/btrfs/tree-defrag.c
@@ -55,7 +55,7 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
if (root->ref_cows == 0 && !is_extent)
goto out;
- if (btrfs_test_opt(root, SSD))
+ if (btrfs_test_opt(root->fs_info, SSD))
goto out;
path = btrfs_alloc_path();
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 592396c..41ff3a0 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3013,7 +3013,7 @@ int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
sb = inode->i_sb;
- if (btrfs_test_opt(root, NOTREELOG)) {
+ if (btrfs_test_opt(root->fs_info, NOTREELOG)) {
ret = 1;
goto end_no_trans;
}
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index c48214e..710d3df 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2721,7 +2721,7 @@ int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset)
if (!em)
return 1;
- if (btrfs_test_opt(root, DEGRADED)) {
+ if (btrfs_test_opt(root->fs_info, DEGRADED)) {
free_extent_map(em);
return 0;
}
@@ -3421,7 +3421,8 @@ static int read_one_chunk(struct btrfs_root *root, struct btrfs_key *key,
BTRFS_UUID_SIZE);
map->stripes[i].dev = btrfs_find_device(root, devid, uuid,
NULL);
- if (!map->stripes[i].dev && !btrfs_test_opt(root, DEGRADED)) {
+ if (!map->stripes[i].dev && !btrfs_test_opt(root->fs_info,
+ DEGRADED)) {
kfree(map);
free_extent_map(em);
return -EIO;
@@ -3535,13 +3536,13 @@ static int read_one_dev(struct btrfs_root *root,
if (memcmp(fs_uuid, root->fs_info->fsid, BTRFS_UUID_SIZE)) {
ret = open_seed_devices(root, fs_uuid);
- if (ret && !btrfs_test_opt(root, DEGRADED))
+ if (ret && !btrfs_test_opt(root->fs_info, DEGRADED))
return ret;
}
device = btrfs_find_device(root, devid, dev_uuid, fs_uuid);
if (!device || !device->bdev) {
- if (!btrfs_test_opt(root, DEGRADED))
+ if (!btrfs_test_opt(root->fs_info, DEGRADED))
return -EIO;
if (!device) {
--
1.7.3.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1 0/3] btrfs: cleanup: pass fs_info instead of root where possible
2011-05-31 10:16 [PATCH v1 0/3] btrfs: cleanup: pass fs_info instead of root where possible Arne Jansen
2011-05-31 10:16 ` [PATCH v1 1/3] btrfs: remove struct btrfs_root parameter where unused Arne Jansen
2011-05-31 10:16 ` [PATCH v1 2/3] btrfs: pass fs_info to btrfs_test_opt instead of root Arne Jansen
@ 2011-05-31 10:38 ` Arne Jansen
2 siblings, 0 replies; 5+ messages in thread
From: Arne Jansen @ 2011-05-31 10:38 UTC (permalink / raw)
To: chris.mason, linux-btrfs; +Cc: julia
3/3 doesn't seem to arrive anymore, possibly due to a mail size
restriction on vger (yes, it is big). So I pushed it out to:
git://git.kernel.org/pub/scm/linux/kernel/git/arne/btrfs-unstable-arne.git
root-eliminate
Thanks,
Arne
On 31.05.2011 12:16, Arne Jansen wrote:
> This series aims to clean up passing of struct btrfs_root and struct
> btrfs_fs_info. It first removes the root pointer from functions and macros
> where it's not needed, afterwards it passes fs_info instead of root to
> functions which only need root->fs_info.
>
> It is based on 3.0-rc1.
>
> These patches are based on the following two Coccinelle-scripts, but also
> involve some hand editing.
>
> a) Remove root parameter where it's completely unneeded. Fix up callers.
>
> @r@
> identifier fn != btrfs_inc_extent_ref;
> identifier root;
> parameter list[n] P;
> @@
>
> fn(P
> - , struct btrfs_root *root
> ,...)
> {
> ... when != root
> }
>
> @@
> identifier r.fn;
> expression list[r.n] E;
> identifier x;
> @@
>
> fn(E
> - ,x
> ,...)
>
> b) Change root parameter to fs_info where only root->fs_info is needed. Fix up
> callers.
>
> @ s exists @
> identifier fn;
> identifier root, sf;
> identifier member != fs_info;
> position p;
> expression E;
> parameter list[n] P;
> @@
> fn@p(P,struct btrfs_root *root,...)
> {
> ...
> (
> root->member
> |
> sf(...,root,...)
> |
> (root && ...)
> |
> (root == ...)
> |
> E = root
> )
> ... when any
> }
>
> @ t @
> identifier fn != {process_one_buffer,btrfs_inc_extent_ref,btrfs_free_extent};
> identifier root;
> parameter list[n] P;
> position p != s.p;
> @@
>
> fn@p(P,
> - struct btrfs_root *root
> + struct btrfs_fs_info *fs_info
> ,...)
> {
> <...
> - root->fs_info
> + fs_info
> ...>
> }
>
> @@
> identifier t.fn;
> expression list[t.n] E;
> expression x;
> @@
>
> fn(E,
> - x
> + x->fs_info
> ,...)
>
> @@
> function fn;
> identifier fs_info;
> identifier x;
> parameter list[n] P;
> @@
> fn(P, struct btrfs_fs_info *fs_info, ... ) {
> ...
> - struct btrfs_fs_info *x = fs_info;
> <...
> - x
> + fs_info
> ...>
> }
>
>
> Thanks to Julia Lawall for helping to build the scripts.
>
>
> Arne Jansen (3):
> btrfs: remove struct btrfs_root parameter where unused
> btrfs: pass fs_info to btrfs_test_opt instead of root
> btrfs: cleanup: pass fs_info instead of root where possible
>
> fs/btrfs/compression.c | 11 +-
> fs/btrfs/ctree.c | 76 +++++----
> fs/btrfs/ctree.h | 66 ++++----
> fs/btrfs/delayed-inode.c | 43 +++---
> fs/btrfs/disk-io.c | 281 +++++++++++++++---------------
> fs/btrfs/disk-io.h | 24 ++--
> fs/btrfs/extent-tree.c | 409 ++++++++++++++++++++++---------------------
> fs/btrfs/file-item.c | 5 +-
> fs/btrfs/file.c | 16 +-
> fs/btrfs/free-space-cache.c | 12 +-
> fs/btrfs/free-space-cache.h | 2 +-
> fs/btrfs/inode.c | 108 ++++++------
> fs/btrfs/ioctl.c | 57 +++---
> fs/btrfs/ordered-data.c | 48 +++---
> fs/btrfs/ordered-data.h | 6 +-
> fs/btrfs/print-tree.c | 2 +-
> fs/btrfs/relocation.c | 40 +++--
> fs/btrfs/scrub.c | 68 +++-----
> fs/btrfs/super.c | 34 ++--
> fs/btrfs/transaction.c | 183 ++++++++++----------
> fs/btrfs/transaction.h | 12 +-
> fs/btrfs/tree-defrag.c | 2 +-
> fs/btrfs/tree-log.c | 40 +++--
> fs/btrfs/volumes.c | 246 +++++++++++++-------------
> fs/btrfs/volumes.h | 10 +-
> 25 files changed, 912 insertions(+), 889 deletions(-)
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/3] btrfs: remove struct btrfs_root parameter where unused
2011-05-31 10:16 ` [PATCH v1 1/3] btrfs: remove struct btrfs_root parameter where unused Arne Jansen
@ 2011-06-01 0:02 ` Tsutomu Itoh
0 siblings, 0 replies; 5+ messages in thread
From: Tsutomu Itoh @ 2011-06-01 0:02 UTC (permalink / raw)
To: Arne Jansen; +Cc: chris.mason, linux-btrfs, julia
Hi,
(2011/05/31 19:16), Arne Jansen wrote:
> The following functions had a struct btrfs_root * parameter which went
> unused:
>
> btrfs_set_block_group_rw
> btrfs_destroy_delayed_refs
> btrfs_csum_data
> extent_data_ref_count
> copy_to_sk
>
> Signed-off-by: Arne Jansen <sensille@gmx.net>
> ---
> fs/btrfs/compression.c | 3 +--
> fs/btrfs/ctree.c | 20 ++++++++++----------
> fs/btrfs/ctree.h | 5 +----
> fs/btrfs/disk-io.c | 14 ++++++--------
> fs/btrfs/disk-io.h | 2 +-
> fs/btrfs/extent-tree.c | 16 ++++++----------
> fs/btrfs/file-item.c | 3 +--
> fs/btrfs/free-space-cache.c | 6 +++---
> fs/btrfs/inode.c | 7 +++----
> fs/btrfs/ioctl.c | 5 ++---
> fs/btrfs/relocation.c | 2 +-
> fs/btrfs/scrub.c | 7 +++----
> 12 files changed, 38 insertions(+), 52 deletions(-)
>
> diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
> index bfe42b0..2182cc5 100644
> --- a/fs/btrfs/compression.c
> +++ b/fs/btrfs/compression.c
> @@ -105,7 +105,6 @@ static int check_compressed_csum(struct inode *inode,
> u64 disk_start)
> {
> int ret;
> - struct btrfs_root *root = BTRFS_I(inode)->root;
> struct page *page;
> unsigned long i;
> char *kaddr;
> @@ -120,7 +119,7 @@ static int check_compressed_csum(struct inode *inode,
> csum = ~(u32)0;
>
> kaddr = kmap_atomic(page, KM_USER0);
> - csum = btrfs_csum_data(root, kaddr, csum, PAGE_CACHE_SIZE);
> + csum = btrfs_csum_data(kaddr, csum, PAGE_CACHE_SIZE);
> btrfs_csum_final(csum, (char *)&csum);
> kunmap_atomic(kaddr, KM_USER0);
>
> diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
> index b0e18d9..670bed7 100644
> --- a/fs/btrfs/ctree.c
> +++ b/fs/btrfs/ctree.c
> @@ -339,7 +339,7 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans,
> BUG_ON(ret);
> }
> if (new_flags != 0) {
> - ret = btrfs_set_disk_extent_flags(trans, root,
> + ret = btrfs_set_disk_extent_flags(trans,
> buf->start,
> buf->len,
> new_flags, 0);
> @@ -1763,7 +1763,7 @@ done:
> * fixing up the blocks in ram so the tree is consistent.
> */
> static int fixup_low_keys(struct btrfs_trans_handle *trans,
> - struct btrfs_root *root, struct btrfs_path *path,
> + struct btrfs_path *path,
> struct btrfs_disk_key *key, int level)
'trans' is also unnecessary in fixup_low_keys().
(http://marc.info/?l=linux-btrfs&m=130337980625475&w=2)
Thanks,
Tsutomu
> {
> int i;
> @@ -1814,7 +1814,7 @@ int btrfs_set_item_key_safe(struct btrfs_trans_handle *trans,
> btrfs_set_item_key(eb, &disk_key, slot);
> btrfs_mark_buffer_dirty(eb);
> if (slot == 0)
> - fixup_low_keys(trans, root, path, &disk_key, 1);
> + fixup_low_keys(trans, path, &disk_key, 1);
> return 0;
> }
>
> @@ -2579,7 +2579,7 @@ static noinline int __push_leaf_left(struct btrfs_trans_handle *trans,
> clean_tree_block(trans, root, right);
>
> btrfs_item_key(right, &disk_key, 0);
> - wret = fixup_low_keys(trans, root, path, &disk_key, 1);
> + wret = fixup_low_keys(trans, path, &disk_key, 1);
> if (wret)
> ret = wret;
>
> @@ -2966,7 +2966,7 @@ again:
> path->nodes[0] = right;
> path->slots[0] = 0;
> if (path->slots[1] == 0) {
> - wret = fixup_low_keys(trans, root,
> + wret = fixup_low_keys(trans,
> path, &disk_key, 1);
> if (wret)
> ret = wret;
> @@ -3301,7 +3301,7 @@ int btrfs_truncate_item(struct btrfs_trans_handle *trans,
> btrfs_set_disk_key_offset(&disk_key, offset + size_diff);
> btrfs_set_item_key(leaf, &disk_key, slot);
> if (slot == 0)
> - fixup_low_keys(trans, root, path, &disk_key, 1);
> + fixup_low_keys(trans, path, &disk_key, 1);
> }
>
> item = btrfs_item_nr(leaf, slot);
> @@ -3532,7 +3532,7 @@ int btrfs_insert_some_items(struct btrfs_trans_handle *trans,
> ret = 0;
> if (slot == 0) {
> btrfs_cpu_key_to_disk(&disk_key, cpu_key);
> - ret = fixup_low_keys(trans, root, path, &disk_key, 1);
> + ret = fixup_low_keys(trans, path, &disk_key, 1);
> }
>
> if (btrfs_leaf_free_space(root, leaf) < 0) {
> @@ -3638,7 +3638,7 @@ int setup_items_for_insert(struct btrfs_trans_handle *trans,
> ret = 0;
> if (slot == 0) {
> btrfs_cpu_key_to_disk(&disk_key, cpu_key);
> - ret = fixup_low_keys(trans, root, path, &disk_key, 1);
> + ret = fixup_low_keys(trans, path, &disk_key, 1);
> }
> btrfs_unlock_up_safe(path, 1);
> btrfs_mark_buffer_dirty(leaf);
> @@ -3745,7 +3745,7 @@ static int del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root,
> struct btrfs_disk_key disk_key;
>
> btrfs_node_key(parent, &disk_key, 0);
> - wret = fixup_low_keys(trans, root, path, &disk_key, level + 1);
> + wret = fixup_low_keys(trans, path, &disk_key, level + 1);
> if (wret)
> ret = wret;
> }
> @@ -3862,7 +3862,7 @@ int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root,
> struct btrfs_disk_key disk_key;
>
> btrfs_item_key(leaf, &disk_key, 0);
> - wret = fixup_low_keys(trans, root, path,
> + wret = fixup_low_keys(trans, path,
> &disk_key, 1);
> if (wret)
> ret = wret;
> diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
> index 6c093fa..b51a06c 100644
> --- a/fs/btrfs/ctree.h
> +++ b/fs/btrfs/ctree.h
> @@ -2148,7 +2148,6 @@ struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans,
> u64 bytenr, u32 blocksize,
> int level);
> int btrfs_alloc_reserved_file_extent(struct btrfs_trans_handle *trans,
> - struct btrfs_root *root,
> u64 root_objectid, u64 owner,
> u64 offset, struct btrfs_key *ins);
> int btrfs_alloc_logged_file_extent(struct btrfs_trans_handle *trans,
> @@ -2166,7 +2165,6 @@ int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
> int btrfs_dec_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
> struct extent_buffer *buf, int full_backref);
> int btrfs_set_disk_extent_flags(struct btrfs_trans_handle *trans,
> - struct btrfs_root *root,
> u64 bytenr, u64 num_bytes, u64 flags,
> int is_data);
> int btrfs_free_extent(struct btrfs_trans_handle *trans,
> @@ -2240,8 +2238,7 @@ void btrfs_block_rsv_release(struct btrfs_root *root,
> u64 num_bytes);
> int btrfs_set_block_group_ro(struct btrfs_root *root,
> struct btrfs_block_group_cache *cache);
> -int btrfs_set_block_group_rw(struct btrfs_root *root,
> - struct btrfs_block_group_cache *cache);
> +int btrfs_set_block_group_rw(struct btrfs_block_group_cache *cache);
> void btrfs_put_block_group_cache(struct btrfs_fs_info *info);
> u64 btrfs_account_ro_block_groups_free_space(struct btrfs_space_info *sinfo);
> int btrfs_error_unpin_extent_range(struct btrfs_root *root,
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 98b6a71..c67a1e6 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -51,8 +51,7 @@ static void btrfs_check_super_valid(struct btrfs_fs_info *fs_info,
> int read_only);
> static int btrfs_destroy_ordered_operations(struct btrfs_root *root);
> static int btrfs_destroy_ordered_extents(struct btrfs_root *root);
> -static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
> - struct btrfs_root *root);
> +static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans);
> static int btrfs_destroy_pending_snapshots(struct btrfs_transaction *t);
> static int btrfs_destroy_delalloc_inodes(struct btrfs_root *root);
> static int btrfs_destroy_marked_extents(struct btrfs_root *root,
> @@ -194,7 +193,7 @@ out:
> return em;
> }
>
> -u32 btrfs_csum_data(struct btrfs_root *root, char *data, u32 seed, size_t len)
> +u32 btrfs_csum_data(char *data, u32 seed, size_t len)
> {
> return crc32c(seed, data, len);
> }
> @@ -233,7 +232,7 @@ static int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf,
> if (err)
> return 1;
> cur_len = min(len, map_len - (offset - map_start));
> - crc = btrfs_csum_data(root, kaddr + offset - map_start,
> + crc = btrfs_csum_data(kaddr + offset - map_start,
> crc, cur_len);
> len -= cur_len;
> offset += cur_len;
> @@ -2259,7 +2258,7 @@ static int write_dev_supers(struct btrfs_device *device,
> btrfs_set_super_bytenr(sb, bytenr);
>
> crc = ~(u32)0;
> - crc = btrfs_csum_data(NULL, (char *)sb +
> + crc = btrfs_csum_data((char *)sb +
> BTRFS_CSUM_SIZE, crc,
> BTRFS_SUPER_INFO_SIZE -
> BTRFS_CSUM_SIZE);
> @@ -2830,8 +2829,7 @@ static int btrfs_destroy_ordered_extents(struct btrfs_root *root)
> return 0;
> }
>
> -static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
> - struct btrfs_root *root)
> +static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans)
> {
> struct rb_node *node;
> struct btrfs_delayed_ref_root *delayed_refs;
> @@ -3037,7 +3035,7 @@ static int btrfs_cleanup_transaction(struct btrfs_root *root)
>
> btrfs_destroy_ordered_extents(root);
>
> - btrfs_destroy_delayed_refs(t, root);
> + btrfs_destroy_delayed_refs(t);
>
> btrfs_block_rsv_release(root,
> &root->fs_info->trans_block_rsv,
> diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h
> index a0b610a..b5e0a55 100644
> --- a/fs/btrfs/disk-io.h
> +++ b/fs/btrfs/disk-io.h
> @@ -67,7 +67,7 @@ void btrfs_mark_buffer_dirty(struct extent_buffer *buf);
> int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid);
> int btrfs_set_buffer_uptodate(struct extent_buffer *buf);
> int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid);
> -u32 btrfs_csum_data(struct btrfs_root *root, char *data, u32 seed, size_t len);
> +u32 btrfs_csum_data(char *data, u32 seed, size_t len);
> void btrfs_csum_final(u32 crc, char *result);
> int btrfs_bio_wq_end_io(struct btrfs_fs_info *info, struct bio *bio,
> int metadata);
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index 169bd62..2236c77 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -1232,8 +1232,7 @@ static noinline int remove_extent_data_ref(struct btrfs_trans_handle *trans,
> return ret;
> }
>
> -static noinline u32 extent_data_ref_count(struct btrfs_root *root,
> - struct btrfs_path *path,
> +static noinline u32 extent_data_ref_count(struct btrfs_path *path,
> struct btrfs_extent_inline_ref *iref)
> {
> struct btrfs_key key;
> @@ -2322,7 +2321,6 @@ out:
> }
>
> int btrfs_set_disk_extent_flags(struct btrfs_trans_handle *trans,
> - struct btrfs_root *root,
> u64 bytenr, u64 num_bytes, u64 flags,
> int is_data)
> {
> @@ -4495,7 +4493,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
> } else {
> if (found_extent) {
> BUG_ON(is_data && refs_to_drop !=
> - extent_data_ref_count(root, path, iref));
> + extent_data_ref_count(path, iref));
> if (iref) {
> BUG_ON(path->slots[0] != extent_slot);
> } else {
> @@ -4533,7 +4531,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
> * removes it from the tree.
> */
> static noinline int check_ref_cleanup(struct btrfs_trans_handle *trans,
> - struct btrfs_root *root, u64 bytenr)
> + u64 bytenr)
> {
> struct btrfs_delayed_ref_head *head;
> struct btrfs_delayed_ref_root *delayed_refs;
> @@ -4630,7 +4628,7 @@ void btrfs_free_tree_block(struct btrfs_trans_handle *trans,
>
> if (btrfs_header_generation(buf) == trans->transid) {
> if (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID) {
> - ret = check_ref_cleanup(trans, root, buf->start);
> + ret = check_ref_cleanup(trans, buf->start);
> if (!ret)
> goto pin;
> }
> @@ -5502,7 +5500,6 @@ static int alloc_reserved_tree_block(struct btrfs_trans_handle *trans,
> }
>
> int btrfs_alloc_reserved_file_extent(struct btrfs_trans_handle *trans,
> - struct btrfs_root *root,
> u64 root_objectid, u64 owner,
> u64 offset, struct btrfs_key *ins)
> {
> @@ -5886,7 +5883,7 @@ static noinline int walk_down_proc(struct btrfs_trans_handle *trans,
> BUG_ON(ret);
> ret = btrfs_dec_ref(trans, root, eb, 0);
> BUG_ON(ret);
> - ret = btrfs_set_disk_extent_flags(trans, root, eb->start,
> + ret = btrfs_set_disk_extent_flags(trans, eb->start,
> eb->len, flag, 0);
> BUG_ON(ret);
> wc->flags[level] |= flag;
> @@ -6612,8 +6609,7 @@ u64 btrfs_account_ro_block_groups_free_space(struct btrfs_space_info *sinfo)
> return free_bytes;
> }
>
> -int btrfs_set_block_group_rw(struct btrfs_root *root,
> - struct btrfs_block_group_cache *cache)
> +int btrfs_set_block_group_rw(struct btrfs_block_group_cache *cache)
> {
> struct btrfs_space_info *sinfo = cache->space_info;
> u64 num_bytes;
> diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
> index 90d4ee5..dd8afad 100644
> --- a/fs/btrfs/file-item.c
> +++ b/fs/btrfs/file-item.c
> @@ -439,8 +439,7 @@ int btrfs_csum_one_bio(struct btrfs_root *root, struct inode *inode,
>
> data = kmap_atomic(bvec->bv_page, KM_USER0);
> sector_sum->sum = ~(u32)0;
> - sector_sum->sum = btrfs_csum_data(root,
> - data + bvec->bv_offset,
> + sector_sum->sum = btrfs_csum_data(data + bvec->bv_offset,
> sector_sum->sum,
> bvec->bv_len);
> kunmap_atomic(data, KM_USER0);
> diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
> index 70d4579..898f184 100644
> --- a/fs/btrfs/free-space-cache.c
> +++ b/fs/btrfs/free-space-cache.c
> @@ -361,7 +361,7 @@ int __load_free_space_cache(struct btrfs_root *root, struct inode *inode,
>
> /* First lets check our crc before we do anything fun */
> cur_crc = ~(u32)0;
> - cur_crc = btrfs_csum_data(root, addr + start_offset, cur_crc,
> + cur_crc = btrfs_csum_data(addr + start_offset, cur_crc,
> PAGE_CACHE_SIZE - start_offset);
> btrfs_csum_final(cur_crc, (char *)&cur_crc);
> if (cur_crc != *crc) {
> @@ -730,7 +730,7 @@ int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
> entry++;
> }
> *crc = ~(u32)0;
> - *crc = btrfs_csum_data(root, addr + start_offset, *crc,
> + *crc = btrfs_csum_data(addr + start_offset, *crc,
> PAGE_CACHE_SIZE - start_offset);
> kunmap(page);
>
> @@ -757,7 +757,7 @@ int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
> addr = kmap(page);
> memcpy(addr, entry->bitmap, PAGE_CACHE_SIZE);
> *crc = ~(u32)0;
> - *crc = btrfs_csum_data(root, addr, *crc, PAGE_CACHE_SIZE);
> + *crc = btrfs_csum_data(addr, *crc, PAGE_CACHE_SIZE);
> kunmap(page);
> btrfs_csum_final(*crc, (char *)crc);
> crc++;
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 39a9d57..25e73f1 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -1692,7 +1692,7 @@ static int insert_reserved_file_extent(struct btrfs_trans_handle *trans,
> ins.objectid = disk_bytenr;
> ins.offset = disk_num_bytes;
> ins.type = BTRFS_EXTENT_ITEM_KEY;
> - ret = btrfs_alloc_reserved_file_extent(trans, root,
> + ret = btrfs_alloc_reserved_file_extent(trans,
> root->root_key.objectid,
> btrfs_ino(inode), file_pos, &ins);
> BUG_ON(ret);
> @@ -2009,7 +2009,7 @@ static int btrfs_readpage_end_io_hook(struct page *page, u64 start, u64 end,
> if (ret)
> goto zeroit;
>
> - csum = btrfs_csum_data(root, kaddr + offset, csum, end - start + 1);
> + csum = btrfs_csum_data(kaddr + offset, csum, end - start + 1);
> btrfs_csum_final(csum, (char *)&csum);
> if (csum != private)
> goto zeroit;
> @@ -5678,7 +5678,6 @@ static void btrfs_endio_direct_read(struct bio *bio, int err)
> struct bio_vec *bvec_end = bio->bi_io_vec + bio->bi_vcnt - 1;
> struct bio_vec *bvec = bio->bi_io_vec;
> struct inode *inode = dip->inode;
> - struct btrfs_root *root = BTRFS_I(inode)->root;
> u64 start;
> u32 *private = dip->csums;
>
> @@ -5692,7 +5691,7 @@ static void btrfs_endio_direct_read(struct bio *bio, int err)
>
> local_irq_save(flags);
> kaddr = kmap_atomic(page, KM_IRQ0);
> - csum = btrfs_csum_data(root, kaddr + bvec->bv_offset,
> + csum = btrfs_csum_data(kaddr + bvec->bv_offset,
> csum, bvec->bv_len);
> btrfs_csum_final(csum, (char *)&csum);
> kunmap_atomic(kaddr, KM_IRQ0);
> diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
> index 85e818c..db439a3 100644
> --- a/fs/btrfs/ioctl.c
> +++ b/fs/btrfs/ioctl.c
> @@ -1505,8 +1505,7 @@ static noinline int key_in_sk(struct btrfs_key *key,
> return 1;
> }
>
> -static noinline int copy_to_sk(struct btrfs_root *root,
> - struct btrfs_path *path,
> +static noinline int copy_to_sk(struct btrfs_path *path,
> struct btrfs_key *key,
> struct btrfs_ioctl_search_key *sk,
> char *buf,
> @@ -1640,7 +1639,7 @@ static noinline int search_ioctl(struct inode *inode,
> ret = 0;
> goto err;
> }
> - ret = copy_to_sk(root, path, &key, sk, args->buf,
> + ret = copy_to_sk(path, &key, sk, args->buf,
> &sk_offset, &num_found);
> btrfs_release_path(path);
> if (ret || num_found >= sk->nr_items)
> diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
> index ca38eca..d084400 100644
> --- a/fs/btrfs/relocation.c
> +++ b/fs/btrfs/relocation.c
> @@ -4043,7 +4043,7 @@ int btrfs_relocate_block_group(struct btrfs_root *extent_root, u64 group_start)
> WARN_ON(btrfs_block_group_used(&rc->block_group->item) > 0);
> out:
> if (err && rw)
> - btrfs_set_block_group_rw(extent_root, rc->block_group);
> + btrfs_set_block_group_rw(rc->block_group);
> iput(rc->data_inode);
> btrfs_put_block_group(rc->block_group);
> kfree(rc);
> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
> index 6dfed0c..1541915 100644
> --- a/fs/btrfs/scrub.c
> +++ b/fs/btrfs/scrub.c
> @@ -467,12 +467,11 @@ static int scrub_checksum_data(struct scrub_dev *sdev,
> u8 csum[BTRFS_CSUM_SIZE];
> u32 crc = ~(u32)0;
> int fail = 0;
> - struct btrfs_root *root = sdev->dev->dev_root;
>
> if (!spag->have_csum)
> return 0;
>
> - crc = btrfs_csum_data(root, buffer, crc, PAGE_SIZE);
> + crc = btrfs_csum_data(buffer, crc, PAGE_SIZE);
> btrfs_csum_final(crc, csum);
> if (memcmp(csum, spag->csum, sdev->csum_size))
> fail = 1;
> @@ -519,7 +518,7 @@ static int scrub_checksum_tree_block(struct scrub_dev *sdev,
> BTRFS_UUID_SIZE))
> ++fail;
>
> - crc = btrfs_csum_data(root, buffer + BTRFS_CSUM_SIZE, crc,
> + crc = btrfs_csum_data(buffer + BTRFS_CSUM_SIZE, crc,
> PAGE_SIZE - BTRFS_CSUM_SIZE);
> btrfs_csum_final(crc, csum);
> if (memcmp(csum, h->csum, sdev->csum_size))
> @@ -560,7 +559,7 @@ static int scrub_checksum_super(struct scrub_bio *sbio, void *buffer)
> if (memcmp(s->fsid, fs_info->fsid, BTRFS_UUID_SIZE))
> ++fail;
>
> - crc = btrfs_csum_data(root, buffer + BTRFS_CSUM_SIZE, crc,
> + crc = btrfs_csum_data(buffer + BTRFS_CSUM_SIZE, crc,
> PAGE_SIZE - BTRFS_CSUM_SIZE);
> btrfs_csum_final(crc, csum);
> if (memcmp(csum, s->csum, sbio->sdev->csum_size))
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-06-01 0:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-31 10:16 [PATCH v1 0/3] btrfs: cleanup: pass fs_info instead of root where possible Arne Jansen
2011-05-31 10:16 ` [PATCH v1 1/3] btrfs: remove struct btrfs_root parameter where unused Arne Jansen
2011-06-01 0:02 ` Tsutomu Itoh
2011-05-31 10:16 ` [PATCH v1 2/3] btrfs: pass fs_info to btrfs_test_opt instead of root Arne Jansen
2011-05-31 10:38 ` [PATCH v1 0/3] btrfs: cleanup: pass fs_info instead of root where possible Arne Jansen
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).