aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exofs/super.c
diff options
context:
space:
mode:
authorBoaz Harrosh <bharrosh@panasas.com>2011-01-31 07:32:14 -0500
committerBoaz Harrosh <bharrosh@panasas.com>2011-03-15 09:02:51 -0400
commit9ed96484311b89360b80a4181d856cbdb21630fd (patch)
treeef372f43e6bfdf86d273d80491e7de801b69395f /fs/exofs/super.c
parent66cd6cad4919f980dd21307d0150ff251762a264 (diff)
exofs: Add option to mount by osdname
If /dev/osd* devices are shuffled because more devices where added, and/or login order has changed. It is hard to mount the FS you want. Add an option to mount by osdname. osdname is any osd-device's osdname as specified to the mkfs.exofs command when formatting the osd-devices. The new mount format is: OPT="osdname=$UUID0,pid=$PID,_netdev" mount -t exofs -o $OPT $DEV_OSD0 $MOUNTDIR if "osdname=" is specified in options above $DEV_OSD0 is ignored and can be empty. Also while at it: Removed some old unused Opt_* enums. Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Diffstat (limited to 'fs/exofs/super.c')
-rw-r--r--fs/exofs/super.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/fs/exofs/super.c b/fs/exofs/super.c
index e87510f4749e..474989eeb7d6 100644
--- a/fs/exofs/super.c
+++ b/fs/exofs/super.c
@@ -48,6 +48,7 @@
48 * struct to hold what we get from mount options 48 * struct to hold what we get from mount options
49 */ 49 */
50struct exofs_mountopt { 50struct exofs_mountopt {
51 bool is_osdname;
51 const char *dev_name; 52 const char *dev_name;
52 uint64_t pid; 53 uint64_t pid;
53 int timeout; 54 int timeout;
@@ -56,7 +57,7 @@ struct exofs_mountopt {
56/* 57/*
57 * exofs-specific mount-time options. 58 * exofs-specific mount-time options.
58 */ 59 */
59enum { Opt_pid, Opt_to, Opt_mkfs, Opt_format, Opt_err }; 60enum { Opt_name, Opt_pid, Opt_to, Opt_err };
60 61
61/* 62/*
62 * Our mount-time options. These should ideally be 64-bit unsigned, but the 63 * Our mount-time options. These should ideally be 64-bit unsigned, but the
@@ -64,6 +65,7 @@ enum { Opt_pid, Opt_to, Opt_mkfs, Opt_format, Opt_err };
64 * sufficient for most applications now. 65 * sufficient for most applications now.
65 */ 66 */
66static match_table_t tokens = { 67static match_table_t tokens = {
68 {Opt_name, "osdname=%s"},
67 {Opt_pid, "pid=%u"}, 69 {Opt_pid, "pid=%u"},
68 {Opt_to, "to=%u"}, 70 {Opt_to, "to=%u"},
69 {Opt_err, NULL} 71 {Opt_err, NULL}
@@ -94,6 +96,14 @@ static int parse_options(char *options, struct exofs_mountopt *opts)
94 96
95 token = match_token(p, tokens, args); 97 token = match_token(p, tokens, args);
96 switch (token) { 98 switch (token) {
99 case Opt_name:
100 opts->dev_name = match_strdup(&args[0]);
101 if (unlikely(!opts->dev_name)) {
102 EXOFS_ERR("Error allocating dev_name");
103 return -ENOMEM;
104 }
105 opts->is_osdname = true;
106 break;
97 case Opt_pid: 107 case Opt_pid:
98 if (0 == match_strlcpy(str, &args[0], sizeof(str))) 108 if (0 == match_strlcpy(str, &args[0], sizeof(str)))
99 return -EINVAL; 109 return -EINVAL;
@@ -575,9 +585,17 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)
575 goto free_bdi; 585 goto free_bdi;
576 586
577 /* use mount options to fill superblock */ 587 /* use mount options to fill superblock */
578 od = osduld_path_lookup(opts->dev_name); 588 if (opts->is_osdname) {
589 struct osd_dev_info odi = {.systemid_len = 0};
590
591 odi.osdname_len = strlen(opts->dev_name);
592 odi.osdname = (u8 *)opts->dev_name;
593 od = osduld_info_lookup(&odi);
594 } else {
595 od = osduld_path_lookup(opts->dev_name);
596 }
579 if (IS_ERR(od)) { 597 if (IS_ERR(od)) {
580 ret = PTR_ERR(od); 598 ret = -EINVAL;
581 goto free_sbi; 599 goto free_sbi;
582 } 600 }
583 601
@@ -670,6 +688,8 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)
670 688
671 _exofs_print_device("Mounting", opts->dev_name, sbi->layout.s_ods[0], 689 _exofs_print_device("Mounting", opts->dev_name, sbi->layout.s_ods[0],
672 sbi->layout.s_pid); 690 sbi->layout.s_pid);
691 if (opts->is_osdname)
692 kfree(opts->dev_name);
673 return 0; 693 return 0;
674 694
675free_sbi: 695free_sbi:
@@ -678,6 +698,8 @@ free_bdi:
678 EXOFS_ERR("Unable to mount exofs on %s pid=0x%llx err=%d\n", 698 EXOFS_ERR("Unable to mount exofs on %s pid=0x%llx err=%d\n",
679 opts->dev_name, sbi->layout.s_pid, ret); 699 opts->dev_name, sbi->layout.s_pid, ret);
680 exofs_free_sbi(sbi); 700 exofs_free_sbi(sbi);
701 if (opts->is_osdname)
702 kfree(opts->dev_name);
681 return ret; 703 return ret;
682} 704}
683 705
@@ -695,7 +717,8 @@ static struct dentry *exofs_mount(struct file_system_type *type,
695 if (ret) 717 if (ret)
696 return ERR_PTR(ret); 718 return ERR_PTR(ret);
697 719
698 opts.dev_name = dev_name; 720 if (!opts.dev_name)
721 opts.dev_name = dev_name;
699 return mount_nodev(type, flags, &opts, exofs_fill_super); 722 return mount_nodev(type, flags, &opts, exofs_fill_super);
700} 723}
701 724