diff options
Diffstat (limited to 'fs/ceph/super.c')
-rw-r--r-- | fs/ceph/super.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 6d02a166f8ff..b9cb8cebcdc1 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c | |||
@@ -150,6 +150,35 @@ static void ceph_inode_init_once(void *foo) | |||
150 | inode_init_once(&ci->vfs_inode); | 150 | inode_init_once(&ci->vfs_inode); |
151 | } | 151 | } |
152 | 152 | ||
153 | static int default_congestion_kb(void) | ||
154 | { | ||
155 | int congestion_kb; | ||
156 | |||
157 | /* | ||
158 | * Copied from NFS | ||
159 | * | ||
160 | * congestion size, scale with available memory. | ||
161 | * | ||
162 | * 64MB: 8192k | ||
163 | * 128MB: 11585k | ||
164 | * 256MB: 16384k | ||
165 | * 512MB: 23170k | ||
166 | * 1GB: 32768k | ||
167 | * 2GB: 46340k | ||
168 | * 4GB: 65536k | ||
169 | * 8GB: 92681k | ||
170 | * 16GB: 131072k | ||
171 | * | ||
172 | * This allows larger machines to have larger/more transfers. | ||
173 | * Limit the default to 256M | ||
174 | */ | ||
175 | congestion_kb = (16*int_sqrt(totalram_pages)) << (PAGE_SHIFT-10); | ||
176 | if (congestion_kb > 256*1024) | ||
177 | congestion_kb = 256*1024; | ||
178 | |||
179 | return congestion_kb; | ||
180 | } | ||
181 | |||
153 | static int __init init_caches(void) | 182 | static int __init init_caches(void) |
154 | { | 183 | { |
155 | ceph_inode_cachep = kmem_cache_create("ceph_inode_info", | 184 | ceph_inode_cachep = kmem_cache_create("ceph_inode_info", |
@@ -267,6 +296,7 @@ enum { | |||
267 | Opt_caps_wanted_delay_min, | 296 | Opt_caps_wanted_delay_min, |
268 | Opt_caps_wanted_delay_max, | 297 | Opt_caps_wanted_delay_max, |
269 | Opt_readdir_max_entries, | 298 | Opt_readdir_max_entries, |
299 | Opt_congestion_kb, | ||
270 | Opt_last_int, | 300 | Opt_last_int, |
271 | /* int args above */ | 301 | /* int args above */ |
272 | Opt_snapdirname, | 302 | Opt_snapdirname, |
@@ -295,6 +325,7 @@ static match_table_t arg_tokens = { | |||
295 | {Opt_caps_wanted_delay_min, "caps_wanted_delay_min=%d"}, | 325 | {Opt_caps_wanted_delay_min, "caps_wanted_delay_min=%d"}, |
296 | {Opt_caps_wanted_delay_max, "caps_wanted_delay_max=%d"}, | 326 | {Opt_caps_wanted_delay_max, "caps_wanted_delay_max=%d"}, |
297 | {Opt_readdir_max_entries, "readdir_max_entries=%d"}, | 327 | {Opt_readdir_max_entries, "readdir_max_entries=%d"}, |
328 | {Opt_congestion_kb, "write_congestion_kb=%d"}, | ||
298 | /* int args above */ | 329 | /* int args above */ |
299 | {Opt_snapdirname, "snapdirname=%s"}, | 330 | {Opt_snapdirname, "snapdirname=%s"}, |
300 | {Opt_name, "name=%s"}, | 331 | {Opt_name, "name=%s"}, |
@@ -342,6 +373,7 @@ static struct ceph_mount_args *parse_mount_args(int flags, char *options, | |||
342 | args->snapdir_name = kstrdup(CEPH_SNAPDIRNAME_DEFAULT, GFP_KERNEL); | 373 | args->snapdir_name = kstrdup(CEPH_SNAPDIRNAME_DEFAULT, GFP_KERNEL); |
343 | args->cap_release_safety = CEPH_CAPS_PER_RELEASE * 4; | 374 | args->cap_release_safety = CEPH_CAPS_PER_RELEASE * 4; |
344 | args->max_readdir = 1024; | 375 | args->max_readdir = 1024; |
376 | args->congestion_kb = default_congestion_kb(); | ||
345 | 377 | ||
346 | /* ip1[:port1][,ip2[:port2]...]:/subdir/in/fs */ | 378 | /* ip1[:port1][,ip2[:port2]...]:/subdir/in/fs */ |
347 | err = -EINVAL; | 379 | err = -EINVAL; |
@@ -445,6 +477,9 @@ static struct ceph_mount_args *parse_mount_args(int flags, char *options, | |||
445 | case Opt_readdir_max_entries: | 477 | case Opt_readdir_max_entries: |
446 | args->max_readdir = intval; | 478 | args->max_readdir = intval; |
447 | break; | 479 | break; |
480 | case Opt_congestion_kb: | ||
481 | args->congestion_kb = intval; | ||
482 | break; | ||
448 | 483 | ||
449 | case Opt_noshare: | 484 | case Opt_noshare: |
450 | args->flags |= CEPH_OPT_NOSHARE; | 485 | args->flags |= CEPH_OPT_NOSHARE; |
@@ -516,6 +551,7 @@ static struct ceph_client *ceph_create_client(struct ceph_mount_args *args) | |||
516 | client->msgr = NULL; | 551 | client->msgr = NULL; |
517 | 552 | ||
518 | client->mount_err = 0; | 553 | client->mount_err = 0; |
554 | atomic_long_set(&client->writeback_count, 0); | ||
519 | 555 | ||
520 | err = bdi_init(&client->backing_dev_info); | 556 | err = bdi_init(&client->backing_dev_info); |
521 | if (err < 0) | 557 | if (err < 0) |