[Cluster-devel] Re: GFS2: Allow all meta/normal mount combinations

Christoph Hellwig hch at infradead.org
Fri Jun 5 14:09:18 UTC 2009


On Fri, Jun 05, 2009 at 02:52:16PM +0100, Steven Whitehouse wrote:
> +static int gfs2_get_sb(struct file_system_type *fs_type, int flags,
> +		       const char *dev_name, void *data, struct vfsmount *mnt)
> +{
> +	struct super_block *s;
> +	struct gfs2_sbd *sdp;
> +	int ret;
> +
> +	/* First we assume its a block device */
> +	ret = get_sb_bdev(fs_type, flags, dev_name, data, fill_super, mnt);
> +	if (ret != -ENOTBLK)
> +		return ret;
> +
> +	/* If that fails, we assume its a GFS2 inode on an existing sb */
> +	s = get_gfs2_sb(dev_name);
> +	if (IS_ERR(s)) {
> +		printk(KERN_WARNING "GFS2: gfs2 mount does not exist\n");
> +		return PTR_ERR(s);
> +	}

This is pretty ugly.  Even if this is how the old gfs2meta filesystem
worked I would prefer to only allow it if mounted as type gfs2meta, not
for normal gfs2 mount and gradually phase it out.

> +	sdp = s->s_fs_info;
> +	mnt->mnt_sb = s;
> +	mnt->mnt_root = gfs2_is_meta_fs(data) ? dget(sdp->sd_master_dir) :
> +						dget(sdp->sd_root_dir);

	if (gfs2_is_meta_fs(data))
		mnt->mnt_root = dget(sdp->sd_master_dir);
	else
		mnt->mnt_root = dget(sdp->sd_root_dir);

would be a lot more readable..




More information about the Cluster-devel mailing list