diff options
author | Sage Weil <sage@newdream.net> | 2010-05-14 16:06:30 -0400 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2010-05-17 18:25:41 -0400 |
commit | 23804d91f112df09b832cd091b71af4dc2831aa8 (patch) | |
tree | 4b77c43b47d58f08ab02220c507dabfc8f6daf7a /fs/ceph | |
parent | 366837706bae00abc2edd75add2579c1be18b2b8 (diff) |
ceph: specify max_bytes on readdir replies
Specify max bytes in request to bound size of reply. Add associated
mount option with default value of 512 KB.
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/ceph_fs.h | 1 | ||||
-rw-r--r-- | fs/ceph/dir.c | 2 | ||||
-rw-r--r-- | fs/ceph/super.c | 8 | ||||
-rw-r--r-- | fs/ceph/super.h | 4 |
4 files changed, 14 insertions, 1 deletions
diff --git a/fs/ceph/ceph_fs.h b/fs/ceph/ceph_fs.h index 715e39ce517a..3b9eeed097b3 100644 --- a/fs/ceph/ceph_fs.h +++ b/fs/ceph/ceph_fs.h | |||
@@ -361,6 +361,7 @@ union ceph_mds_request_args { | |||
361 | struct { | 361 | struct { |
362 | __le32 frag; /* which dir fragment */ | 362 | __le32 frag; /* which dir fragment */ |
363 | __le32 max_entries; /* how many dentries to grab */ | 363 | __le32 max_entries; /* how many dentries to grab */ |
364 | __le32 max_bytes; | ||
364 | } __attribute__ ((packed)) readdir; | 365 | } __attribute__ ((packed)) readdir; |
365 | struct { | 366 | struct { |
366 | __le32 mode; | 367 | __le32 mode; |
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index d3bb8132a1aa..4fd30900eff7 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -233,6 +233,7 @@ static int ceph_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
233 | u32 ftype; | 233 | u32 ftype; |
234 | struct ceph_mds_reply_info_parsed *rinfo; | 234 | struct ceph_mds_reply_info_parsed *rinfo; |
235 | const int max_entries = client->mount_args->max_readdir; | 235 | const int max_entries = client->mount_args->max_readdir; |
236 | const int max_bytes = client->mount_args->max_readdir_bytes; | ||
236 | 237 | ||
237 | dout("readdir %p filp %p frag %u off %u\n", inode, filp, frag, off); | 238 | dout("readdir %p filp %p frag %u off %u\n", inode, filp, frag, off); |
238 | if (fi->at_end) | 239 | if (fi->at_end) |
@@ -316,6 +317,7 @@ more: | |||
316 | req->r_readdir_offset = fi->next_offset; | 317 | req->r_readdir_offset = fi->next_offset; |
317 | req->r_args.readdir.frag = cpu_to_le32(frag); | 318 | req->r_args.readdir.frag = cpu_to_le32(frag); |
318 | req->r_args.readdir.max_entries = cpu_to_le32(max_entries); | 319 | req->r_args.readdir.max_entries = cpu_to_le32(max_entries); |
320 | req->r_args.readdir.max_bytes = cpu_to_le32(max_bytes); | ||
319 | req->r_num_caps = max_entries + 1; | 321 | req->r_num_caps = max_entries + 1; |
320 | err = ceph_mdsc_do_request(mdsc, NULL, req); | 322 | err = ceph_mdsc_do_request(mdsc, NULL, req); |
321 | if (err < 0) { | 323 | if (err < 0) { |
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 7f5b20dc4945..bac13898b943 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c | |||
@@ -190,6 +190,8 @@ static int ceph_show_options(struct seq_file *m, struct vfsmount *mnt) | |||
190 | args->cap_release_safety); | 190 | args->cap_release_safety); |
191 | if (args->max_readdir != CEPH_MAX_READDIR_DEFAULT) | 191 | if (args->max_readdir != CEPH_MAX_READDIR_DEFAULT) |
192 | seq_printf(m, ",readdir_max_entries=%d", args->max_readdir); | 192 | seq_printf(m, ",readdir_max_entries=%d", args->max_readdir); |
193 | if (args->max_readdir_bytes != CEPH_MAX_READDIR_BYTES_DEFAULT) | ||
194 | seq_printf(m, ",readdir_max_bytes=%d", args->max_readdir_bytes); | ||
193 | if (strcmp(args->snapdir_name, CEPH_SNAPDIRNAME_DEFAULT)) | 195 | if (strcmp(args->snapdir_name, CEPH_SNAPDIRNAME_DEFAULT)) |
194 | seq_printf(m, ",snapdirname=%s", args->snapdir_name); | 196 | seq_printf(m, ",snapdirname=%s", args->snapdir_name); |
195 | if (args->name) | 197 | if (args->name) |
@@ -333,6 +335,7 @@ enum { | |||
333 | Opt_caps_wanted_delay_max, | 335 | Opt_caps_wanted_delay_max, |
334 | Opt_cap_release_safety, | 336 | Opt_cap_release_safety, |
335 | Opt_readdir_max_entries, | 337 | Opt_readdir_max_entries, |
338 | Opt_readdir_max_bytes, | ||
336 | Opt_congestion_kb, | 339 | Opt_congestion_kb, |
337 | Opt_last_int, | 340 | Opt_last_int, |
338 | /* int args above */ | 341 | /* int args above */ |
@@ -365,6 +368,7 @@ static match_table_t arg_tokens = { | |||
365 | {Opt_caps_wanted_delay_max, "caps_wanted_delay_max=%d"}, | 368 | {Opt_caps_wanted_delay_max, "caps_wanted_delay_max=%d"}, |
366 | {Opt_cap_release_safety, "cap_release_safety=%d"}, | 369 | {Opt_cap_release_safety, "cap_release_safety=%d"}, |
367 | {Opt_readdir_max_entries, "readdir_max_entries=%d"}, | 370 | {Opt_readdir_max_entries, "readdir_max_entries=%d"}, |
371 | {Opt_readdir_max_bytes, "readdir_max_bytes=%d"}, | ||
368 | {Opt_congestion_kb, "write_congestion_kb=%d"}, | 372 | {Opt_congestion_kb, "write_congestion_kb=%d"}, |
369 | /* int args above */ | 373 | /* int args above */ |
370 | {Opt_snapdirname, "snapdirname=%s"}, | 374 | {Opt_snapdirname, "snapdirname=%s"}, |
@@ -415,6 +419,7 @@ static struct ceph_mount_args *parse_mount_args(int flags, char *options, | |||
415 | args->snapdir_name = kstrdup(CEPH_SNAPDIRNAME_DEFAULT, GFP_KERNEL); | 419 | args->snapdir_name = kstrdup(CEPH_SNAPDIRNAME_DEFAULT, GFP_KERNEL); |
416 | args->cap_release_safety = CEPH_CAP_RELEASE_SAFETY_DEFAULT; | 420 | args->cap_release_safety = CEPH_CAP_RELEASE_SAFETY_DEFAULT; |
417 | args->max_readdir = CEPH_MAX_READDIR_DEFAULT; | 421 | args->max_readdir = CEPH_MAX_READDIR_DEFAULT; |
422 | args->max_readdir_bytes = CEPH_MAX_READDIR_BYTES_DEFAULT; | ||
418 | args->congestion_kb = default_congestion_kb(); | 423 | args->congestion_kb = default_congestion_kb(); |
419 | 424 | ||
420 | /* ip1[:port1][,ip2[:port2]...]:/subdir/in/fs */ | 425 | /* ip1[:port1][,ip2[:port2]...]:/subdir/in/fs */ |
@@ -522,6 +527,9 @@ static struct ceph_mount_args *parse_mount_args(int flags, char *options, | |||
522 | case Opt_readdir_max_entries: | 527 | case Opt_readdir_max_entries: |
523 | args->max_readdir = intval; | 528 | args->max_readdir = intval; |
524 | break; | 529 | break; |
530 | case Opt_readdir_max_bytes: | ||
531 | args->max_readdir_bytes = intval; | ||
532 | break; | ||
525 | case Opt_congestion_kb: | 533 | case Opt_congestion_kb: |
526 | args->congestion_kb = intval; | 534 | args->congestion_kb = intval; |
527 | break; | 535 | break; |
diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 395adc5fcebb..3725c9ee9d08 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h | |||
@@ -66,7 +66,8 @@ struct ceph_mount_args { | |||
66 | int congestion_kb; /* max writeback in flight */ | 66 | int congestion_kb; /* max writeback in flight */ |
67 | int caps_wanted_delay_min, caps_wanted_delay_max; | 67 | int caps_wanted_delay_min, caps_wanted_delay_max; |
68 | int cap_release_safety; | 68 | int cap_release_safety; |
69 | int max_readdir; /* max readdir size */ | 69 | int max_readdir; /* max readdir result (entires) */ |
70 | int max_readdir_bytes; /* max readdir result (bytes) */ | ||
70 | char *snapdir_name; /* default ".snap" */ | 71 | char *snapdir_name; /* default ".snap" */ |
71 | char *name; | 72 | char *name; |
72 | char *secret; | 73 | char *secret; |
@@ -81,6 +82,7 @@ struct ceph_mount_args { | |||
81 | #define CEPH_OSD_IDLE_TTL_DEFAULT 60 | 82 | #define CEPH_OSD_IDLE_TTL_DEFAULT 60 |
82 | #define CEPH_MOUNT_RSIZE_DEFAULT (512*1024) /* readahead */ | 83 | #define CEPH_MOUNT_RSIZE_DEFAULT (512*1024) /* readahead */ |
83 | #define CEPH_MAX_READDIR_DEFAULT 1024 | 84 | #define CEPH_MAX_READDIR_DEFAULT 1024 |
85 | #define CEPH_MAX_READDIR_BYTES_DEFAULT (512*1024) | ||
84 | 86 | ||
85 | #define CEPH_MSG_MAX_FRONT_LEN (16*1024*1024) | 87 | #define CEPH_MSG_MAX_FRONT_LEN (16*1024*1024) |
86 | #define CEPH_MSG_MAX_DATA_LEN (16*1024*1024) | 88 | #define CEPH_MSG_MAX_DATA_LEN (16*1024*1024) |