ceph/super.c: quiet sparse noise
[linux-3.10.git] / fs / ceph / super.c
index d4757c9..a90846f 100644 (file)
@@ -114,6 +114,7 @@ static int ceph_sync_fs(struct super_block *sb, int wait)
 enum {
        Opt_wsize,
        Opt_rsize,
+       Opt_rasize,
        Opt_caps_wanted_delay_min,
        Opt_caps_wanted_delay_max,
        Opt_cap_release_safety,
@@ -136,6 +137,7 @@ enum {
 static match_table_t fsopt_tokens = {
        {Opt_wsize, "wsize=%d"},
        {Opt_rsize, "rsize=%d"},
+       {Opt_rasize, "rasize=%d"},
        {Opt_caps_wanted_delay_min, "caps_wanted_delay_min=%d"},
        {Opt_caps_wanted_delay_max, "caps_wanted_delay_max=%d"},
        {Opt_cap_release_safety, "cap_release_safety=%d"},
@@ -196,6 +198,9 @@ static int parse_fsopt_token(char *c, void *private)
        case Opt_rsize:
                fsopt->rsize = intval;
                break;
+       case Opt_rasize:
+               fsopt->rasize = intval;
+               break;
        case Opt_caps_wanted_delay_min:
                fsopt->caps_wanted_delay_min = intval;
                break;
@@ -289,28 +294,29 @@ static int parse_mount_options(struct ceph_mount_options **pfsopt,
 
        dout("parse_mount_options %p, dev_name '%s'\n", fsopt, dev_name);
 
-        fsopt->sb_flags = flags;
-        fsopt->flags = CEPH_MOUNT_OPT_DEFAULT;
+       fsopt->sb_flags = flags;
+       fsopt->flags = CEPH_MOUNT_OPT_DEFAULT;
 
-        fsopt->rsize = CEPH_RSIZE_DEFAULT;
-        fsopt->snapdir_name = kstrdup(CEPH_SNAPDIRNAME_DEFAULT, GFP_KERNEL);
+       fsopt->rsize = CEPH_RSIZE_DEFAULT;
+       fsopt->rasize = CEPH_RASIZE_DEFAULT;
+       fsopt->snapdir_name = kstrdup(CEPH_SNAPDIRNAME_DEFAULT, GFP_KERNEL);
        fsopt->caps_wanted_delay_min = CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT;
        fsopt->caps_wanted_delay_max = CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT;
-        fsopt->cap_release_safety = CEPH_CAP_RELEASE_SAFETY_DEFAULT;
-        fsopt->max_readdir = CEPH_MAX_READDIR_DEFAULT;
-        fsopt->max_readdir_bytes = CEPH_MAX_READDIR_BYTES_DEFAULT;
-        fsopt->congestion_kb = default_congestion_kb();
-       
-        /* ip1[:port1][,ip2[:port2]...]:/subdir/in/fs */
-        err = -EINVAL;
-        if (!dev_name)
-                goto out;
-        *path = strstr(dev_name, ":/");
-        if (*path == NULL) {
-                pr_err("device name is missing path (no :/ in %s)\n",
-                       dev_name);
-                goto out;
-        }
+       fsopt->cap_release_safety = CEPH_CAP_RELEASE_SAFETY_DEFAULT;
+       fsopt->max_readdir = CEPH_MAX_READDIR_DEFAULT;
+       fsopt->max_readdir_bytes = CEPH_MAX_READDIR_BYTES_DEFAULT;
+       fsopt->congestion_kb = default_congestion_kb();
+
+       /* ip1[:port1][,ip2[:port2]...]:/subdir/in/fs */
+       err = -EINVAL;
+       if (!dev_name)
+               goto out;
+       *path = strstr(dev_name, ":/");
+       if (*path == NULL) {
+               pr_err("device name is missing path (no :/ in %s)\n",
+                               dev_name);
+               goto out;
+       }
        dev_name_end = *path;
        dout("device name '%.*s'\n", (int)(dev_name_end - dev_name), dev_name);
 
@@ -376,6 +382,8 @@ static int ceph_show_options(struct seq_file *m, struct vfsmount *mnt)
                seq_printf(m, ",wsize=%d", fsopt->wsize);
        if (fsopt->rsize != CEPH_RSIZE_DEFAULT)
                seq_printf(m, ",rsize=%d", fsopt->rsize);
+       if (fsopt->rasize != CEPH_RASIZE_DEFAULT)
+               seq_printf(m, ",rasize=%d", fsopt->rsize);
        if (fsopt->congestion_kb != default_congestion_kb())
                seq_printf(m, ",write_congestion_kb=%d", fsopt->congestion_kb);
        if (fsopt->caps_wanted_delay_min != CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT)
@@ -418,24 +426,27 @@ static int extra_mon_dispatch(struct ceph_client *client, struct ceph_msg *msg)
 /*
  * create a new fs client
  */
-struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt,
+static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt,
                                        struct ceph_options *opt)
 {
        struct ceph_fs_client *fsc;
+       const unsigned supported_features =
+               CEPH_FEATURE_FLOCK |
+               CEPH_FEATURE_DIRLAYOUTHASH;
+       const unsigned required_features = 0;
        int err = -ENOMEM;
 
        fsc = kzalloc(sizeof(*fsc), GFP_KERNEL);
        if (!fsc)
                return ERR_PTR(-ENOMEM);
 
-       fsc->client = ceph_create_client(opt, fsc);
+       fsc->client = ceph_create_client(opt, fsc, supported_features,
+                                        required_features);
        if (IS_ERR(fsc->client)) {
                err = PTR_ERR(fsc->client);
                goto fail;
        }
        fsc->client->extra_mon_dispatch = extra_mon_dispatch;
-       fsc->client->supported_features |= CEPH_FEATURE_FLOCK |
-               CEPH_FEATURE_DIRLAYOUTHASH;
        fsc->client->monc.want_mdsmap = 1;
 
        fsc->mount_options = fsopt;
@@ -491,7 +502,7 @@ fail:
        return ERR_PTR(err);
 }
 
-void destroy_fs_client(struct ceph_fs_client *fsc)
+static void destroy_fs_client(struct ceph_fs_client *fsc)
 {
        dout("destroy_fs_client %p\n", fsc);
 
@@ -774,11 +785,15 @@ static int ceph_register_bdi(struct super_block *sb,
 {
        int err;
 
-       /* set ra_pages based on rsize mount option? */
-       if (fsc->mount_options->rsize >= PAGE_CACHE_SIZE)
+       /* set ra_pages based on rasize mount option? */
+       if (fsc->mount_options->rasize >= PAGE_CACHE_SIZE)
                fsc->backing_dev_info.ra_pages =
-                       (fsc->mount_options->rsize + PAGE_CACHE_SIZE - 1)
+                       (fsc->mount_options->rasize + PAGE_CACHE_SIZE - 1)
                        >> PAGE_SHIFT;
+       else
+               fsc->backing_dev_info.ra_pages =
+                       default_backing_dev_info.ra_pages;
+
        err = bdi_register(&fsc->backing_dev_info, NULL, "ceph-%d",
                           atomic_long_inc_return(&bdi_seq));
        if (!err)
@@ -809,8 +824,8 @@ static struct dentry *ceph_mount(struct file_system_type *fs_type,
        fsc = create_fs_client(fsopt, opt);
        if (IS_ERR(fsc)) {
                res = ERR_CAST(fsc);
-               kfree(fsopt);
-               kfree(opt);
+               destroy_mount_options(fsopt);
+               ceph_destroy_options(opt);
                goto out_final;
        }