From: yury Date: Sun, 25 Jun 2006 14:00:12 +0000 (+0000) Subject: - sequence width on clients, super-width and meta-width on servers are dynamic now... X-Git-Tag: v1_8_0_110~486^2~1551 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=04acac226e9a2bc22872d95781e343aa3b053965;p=fs%2Flustre-release.git - sequence width on clients, super-width and meta-width on servers are dynamic now and may be changed via procfs tunables; - added many tunables both to server and client. --- diff --git a/lustre/fid/fid_handler.c b/lustre/fid/fid_handler.c index 5b0201e..abb2ca9 100644 --- a/lustre/fid/fid_handler.c +++ b/lustre/fid/fid_handler.c @@ -160,7 +160,7 @@ __seq_server_alloc_super(struct lu_server_seq *seq, LASSERT(range_is_sane(space)); - if (range_space(space) < LUSTRE_SEQ_SUPER_WIDTH) { + if (range_space(space) < seq->seq_super_width) { CWARN("sequences space is going to exhaust soon. " "Only can allocate "LPU64" sequences\n", space->lr_end - space->lr_start); @@ -171,7 +171,7 @@ __seq_server_alloc_super(struct lu_server_seq *seq, CERROR("sequences space is exhausted\n"); rc = -ENOSPC; } else { - range_alloc(range, space, LUSTRE_SEQ_SUPER_WIDTH); + range_alloc(range, space, seq->seq_super_width); rc = 0; } @@ -247,7 +247,7 @@ __seq_server_alloc_meta(struct lu_server_seq *seq, RETURN(0); } } - range_alloc(range, super, LUSTRE_SEQ_META_WIDTH); + range_alloc(range, super, seq->seq_meta_width); rc = seq_server_write_state(seq, ctx); if (rc) { @@ -465,6 +465,9 @@ seq_server_init(struct lu_server_seq *seq, seq->seq_cli = NULL; sema_init(&seq->seq_sem, 1); + seq->seq_super_width = LUSTRE_SEQ_SUPER_WIDTH; + seq->seq_meta_width = LUSTRE_SEQ_META_WIDTH; + snprintf(seq->seq_name, sizeof(seq->seq_name), "%s-%s", LUSTRE_SEQ_NAME, uuid); diff --git a/lustre/fid/fid_request.c b/lustre/fid/fid_request.c index f5c842d..e40b8e8 100644 --- a/lustre/fid/fid_request.c +++ b/lustre/fid/fid_request.c @@ -211,7 +211,7 @@ seq_client_alloc_fid(struct lu_client_seq *seq, struct lu_fid *fid) down(&seq->seq_sem); if (!fid_is_sane(&seq->seq_fid) || - fid_oid(&seq->seq_fid) >= LUSTRE_SEQ_WIDTH) + fid_oid(&seq->seq_fid) >= seq->seq_width) { /* allocate new sequence for case client hass no sequence at all * or sequnece is exhausted and should be switched. */ @@ -305,6 +305,7 @@ seq_client_init(struct lu_client_seq *seq, range_zero(&seq->seq_range); sema_init(&seq->seq_sem, 1); seq->seq_exp = class_export_get(exp); + seq->seq_width = LUSTRE_SEQ_MAX_WIDTH; snprintf(seq->seq_name, sizeof(seq->seq_name), "%s-%s", LUSTRE_SEQ_NAME, uuid); diff --git a/lustre/fid/lproc_fid.c b/lustre/fid/lproc_fid.c index 33f787a..4c52797 100644 --- a/lustre/fid/lproc_fid.c +++ b/lustre/fid/lproc_fid.c @@ -196,6 +196,97 @@ seq_proc_read_controller(char *page, char **start, off_t off, RETURN(rc); } +static int +seq_proc_write_super_width(struct file *file, const char *buffer, + unsigned long count, void *data) +{ + struct lu_server_seq *seq = (struct lu_server_seq *)data; + int rc, val; + ENTRY; + + LASSERT(seq != NULL); + + down(&seq->seq_sem); + + rc = lprocfs_write_helper(buffer, count, &val); + if (rc) + RETURN(rc); + + seq->seq_super_width = val; + + if (rc == 0) { + CDEBUG(D_WARNING, "SEQ-MGR(srv): super-sequence width " + "has changed to "LPU64"\n", seq->seq_super_width); + } + + up(&seq->seq_sem); + + RETURN(count); +} + +static int +seq_proc_read_super_width(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct lu_server_seq *seq = (struct lu_server_seq *)data; + int rc; + ENTRY; + + LASSERT(seq != NULL); + + down(&seq->seq_sem); + rc = snprintf(page, count, LPU64"\n", seq->seq_super_width); + up(&seq->seq_sem); + + RETURN(rc); +} + +static int +seq_proc_write_meta_width(struct file *file, const char *buffer, + unsigned long count, void *data) +{ + struct lu_server_seq *seq = (struct lu_server_seq *)data; + int rc, val; + ENTRY; + + LASSERT(seq != NULL); + + down(&seq->seq_sem); + + rc = lprocfs_write_helper(buffer, count, &val); + if (rc) + RETURN(rc); + + if (val <= seq->seq_super_width) { + seq->seq_meta_width = val; + + if (rc == 0) { + CDEBUG(D_WARNING, "SEQ-MGR(srv): meta-sequence width " + "has changed to "LPU64"\n", seq->seq_meta_width); + } + } + + up(&seq->seq_sem); + RETURN(count); +} + +static int +seq_proc_read_meta_width(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct lu_server_seq *seq = (struct lu_server_seq *)data; + int rc; + ENTRY; + + LASSERT(seq != NULL); + + down(&seq->seq_sem); + rc = snprintf(page, count, LPU64"\n", seq->seq_meta_width); + up(&seq->seq_sem); + + RETURN(rc); +} + /* client side procfs stuff */ static int seq_proc_write_range(struct file *file, const char *buffer, @@ -212,7 +303,7 @@ seq_proc_write_range(struct file *file, const char *buffer, data, &seq->seq_range); if (rc == 0) { - CDEBUG(D_WARNING, "SEQ-MGR(cli): meta-sequence has changed to " + CDEBUG(D_WARNING, "SEQ-MGR(cli): range has changed to " "["LPU64"-"LPU64"]\n", seq->seq_range.lr_start, seq->seq_range.lr_end); } @@ -240,13 +331,63 @@ seq_proc_read_range(char *page, char **start, off_t off, RETURN(rc); } +static int +seq_proc_write_seq_width(struct file *file, const char *buffer, + unsigned long count, void *data) +{ + struct lu_client_seq *seq = (struct lu_client_seq *)data; + int rc, val; + ENTRY; + + LASSERT(seq != NULL); + + down(&seq->seq_sem); + + rc = lprocfs_write_helper(buffer, count, &val); + if (rc) + RETURN(rc); + + if (val <= LUSTRE_SEQ_MAX_WIDTH) { + seq->seq_width = val; + + if (rc == 0) { + CDEBUG(D_WARNING, "SEQ-MGR(cli): sequence width " + "has changed to "LPU64"\n", seq->seq_width); + } + } + + up(&seq->seq_sem); + + RETURN(count); +} + +static int +seq_proc_read_seq_width(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct lu_client_seq *seq = (struct lu_client_seq *)data; + int rc; + ENTRY; + + LASSERT(seq != NULL); + + down(&seq->seq_sem); + rc = snprintf(page, count, LPU64"\n", seq->seq_width); + up(&seq->seq_sem); + + RETURN(rc); +} + struct lprocfs_vars seq_server_proc_list[] = { - { "space", seq_proc_read_space, seq_proc_write_space, NULL }, - { "super", seq_proc_read_super, seq_proc_write_super, NULL }, - { "controller", seq_proc_read_controller, NULL, NULL }, + { "space", seq_proc_read_space, seq_proc_write_space, NULL }, + { "super", seq_proc_read_super, seq_proc_write_super, NULL }, + { "controller", seq_proc_read_controller, NULL, NULL }, + { "super_width", seq_proc_read_super_width, seq_proc_write_super_width, NULL }, + { "meta_width", seq_proc_read_meta_width, seq_proc_write_meta_width, NULL }, { NULL }}; struct lprocfs_vars seq_client_proc_list[] = { { "range", seq_proc_read_range, seq_proc_write_range, NULL }, + { "seq_width", seq_proc_read_seq_width, seq_proc_write_seq_width, NULL }, { NULL }}; #endif diff --git a/lustre/include/lustre_fid.h b/lustre/include/lustre_fid.h index 992d0be..835aa39 100644 --- a/lustre/include/lustre_fid.h +++ b/lustre/include/lustre_fid.h @@ -39,7 +39,7 @@ extern const struct lu_range LUSTRE_SEQ_SPACE_RANGE; extern const struct lu_range LUSTRE_SEQ_ZERO_RANGE; /* this is how may FIDs may be allocated in one sequence. */ -#define LUSTRE_SEQ_WIDTH 0x00000000000002800 +#define LUSTRE_SEQ_MAX_WIDTH 0x00000000000002800 /* how many sequences may be allocate for meta-sequence (this is 10240 * sequences). */ @@ -69,6 +69,10 @@ struct lu_client_seq { /* service uuid, passed from MDT + seq name to form unique seq name to * use it with procfs. */ char seq_name[80]; + + /* sequence width, that is how many objects may be allocated in one + * sequence. Default value for it is LUSTRE_SEQ_MAX_WIDTH. */ + __u64 seq_width; }; #ifdef __KERNEL__ @@ -102,6 +106,11 @@ struct lu_server_seq { /* service uuid, passed from MDT + seq name to form unique seq name to * use it with procfs. */ char seq_name[80]; + + /* allocation chunks for super and meta sequences. Default values are + * LUSTRE_SEQ_SUPER_WIDTH and LUSTRE_SEQ_META_WIDTH. */ + __u64 seq_super_width; + __u64 seq_meta_width; }; #endif diff --git a/lustre/liblustre/llite_fid.c b/lustre/liblustre/llite_fid.c index b2d09b6..01979a0 100644 --- a/lustre/liblustre/llite_fid.c +++ b/lustre/liblustre/llite_fid.c @@ -139,6 +139,6 @@ unsigned long llu_fid_build_ino(struct llu_sb_info *sbi, /* very stupid and having many downsides inode allocation algorithm * based on fid. */ - ino = (fid_seq(fid) - 1) * LUSTRE_SEQ_WIDTH + fid_oid(fid); + ino = (fid_seq(fid) - 1) * LUSTRE_SEQ_MAX_WIDTH + fid_oid(fid); RETURN(ino); } diff --git a/lustre/llite/llite_fid.c b/lustre/llite/llite_fid.c index a2335e1..613cfce 100644 --- a/lustre/llite/llite_fid.c +++ b/lustre/llite/llite_fid.c @@ -137,6 +137,6 @@ ino_t ll_fid_build_ino(struct ll_sb_info *sbi, /* very stupid and having many downsides inode allocation algorithm * based on fid. */ - ino = (fid_seq(fid) - 1) * LUSTRE_SEQ_WIDTH + fid_oid(fid); + ino = (fid_seq(fid) - 1) * LUSTRE_SEQ_MAX_WIDTH + fid_oid(fid); RETURN(ino); } diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c index f4aafe07..5599f14 100644 --- a/lustre/obdclass/lu_object.c +++ b/lustre/obdclass/lu_object.c @@ -294,7 +294,7 @@ static __u32 fid_hash(const struct lu_fid *f) { /* all objects with same id and different versions will belong to same * collisions list. */ - return (fid_seq(f) - 1) * LUSTRE_SEQ_WIDTH + fid_oid(f); + return (fid_seq(f) - 1) * LUSTRE_SEQ_MAX_WIDTH + fid_oid(f); } /*