linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: andros@netapp.com
To: bhalevy@panasas.com
Cc: linux-nfs@vger.kernel.org, Andy Adamson <andros@netapp.com>
Subject: [PATCH 13/13] SQUASHME pnfs_submit: cleanup nfs4_pnfs_ds_add
Date: Wed, 28 Apr 2010 18:24:25 -0400	[thread overview]
Message-ID: <1272493465-3398-14-git-send-email-andros@netapp.com> (raw)
In-Reply-To: <1272493465-3398-13-git-send-email-andros@netapp.com>

From: Andy Adamson <andros@netapp.com>

Only initialize struct nfs4_pnfs_ds_add when using it.

Signed-off-by: Andy Adamson <andros@netapp.com>
---
 fs/nfs/nfs4filelayoutdev.c |   26 ++++++++++++--------------
 1 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c
index 61a3381..8bd2544 100644
--- a/fs/nfs/nfs4filelayoutdev.c
+++ b/fs/nfs/nfs4filelayoutdev.c
@@ -273,31 +273,29 @@ nfs4_pnfs_ds_add(struct inode *inode, struct nfs4_pnfs_ds **dsp,
 	if (!ds)
 		return;
 
-	/* Initialize ds */
-	ds->ds_ip_addr = ip_addr;
-	ds->ds_port = port;
-	strncpy(ds->r_addr, r_addr, len);
-	atomic_set(&ds->ds_count, 1);
-	INIT_LIST_HEAD(&ds->ds_node);
-	ds->ds_clp = NULL;
-
 	spin_lock(&nfs4_ds_cache_lock);
 	tmp_ds = _data_server_lookup(ip_addr, port);
 	if (tmp_ds == NULL) {
-		dprintk("%s add new data server ip 0x%x\n", __func__,
-				ds->ds_ip_addr);
+		ds->ds_ip_addr = ip_addr;
+		ds->ds_port = port;
+		strncpy(ds->r_addr, r_addr, len);
+		atomic_set(&ds->ds_count, 1);
+		INIT_LIST_HEAD(&ds->ds_node);
+		ds->ds_clp = NULL;
 		list_add(&ds->ds_node, &nfs4_data_server_cache);
 		*dsp = ds;
+		dprintk("%s add new data server ip 0x%x\n", __func__,
+				ds->ds_ip_addr);
+		spin_unlock(&nfs4_ds_cache_lock);
 	} else {
 		atomic_inc(&tmp_ds->ds_count);
+		*dsp = tmp_ds;
 		dprintk("%s data server found ip 0x%x, inc'ed ds_count to %d\n",
 				__func__, tmp_ds->ds_ip_addr,
 				atomic_read(&tmp_ds->ds_count));
-		*dsp = tmp_ds;
+		spin_unlock(&nfs4_ds_cache_lock);
+		kfree(ds);
 	}
-	spin_unlock(&nfs4_ds_cache_lock);
-	if (tmp_ds != NULL)
-		destroy_ds(ds);
 }
 
 static struct nfs4_pnfs_ds *
-- 
1.6.6


  reply	other threads:[~2010-04-28 21:24 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-28 22:24 [PATCH 0/13] Remove non-file layout code from submit tree andros
2010-04-28 22:24 ` [PATCH 01/13] SQUASHME pnfs_submit: remove GETDEVICELIST andros
2010-04-28 22:24   ` [PATCH 02/13] SQUASHME pnfs_submit: remove CB_NOTIFY_DEVICEID andros
2010-04-28 22:24     ` [PATCH 03/13] SQUASHME pnfs_submit: remove pnfs_mount_type from alloc_layout andros
2010-04-28 22:24       ` [PATCH 04/13] SQUASHME pnfs_submit: remove get_blocksize policy operation andros
2010-04-28 22:24         ` [PATCH 05/13] SQUASHME pnfs_submit: remove ds_wsize, ds_rsize, ds_wpages and ds_rpages andros
2010-04-28 22:24           ` [PATCH 06/13] SQUASHME pnfs_submit: remove uninitialize_mountpoint andros
2010-04-28 22:24             ` [PATCH 07/13] SQUASHME pnfs_submit: remove struct pnfs_mount_type andros
2010-04-28 22:24               ` [PATCH 08/13] SQUASHME pnfs_submit: change initialize_mountpoint parameters andros
2010-04-28 22:24                 ` [PATCH 09/13] SQUASHME pnfs_submit: change nfs_fsino layoutclass name andros
2010-04-28 22:24                   ` [PATCH 10/13] SQUASHME pnfs_submit: remove pnfs_fs_ltype andros
2010-04-28 22:24                     ` [PATCH 11/13] SQUASHME pnfs_submit: remove layout_name andros
2010-04-28 22:24                       ` [PATCH 12/13] SQUASHME pnfs_submit: fall back to MDS on filelayout_commit error andros
2010-04-28 22:24                         ` andros [this message]
2010-04-29 16:28               ` [PATCH 07/13] SQUASHME pnfs_submit: remove struct pnfs_mount_type Boaz Harrosh
2010-04-29 16:27             ` [PATCH 06/13] SQUASHME pnfs_submit: remove uninitialize_mountpoint Boaz Harrosh
2010-04-29 17:03               ` Boaz Harrosh
2010-04-29 17:14                 ` Andy Adamson
2010-04-29 17:15                   ` Boaz Harrosh
  -- strict thread matches above, loose matches on Subject: below --
2010-04-29 20:34 [PATCH 0/13] Remove non-file layout code from submit tree version 2 andros
2010-04-29 20:34 ` [PATCH 01/13] SQUASHME pnfs_submit: remove GETDEVICELIST andros
2010-04-29 20:34   ` [PATCH 02/13] SQUASHME pnfs_submit: remove CB_NOTIFY_DEVICEID andros
2010-04-29 20:34     ` [PATCH 03/13] SQUASHME pnfs_submit: remove pnfs_mount_type from alloc_layout andros
2010-04-29 20:34       ` [PATCH 04/13] SQUASHME pnfs_submit: remove get_blocksize policy operation andros
2010-04-29 20:34         ` [PATCH 05/13] SQUASHME pnfs_submit: remove ds_wsize, ds_rsize, ds_wpages and ds_rpages andros
2010-04-29 20:34           ` [PATCH 06/13] SQUASHME pnfs_submit: update uninitialize_mountpoint andros
2010-04-29 20:34             ` [PATCH 07/13] SQUASHME pnfs_submit: remove struct pnfs_mount_type andros
2010-04-29 20:34               ` [PATCH 08/13] SQUASHME pnfs_submit: change initialize_mountpoint parameters andros
2010-04-29 20:34                 ` [PATCH 09/13] SQUASHME pnfs_submit: change nfs_fsino layoutclass name andros
2010-04-29 20:34                   ` [PATCH 10/13] SQUASHME pnfs_submit: remove pnfs_fs_ltype andros
2010-04-29 20:34                     ` [PATCH 11/13] SQUASHME pnfs_submit: remove layout_name andros
2010-04-29 20:34                       ` [PATCH 12/13] SQUASHME pnfs_submit: fall back to MDS on filelayout_commit error andros
2010-04-29 20:34                         ` [PATCH 13/13] SQUASHME pnfs_submit: cleanup nfs4_pnfs_ds_add andros

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=1272493465-3398-14-git-send-email-andros@netapp.com \
    --to=andros@netapp.com \
    --cc=bhalevy@panasas.com \
    --cc=linux-nfs@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).