All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] cifs: store pointer to master tlink in superblock (try #2)
@ 2010-10-28 17:33 Jeff Layton
       [not found] ` <1288287218-25100-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Layton @ 2010-10-28 17:33 UTC (permalink / raw)
  To: smfrench-Re5JQEeQqe8AvxtiuMwx3w
  Cc: shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w,
	linux-cifs-u79uwXL29TY76Z2rM5mHXA

This is the second version of this patch, the only difference between
it and the first one is that this explicitly makes cifs_sb_master_tlink
a static inline.

Instead of keeping a tag on the master tlink in the tree, just keep a
pointer to the master in the superblock. That eliminates the need for
using the radix tree to look up a tagged entry.

Signed-off-by: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 fs/cifs/cifs_fs_sb.h |    2 +-
 fs/cifs/connect.c    |   20 ++++----------------
 2 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/fs/cifs/cifs_fs_sb.h b/fs/cifs/cifs_fs_sb.h
index 525ba59..79576da 100644
--- a/fs/cifs/cifs_fs_sb.h
+++ b/fs/cifs/cifs_fs_sb.h
@@ -43,8 +43,8 @@
 
 struct cifs_sb_info {
 	struct radix_tree_root tlink_tree;
-#define CIFS_TLINK_MASTER_TAG		0	/* is "master" (mount) tcon */
 	spinlock_t tlink_tree_lock;
+	struct tcon_link *master_tlink;
 	struct nls_table *local_nls;
 	unsigned int rsize;
 	unsigned int wsize;
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 469c3dd..cd644ce 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2917,11 +2917,11 @@ remote_path_check:
 
 	spin_lock(&cifs_sb->tlink_tree_lock);
 	radix_tree_insert(&cifs_sb->tlink_tree, pSesInfo->linux_uid, tlink);
-	radix_tree_tag_set(&cifs_sb->tlink_tree, pSesInfo->linux_uid,
-			   CIFS_TLINK_MASTER_TAG);
 	spin_unlock(&cifs_sb->tlink_tree_lock);
 	radix_tree_preload_end();
 
+	cifs_sb->master_tlink = tlink;
+
 	queue_delayed_work(system_nrt_wq, &cifs_sb->prune_tlinks,
 				TLINK_IDLE_EXPIRE);
 
@@ -3272,22 +3272,10 @@ out:
 	return tcon;
 }
 
-static struct tcon_link *
+static inline struct tcon_link *
 cifs_sb_master_tlink(struct cifs_sb_info *cifs_sb)
 {
-	struct tcon_link *tlink;
-	unsigned int ret;
-
-	spin_lock(&cifs_sb->tlink_tree_lock);
-	ret = radix_tree_gang_lookup_tag(&cifs_sb->tlink_tree, (void **)&tlink,
-					0, 1, CIFS_TLINK_MASTER_TAG);
-	spin_unlock(&cifs_sb->tlink_tree_lock);
-
-	/* the master tcon should always be present */
-	if (ret == 0)
-		BUG();
-
-	return tlink;
+	return cifs_sb->master_tlink;
 }
 
 struct cifsTconInfo *
-- 
1.7.2.3

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

* Re: [PATCH 1/2] cifs: store pointer to master tlink in superblock (try #2)
       [not found] ` <1288287218-25100-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2010-10-28 19:22   ` Shirish Pargaonkar
  0 siblings, 0 replies; 2+ messages in thread
From: Shirish Pargaonkar @ 2010-10-28 19:22 UTC (permalink / raw)
  To: Jeff Layton
  Cc: smfrench-Re5JQEeQqe8AvxtiuMwx3w, linux-cifs-u79uwXL29TY76Z2rM5mHXA

On Thu, Oct 28, 2010 at 12:33 PM, Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> This is the second version of this patch, the only difference between
> it and the first one is that this explicitly makes cifs_sb_master_tlink
> a static inline.
>
> Instead of keeping a tag on the master tlink in the tree, just keep a
> pointer to the master in the superblock. That eliminates the need for
> using the radix tree to look up a tagged entry.
>
> Signed-off-by: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  fs/cifs/cifs_fs_sb.h |    2 +-
>  fs/cifs/connect.c    |   20 ++++----------------
>  2 files changed, 5 insertions(+), 17 deletions(-)
>
> diff --git a/fs/cifs/cifs_fs_sb.h b/fs/cifs/cifs_fs_sb.h
> index 525ba59..79576da 100644
> --- a/fs/cifs/cifs_fs_sb.h
> +++ b/fs/cifs/cifs_fs_sb.h
> @@ -43,8 +43,8 @@
>
>  struct cifs_sb_info {
>        struct radix_tree_root tlink_tree;
> -#define CIFS_TLINK_MASTER_TAG          0       /* is "master" (mount) tcon */
>        spinlock_t tlink_tree_lock;
> +       struct tcon_link *master_tlink;
>        struct nls_table *local_nls;
>        unsigned int rsize;
>        unsigned int wsize;
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 469c3dd..cd644ce 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -2917,11 +2917,11 @@ remote_path_check:
>
>        spin_lock(&cifs_sb->tlink_tree_lock);
>        radix_tree_insert(&cifs_sb->tlink_tree, pSesInfo->linux_uid, tlink);
> -       radix_tree_tag_set(&cifs_sb->tlink_tree, pSesInfo->linux_uid,
> -                          CIFS_TLINK_MASTER_TAG);
>        spin_unlock(&cifs_sb->tlink_tree_lock);
>        radix_tree_preload_end();
>
> +       cifs_sb->master_tlink = tlink;
> +
>        queue_delayed_work(system_nrt_wq, &cifs_sb->prune_tlinks,
>                                TLINK_IDLE_EXPIRE);
>
> @@ -3272,22 +3272,10 @@ out:
>        return tcon;
>  }
>
> -static struct tcon_link *
> +static inline struct tcon_link *
>  cifs_sb_master_tlink(struct cifs_sb_info *cifs_sb)
>  {
> -       struct tcon_link *tlink;
> -       unsigned int ret;
> -
> -       spin_lock(&cifs_sb->tlink_tree_lock);
> -       ret = radix_tree_gang_lookup_tag(&cifs_sb->tlink_tree, (void **)&tlink,
> -                                       0, 1, CIFS_TLINK_MASTER_TAG);
> -       spin_unlock(&cifs_sb->tlink_tree_lock);
> -
> -       /* the master tcon should always be present */
> -       if (ret == 0)
> -               BUG();
> -
> -       return tlink;
> +       return cifs_sb->master_tlink;
>  }
>
>  struct cifsTconInfo *
> --
> 1.7.2.3
>
>

Reviewed-by: Shirish Pargaonkar <shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

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

end of thread, other threads:[~2010-10-28 19:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-28 17:33 [PATCH 1/2] cifs: store pointer to master tlink in superblock (try #2) Jeff Layton
     [not found] ` <1288287218-25100-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-10-28 19:22   ` Shirish Pargaonkar

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.