linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arne Jansen <sensille@gmx.net>
To: chris.mason@oracle.com, linux-btrfs@vger.kernel.org
Cc: julia@diku.dk
Subject: [PATCH v1 0/3] btrfs: cleanup: pass fs_info instead of root where possible
Date: Tue, 31 May 2011 12:16:23 +0200	[thread overview]
Message-ID: <cover.1306836192.git.sensille@gmx.net> (raw)

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


             reply	other threads:[~2011-05-31 10:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-31 10:16 Arne Jansen [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1306836192.git.sensille@gmx.net \
    --to=sensille@gmx.net \
    --cc=chris.mason@oracle.com \
    --cc=julia@diku.dk \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).