aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2010-04-29 19:38:32 -0400
committerSage Weil <sage@newdream.net>2010-05-17 18:25:29 -0400
commit6e19a16ef28aee09dbcbb9f3ff24ac4f439def7d (patch)
treee66eb2ff60ebd79eec5d06dd6360b3046d294da0 /fs/ceph
parent1cd3935bedccf592d44343890251452a6dd74fc4 (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')
-rw-r--r--fs/ceph/super.c90
-rw-r--r--fs/ceph/super.h19
2 files changed, 69 insertions, 40 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
113static 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
161static 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
190static int __init init_caches(void) 216static 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 */
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index 51b3ff238454..395adc5fcebb 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -52,24 +52,24 @@
52 52
53struct ceph_mount_args { 53struct ceph_mount_args {
54 int sb_flags; 54 int sb_flags;
55 int flags;
56 struct ceph_fsid fsid;
57 struct ceph_entity_addr my_addr;
55 int num_mon; 58 int num_mon;
56 struct ceph_entity_addr *mon_addr; 59 struct ceph_entity_addr *mon_addr;
57 int flags;
58 int mount_timeout; 60 int mount_timeout;
59 int osd_idle_ttl; 61 int osd_idle_ttl;
60 int caps_wanted_delay_min, caps_wanted_delay_max; 62 int osd_timeout;
61 struct ceph_fsid fsid; 63 int osd_keepalive_timeout;
62 struct ceph_entity_addr my_addr;
63 int wsize; 64 int wsize;
64 int rsize; /* max readahead */ 65 int rsize; /* max readahead */
66 int congestion_kb; /* max writeback in flight */
67 int caps_wanted_delay_min, caps_wanted_delay_max;
68 int cap_release_safety;
65 int max_readdir; /* max readdir size */ 69 int max_readdir; /* max readdir size */
66 int congestion_kb; /* max readdir size */
67 int osd_timeout;
68 int osd_keepalive_timeout;
69 char *snapdir_name; /* default ".snap" */ 70 char *snapdir_name; /* default ".snap" */
70 char *name; 71 char *name;
71 char *secret; 72 char *secret;
72 int cap_release_safety;
73}; 73};
74 74
75/* 75/*
@@ -80,13 +80,13 @@ struct ceph_mount_args {
80#define CEPH_OSD_KEEPALIVE_DEFAULT 5 80#define CEPH_OSD_KEEPALIVE_DEFAULT 5
81#define CEPH_OSD_IDLE_TTL_DEFAULT 60 81#define CEPH_OSD_IDLE_TTL_DEFAULT 60
82#define CEPH_MOUNT_RSIZE_DEFAULT (512*1024) /* readahead */ 82#define CEPH_MOUNT_RSIZE_DEFAULT (512*1024) /* readahead */
83#define CEPH_MAX_READDIR_DEFAULT 1024
83 84
84#define CEPH_MSG_MAX_FRONT_LEN (16*1024*1024) 85#define CEPH_MSG_MAX_FRONT_LEN (16*1024*1024)
85#define CEPH_MSG_MAX_DATA_LEN (16*1024*1024) 86#define CEPH_MSG_MAX_DATA_LEN (16*1024*1024)
86 87
87#define CEPH_SNAPDIRNAME_DEFAULT ".snap" 88#define CEPH_SNAPDIRNAME_DEFAULT ".snap"
88#define CEPH_AUTH_NAME_DEFAULT "guest" 89#define CEPH_AUTH_NAME_DEFAULT "guest"
89
90/* 90/*
91 * Delay telling the MDS we no longer want caps, in case we reopen 91 * Delay telling the MDS we no longer want caps, in case we reopen
92 * the file. Delay a minimum amount of time, even if we send a cap 92 * the file. Delay a minimum amount of time, even if we send a cap
@@ -96,6 +96,7 @@ struct ceph_mount_args {
96#define CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT 5 /* cap release delay */ 96#define CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT 5 /* cap release delay */
97#define CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT 60 /* cap release delay */ 97#define CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT 60 /* cap release delay */
98 98
99#define CEPH_CAP_RELEASE_SAFETY_DEFAULT (CEPH_CAPS_PER_RELEASE * 4)
99 100
100/* mount state */ 101/* mount state */
101enum { 102enum {