Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Sean Finney <seanius-ADwgVSpYHhHR7s880joybQ@public.gmane.org>
Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v4 6/6] cifs: Unconditionally copy mount options to superblock info
Date: Fri, 8 Apr 2011 09:54:35 -0400	[thread overview]
Message-ID: <20110408095435.09d8cadd@corrin.poochiereds.net> (raw)
In-Reply-To: <1302100005-1848-6-git-send-email-seanius-ADwgVSpYHhHR7s880joybQ@public.gmane.org>

On Wed, 6 Apr 2011 16:26:45 +0200
Sean Finney <seanius-ADwgVSpYHhHR7s880joybQ@public.gmane.org> wrote:

> Previously mount options were copied and updated in the cifs_sb_info
> struct only when CONFIG_CIFS_DFS_UPCALL was enabled.  Making this
> information generally available allows us to remove a number of ifdefs,
> extra function params, and temporary variables.
> 
> Signed-off-by: Sean Finney <seanius-ADwgVSpYHhHR7s880joybQ@public.gmane.org>
> ---
>  fs/cifs/cifs_fs_sb.h |    4 +---
>  fs/cifs/cifsfs.c     |    8 +-------
>  fs/cifs/cifsproto.h  |    2 +-
>  fs/cifs/connect.c    |    8 +++-----
>  4 files changed, 6 insertions(+), 16 deletions(-)
> 
> diff --git a/fs/cifs/cifs_fs_sb.h b/fs/cifs/cifs_fs_sb.h
> index 1ef54ab..adecd36 100644
> --- a/fs/cifs/cifs_fs_sb.h
> +++ b/fs/cifs/cifs_fs_sb.h
> @@ -60,9 +60,7 @@ struct cifs_sb_info {
>  	unsigned int mnt_cifs_flags;
>  	int	prepathlen;
>  	char   *prepath; /* relative path under the share to mount to */
> -#ifdef CONFIG_CIFS_DFS_UPCALL
> -	char   *mountdata; /* mount options received at mount time */
> -#endif
> +	char   *mountdata; /* options received at mount time or via DFS refs */
>  	struct backing_dev_info bdi;
>  	struct delayed_work prune_tlinks;
>  };
> diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
> index cf8a610..c89a699 100644
> --- a/fs/cifs/cifsfs.c
> +++ b/fs/cifs/cifsfs.c
> @@ -133,7 +133,6 @@ cifs_read_super(struct super_block *sb, void *data,
>  	}
>  	cifs_sb->bdi.ra_pages = default_backing_dev_info.ra_pages;
>  
> -#ifdef CONFIG_CIFS_DFS_UPCALL
>  	/*
>  	 * Copy mount params to sb for use in submounts. Better to do
>  	 * the copy here and deal with the error before cleanup gets
> @@ -149,9 +148,8 @@ cifs_read_super(struct super_block *sb, void *data,
>  			return -ENOMEM;
>  		}
>  	}
> -#endif
>  
> -	rc = cifs_mount(sb, cifs_sb, data, devname);
> +	rc = cifs_mount(sb, cifs_sb, devname);
>  
>  	if (rc) {
>  		if (!silent)
> @@ -203,12 +201,10 @@ out_no_root:
>  
>  out_mount_failed:
>  	if (cifs_sb) {
> -#ifdef CONFIG_CIFS_DFS_UPCALL
>  		if (cifs_sb->mountdata) {
>  			kfree(cifs_sb->mountdata);
>  			cifs_sb->mountdata = NULL;
>  		}
> -#endif
>  		unload_nls(cifs_sb->local_nls);
>  		bdi_destroy(&cifs_sb->bdi);
>  		kfree(cifs_sb);
> @@ -232,12 +228,10 @@ cifs_put_super(struct super_block *sb)
>  	rc = cifs_umount(sb, cifs_sb);
>  	if (rc)
>  		cERROR(1, "cifs_umount failed with return code %d", rc);
> -#ifdef CONFIG_CIFS_DFS_UPCALL
>  	if (cifs_sb->mountdata) {
>  		kfree(cifs_sb->mountdata);
>  		cifs_sb->mountdata = NULL;
>  	}
> -#endif
>  
>  	unload_nls(cifs_sb->local_nls);
>  	bdi_destroy(&cifs_sb->bdi);
> diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
> index 76c4dc7f..9985f99 100644
> --- a/fs/cifs/cifsproto.h
> +++ b/fs/cifs/cifsproto.h
> @@ -146,7 +146,7 @@ extern struct cifs_ntsd *get_cifs_acl(struct cifs_sb_info *, struct inode *,
>  extern int set_cifs_acl(struct cifs_ntsd *, __u32, struct inode *,
>  				const char *);
>  
> -extern int cifs_mount(struct super_block *, struct cifs_sb_info *, char *,
> +extern int cifs_mount(struct super_block *, struct cifs_sb_info *,
>  			const char *);
>  extern int cifs_umount(struct super_block *, struct cifs_sb_info *);
>  extern void cifs_dfs_release_automount_timer(void);
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 8d2529c..3ab54a0 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -2839,7 +2839,7 @@ expand_dfs_referral(int xid, struct cifs_ses *pSesInfo,
>  
>  int
>  cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
> -		char *mount_data_global, const char *devname)
> +		const char *devname)
>  {
>  	int rc;
>  	int xid;
> @@ -2848,13 +2848,10 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
>  	struct cifs_tcon *tcon;
>  	struct TCP_Server_Info *srvTcp;
>  	char   *full_path;
> -	char *mount_data = mount_data_global;
>  	struct tcon_link *tlink;
>  #ifdef CONFIG_CIFS_DFS_UPCALL
>  	int referral_walks_count = 0;
>  try_mount_again:
> -	mount_data = cifs_sb->mountdata;
> -
>  	/* cleanup activities if we're chasing a referral */
>  	if (referral_walks_count) {
>  		if (tcon)
> @@ -2881,7 +2878,8 @@ try_mount_again:
>  		goto out;
>  	}
>  
> -	if (cifs_parse_mount_options(mount_data, devname, volume_info)) {
> +	if (cifs_parse_mount_options(cifs_sb->mountdata, devname,
> +				     volume_info)) {
>  		rc = -EINVAL;
>  		goto out;
>  	}

Nice cleanup. Always nice to get rid of nasty #ifdef-ery:

Reviewed-by: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

  parent reply	other threads:[~2011-04-08 13:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-06 14:26 [PATCH v4 1/6] cifs: Extract DFS referral expansion logic to separate function Sean Finney
     [not found] ` <1302100005-1848-1-git-send-email-seanius-ADwgVSpYHhHR7s880joybQ@public.gmane.org>
2011-04-06 14:26   ` [PATCH v4 2/6] cifs: Add support for mounting Windows 2008 DFS shares Sean Finney
     [not found]     ` <1302100005-1848-2-git-send-email-seanius-ADwgVSpYHhHR7s880joybQ@public.gmane.org>
2011-04-07 13:33       ` Jeff Layton
2011-04-06 14:26   ` [PATCH v4 3/6] cifs: cifs_parse_mount_options: do not tokenize mount options in-place Sean Finney
     [not found]     ` <1302100005-1848-3-git-send-email-seanius-ADwgVSpYHhHR7s880joybQ@public.gmane.org>
2011-04-08 13:48       ` Jeff Layton
2011-04-06 14:26   ` [PATCH v4 4/6] cifs: Simplify handling of submount options in cifs_mount Sean Finney
     [not found]     ` <1302100005-1848-4-git-send-email-seanius-ADwgVSpYHhHR7s880joybQ@public.gmane.org>
2011-04-08 13:50       ` Jeff Layton
2011-04-06 14:26   ` [PATCH v4 5/6] cifs: Use kstrndup for cifs_sb->mountdata Sean Finney
     [not found]     ` <1302100005-1848-5-git-send-email-seanius-ADwgVSpYHhHR7s880joybQ@public.gmane.org>
2011-04-08 13:53       ` Jeff Layton
     [not found]         ` <20110408095333.2dab9301-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2011-04-08 14:28           ` Sean Finney
2011-04-06 14:26   ` [PATCH v4 6/6] cifs: Unconditionally copy mount options to superblock info Sean Finney
     [not found]     ` <1302100005-1848-6-git-send-email-seanius-ADwgVSpYHhHR7s880joybQ@public.gmane.org>
2011-04-08 13:54       ` Jeff Layton [this message]
2011-04-26  5:43   ` [PATCH v4 1/6] cifs: Extract DFS referral expansion logic to separate function Suresh Jayaraman
     [not found]     ` <4DB65B74.7050706-l3A5Bk7waGM@public.gmane.org>
2011-04-26 11:40       ` Sean Finney

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=20110408095435.09d8cadd@corrin.poochiereds.net \
    --to=jlayton-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=seanius-ADwgVSpYHhHR7s880joybQ@public.gmane.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