All of lore.kernel.org
 help / color / mirror / Atom feed
* [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

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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.