diff options
author | Sage Weil <sage@newdream.net> | 2010-04-29 19:38:32 -0400 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2010-05-17 18:25:29 -0400 |
commit | 6e19a16ef28aee09dbcbb9f3ff24ac4f439def7d (patch) | |
tree | e66eb2ff60ebd79eec5d06dd6360b3046d294da0 /fs/ceph/super.c | |
parent | 1cd3935bedccf592d44343890251452a6dd74fc4 (diff) |
ceph: clean up mount options, ->show_options()
Ensure all options are included in /proc/mounts. Some cleanup.
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/super.c')
-rw-r--r-- | fs/ceph/super.c | 90 |
1 files changed, 59 insertions, 31 deletions
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index b3225bf63f58..34b16cb302fe 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c | |||
@@ -110,6 +110,34 @@ static int ceph_syncfs(struct super_block *sb, int wait) | |||
110 | return 0; | 110 | return 0; |
111 | } | 111 | } |
112 | 112 | ||
113 | static int default_congestion_kb(void) | ||
114 | { | ||
115 | int congestion_kb; | ||
116 | |||
117 | /* | ||
118 | * Copied from NFS | ||
119 | * | ||
120 | * congestion size, scale with available memory. | ||
121 | * | ||
122 | * 64MB: 8192k | ||
123 | * 128MB: 11585k | ||
124 | * 256MB: 16384k | ||
125 | * 512MB: 23170k | ||
126 | * 1GB: 32768k | ||
127 | * 2GB: 46340k | ||
128 | * 4GB: 65536k | ||
129 | * 8GB: 92681k | ||
130 | * 16GB: 131072k | ||
131 | * | ||
132 | * This allows larger machines to have larger/more transfers. | ||
133 | * Limit the default to 256M | ||
134 | */ | ||
135 | congestion_kb = (16*int_sqrt(totalram_pages)) << (PAGE_SHIFT-10); | ||
136 | if (congestion_kb > 256*1024) | ||
137 | congestion_kb = 256*1024; | ||
138 | |||
139 | return congestion_kb; | ||
140 | } | ||
113 | 141 | ||
114 | /** | 142 | /** |
115 | * ceph_show_options - Show mount options in /proc/mounts | 143 | * ceph_show_options - Show mount options in /proc/mounts |
@@ -135,6 +163,33 @@ static int ceph_show_options(struct seq_file *m, struct vfsmount *mnt) | |||
135 | seq_puts(m, ",nocrc"); | 163 | seq_puts(m, ",nocrc"); |
136 | if (args->flags & CEPH_OPT_NOASYNCREADDIR) | 164 | if (args->flags & CEPH_OPT_NOASYNCREADDIR) |
137 | seq_puts(m, ",noasyncreaddir"); | 165 | seq_puts(m, ",noasyncreaddir"); |
166 | |||
167 | if (args->mount_timeout != CEPH_MOUNT_TIMEOUT_DEFAULT) | ||
168 | seq_printf(m, ",mount_timeout=%d", args->mount_timeout); | ||
169 | if (args->osd_idle_ttl != CEPH_OSD_IDLE_TTL_DEFAULT) | ||
170 | seq_printf(m, ",osd_idle_ttl=%d", args->osd_idle_ttl); | ||
171 | if (args->osd_timeout != CEPH_OSD_TIMEOUT_DEFAULT) | ||
172 | seq_printf(m, ",osdtimeout=%d", args->osd_timeout); | ||
173 | if (args->osd_keepalive_timeout != CEPH_OSD_KEEPALIVE_DEFAULT) | ||
174 | seq_printf(m, ",osdkeepalivetimeout=%d", | ||
175 | args->osd_keepalive_timeout); | ||
176 | if (args->wsize) | ||
177 | seq_printf(m, ",wsize=%d", args->wsize); | ||
178 | if (args->rsize != CEPH_MOUNT_RSIZE_DEFAULT) | ||
179 | seq_printf(m, ",rsize=%d", args->rsize); | ||
180 | if (args->congestion_kb != default_congestion_kb()) | ||
181 | seq_printf(m, ",write_congestion_kb=%d", args->congestion_kb); | ||
182 | if (args->caps_wanted_delay_min != CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT) | ||
183 | seq_printf(m, ",caps_wanted_delay_min=%d", | ||
184 | args->caps_wanted_delay_min); | ||
185 | if (args->caps_wanted_delay_max != CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT) | ||
186 | seq_printf(m, ",caps_wanted_delay_max=%d", | ||
187 | args->caps_wanted_delay_max); | ||
188 | if (args->cap_release_safety != CEPH_CAP_RELEASE_SAFETY_DEFAULT) | ||
189 | seq_printf(m, ",cap_release_safety=%d", | ||
190 | args->cap_release_safety); | ||
191 | if (args->max_readdir != CEPH_MAX_READDIR_DEFAULT) | ||
192 | seq_printf(m, ",readdir_max_entries=%d", args->max_readdir); | ||
138 | if (strcmp(args->snapdir_name, CEPH_SNAPDIRNAME_DEFAULT)) | 193 | if (strcmp(args->snapdir_name, CEPH_SNAPDIRNAME_DEFAULT)) |
139 | seq_printf(m, ",snapdirname=%s", args->snapdir_name); | 194 | seq_printf(m, ",snapdirname=%s", args->snapdir_name); |
140 | if (args->name) | 195 | if (args->name) |
@@ -158,35 +213,6 @@ static void ceph_inode_init_once(void *foo) | |||
158 | inode_init_once(&ci->vfs_inode); | 213 | inode_init_once(&ci->vfs_inode); |
159 | } | 214 | } |
160 | 215 | ||
161 | static int default_congestion_kb(void) | ||
162 | { | ||
163 | int congestion_kb; | ||
164 | |||
165 | /* | ||
166 | * Copied from NFS | ||
167 | * | ||
168 | * congestion size, scale with available memory. | ||
169 | * | ||
170 | * 64MB: 8192k | ||
171 | * 128MB: 11585k | ||
172 | * 256MB: 16384k | ||
173 | * 512MB: 23170k | ||
174 | * 1GB: 32768k | ||
175 | * 2GB: 46340k | ||
176 | * 4GB: 65536k | ||
177 | * 8GB: 92681k | ||
178 | * 16GB: 131072k | ||
179 | * | ||
180 | * This allows larger machines to have larger/more transfers. | ||
181 | * Limit the default to 256M | ||
182 | */ | ||
183 | congestion_kb = (16*int_sqrt(totalram_pages)) << (PAGE_SHIFT-10); | ||
184 | if (congestion_kb > 256*1024) | ||
185 | congestion_kb = 256*1024; | ||
186 | |||
187 | return congestion_kb; | ||
188 | } | ||
189 | |||
190 | static int __init init_caches(void) | 216 | static int __init init_caches(void) |
191 | { | 217 | { |
192 | ceph_inode_cachep = kmem_cache_create("ceph_inode_info", | 218 | ceph_inode_cachep = kmem_cache_create("ceph_inode_info", |
@@ -305,6 +331,7 @@ enum { | |||
305 | Opt_osd_idle_ttl, | 331 | Opt_osd_idle_ttl, |
306 | Opt_caps_wanted_delay_min, | 332 | Opt_caps_wanted_delay_min, |
307 | Opt_caps_wanted_delay_max, | 333 | Opt_caps_wanted_delay_max, |
334 | Opt_cap_release_safety, | ||
308 | Opt_readdir_max_entries, | 335 | Opt_readdir_max_entries, |
309 | Opt_congestion_kb, | 336 | Opt_congestion_kb, |
310 | Opt_last_int, | 337 | Opt_last_int, |
@@ -336,6 +363,7 @@ static match_table_t arg_tokens = { | |||
336 | {Opt_osd_idle_ttl, "osd_idle_ttl=%d"}, | 363 | {Opt_osd_idle_ttl, "osd_idle_ttl=%d"}, |
337 | {Opt_caps_wanted_delay_min, "caps_wanted_delay_min=%d"}, | 364 | {Opt_caps_wanted_delay_min, "caps_wanted_delay_min=%d"}, |
338 | {Opt_caps_wanted_delay_max, "caps_wanted_delay_max=%d"}, | 365 | {Opt_caps_wanted_delay_max, "caps_wanted_delay_max=%d"}, |
366 | {Opt_cap_release_safety, "cap_release_safety=%d"}, | ||
339 | {Opt_readdir_max_entries, "readdir_max_entries=%d"}, | 367 | {Opt_readdir_max_entries, "readdir_max_entries=%d"}, |
340 | {Opt_congestion_kb, "write_congestion_kb=%d"}, | 368 | {Opt_congestion_kb, "write_congestion_kb=%d"}, |
341 | /* int args above */ | 369 | /* int args above */ |
@@ -385,8 +413,8 @@ static struct ceph_mount_args *parse_mount_args(int flags, char *options, | |||
385 | args->caps_wanted_delay_max = CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT; | 413 | args->caps_wanted_delay_max = CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT; |
386 | args->rsize = CEPH_MOUNT_RSIZE_DEFAULT; | 414 | args->rsize = CEPH_MOUNT_RSIZE_DEFAULT; |
387 | args->snapdir_name = kstrdup(CEPH_SNAPDIRNAME_DEFAULT, GFP_KERNEL); | 415 | args->snapdir_name = kstrdup(CEPH_SNAPDIRNAME_DEFAULT, GFP_KERNEL); |
388 | args->cap_release_safety = CEPH_CAPS_PER_RELEASE * 4; | 416 | args->cap_release_safety = CEPH_CAP_RELEASE_SAFETY_DEFAULT; |
389 | args->max_readdir = 1024; | 417 | args->max_readdir = CEPH_MAX_READDIR_DEFAULT; |
390 | args->congestion_kb = default_congestion_kb(); | 418 | args->congestion_kb = default_congestion_kb(); |
391 | 419 | ||
392 | /* ip1[:port1][,ip2[:port2]...]:/subdir/in/fs */ | 420 | /* ip1[:port1][,ip2[:port2]...]:/subdir/in/fs */ |