Whamcloud - gitweb
- revised seq-mgr, a lot of simplifications.
authoryury <yury>
Sun, 8 Oct 2006 07:19:27 +0000 (07:19 +0000)
committeryury <yury>
Sun, 8 Oct 2006 07:19:27 +0000 (07:19 +0000)
lustre/fid/fid_handler.c
lustre/fid/fid_internal.h
lustre/fid/fid_request.c
lustre/fid/fid_store.c
lustre/fid/lproc_fid.c
lustre/include/lustre_fid.h
lustre/tests/replay-single.sh

index 117cab3..bc8f366 100644 (file)
@@ -75,7 +75,7 @@ int seq_server_set_cli(struct lu_server_seq *seq,
                cli->lcs_name);
 
         /*
-         * Asking client for new range, assign that range to ->seq_super and
+         * Asking client for new range, assign that range to ->seq_space and
          * write seq state to backing store should be atomic.
          */
         down(&seq->lss_sem);
@@ -87,7 +87,7 @@ int seq_server_set_cli(struct lu_server_seq *seq,
          * Get new range from controller only if super-sequence is not yet
          * initialized from backing store or something else.
          */
-        if (range_is_zero(&seq->lss_super)) {
+        if (range_is_zero(&seq->lss_space)) {
                 rc = seq_client_alloc_super(cli, env);
                 if (rc) {
                         up(&seq->lss_sem);
@@ -97,9 +97,9 @@ int seq_server_set_cli(struct lu_server_seq *seq,
                 }
 
                 /* take super-seq from client seq mgr */
-                LASSERT(range_is_sane(&cli->lcs_range));
+                LASSERT(range_is_sane(&cli->lcs_space));
 
-                seq->lss_super = cli->lcs_range;
+                seq->lss_space = cli->lcs_space;
 
                 /* save init seq to backing store. */
                 rc = seq_store_write(seq, env);
@@ -140,7 +140,7 @@ static int __seq_server_alloc_super(struct lu_server_seq *seq,
                 CDEBUG(D_INFO|D_WARNING, "%s: Recovery finished. Recovered "
                        "space: "DRANGE"\n", seq->lss_name, PRANGE(space));
         } else {
-                if (range_space(space) < seq->lss_super_width) {
+                if (range_space(space) < seq->lss_width) {
                         CWARN("%s: Sequences space to be exhausted soon. "
                               "Only "LPU64" sequences left\n", seq->lss_name,
                               range_space(space));
@@ -151,7 +151,7 @@ static int __seq_server_alloc_super(struct lu_server_seq *seq,
                                seq->lss_name);
                         RETURN(-ENOSPC);
                 } else {
-                        range_alloc(out, space, seq->lss_super_width);
+                        range_alloc(out, space, seq->lss_width);
                 }
         }
 
@@ -187,11 +187,11 @@ static int __seq_server_alloc_meta(struct lu_server_seq *seq,
                                    struct lu_range *out,
                                    const struct lu_env *env)
 {
-        struct lu_range *super = &seq->lss_super;
+        struct lu_range *space = &seq->lss_space;
         int rc = 0;
         ENTRY;
 
-        LASSERT(range_is_sane(super));
+        LASSERT(range_is_sane(space));
 
         /*
          * This is recovery case. Adjust super range if input range looks like
@@ -202,37 +202,37 @@ static int __seq_server_alloc_meta(struct lu_server_seq *seq,
                        "(last allocated) range "DRANGE"\n", seq->lss_name,
                        PRANGE(in));
 
-                if (range_is_exhausted(super)) {
-                        LASSERT(in->lr_start > super->lr_start);
+                if (range_is_exhausted(space)) {
+                        LASSERT(in->lr_start > space->lr_start);
 
                         /*
                          * Server cannot send empty range to client, this is why
                          * we check here that range from client is "newer" than
                          * exhausted super.
                          */
-                        super->lr_start = in->lr_start;
+                        space->lr_start = in->lr_start;
 
-                        super->lr_end = super->lr_start +
+                        space->lr_end = space->lr_start +
                                 LUSTRE_SEQ_SUPER_WIDTH;
                 } else {
                         /*
                          * Update super start by start from client's range. End
                          * should not be changed if range was not exhausted.
                          */
-                        if (in->lr_start > super->lr_start)
-                                super->lr_start = in->lr_start;
+                        if (in->lr_start > space->lr_start)
+                                space->lr_start = in->lr_start;
                 }
 
                 *out = *in;
 
                 CDEBUG(D_INFO|D_WARNING, "%s: Recovery finished. Recovered "
-                       "super: "DRANGE"\n", seq->lss_name, PRANGE(super));
+                       "super: "DRANGE"\n", seq->lss_name, PRANGE(space));
         } else {
                 /*
                  * XXX: Avoid cascading RPCs using kind of async preallocation
                  * when meta-sequence is close to exhausting.
                  */
-                if (range_is_exhausted(super)) {
+                if (range_is_exhausted(space)) {
                         if (!seq->lss_cli) {
                                 CERROR("%s: No sequence controller client "
                                        "is setup\n", seq->lss_name);
@@ -247,10 +247,10 @@ static int __seq_server_alloc_meta(struct lu_server_seq *seq,
                         }
 
                         /* Saving new range to allocation space. */
-                        *super = seq->lss_cli->lcs_range;
-                        LASSERT(range_is_sane(super));
+                        *space = seq->lss_cli->lcs_space;
+                        LASSERT(range_is_sane(space));
                 }
-                range_alloc(out, super, seq->lss_meta_width);
+                range_alloc(out, space, seq->lss_width);
         }
 
         rc = seq_store_write(seq, env);
@@ -501,14 +501,15 @@ int seq_server_init(struct lu_server_seq *seq,
         seq->lss_type = type;
         sema_init(&seq->lss_sem, 1);
 
-        seq->lss_super_width = LUSTRE_SEQ_SUPER_WIDTH;
-        seq->lss_meta_width = LUSTRE_SEQ_META_WIDTH;
+        seq->lss_width = is_srv ?
+                LUSTRE_SEQ_META_WIDTH : LUSTRE_SEQ_SUPER_WIDTH;
 
         snprintf(seq->lss_name, sizeof(seq->lss_name),
                  "%s-%s", (is_srv ? "srv" : "ctl"), prefix);
 
-        seq->lss_space = LUSTRE_SEQ_SPACE_RANGE;
-        seq->lss_super = LUSTRE_SEQ_ZERO_RANGE;
+        seq->lss_space = is_srv ?
+                LUSTRE_SEQ_ZERO_RANGE:
+                LUSTRE_SEQ_SPACE_RANGE;
 
         rc = seq_store_init(seq, env, dev);
         if (rc)
index a740d4d..b88445a 100644 (file)
 #include <linux/types.h>
 
 #ifdef __KERNEL__
-struct seq_store_record {
-        struct lu_range ssr_space;
-        struct lu_range ssr_super;
-};
-
 struct seq_thread_info {
         struct txn_param        sti_txn;
         struct req_capsule      sti_pill;
-        struct seq_store_record sti_record;
+        struct lu_range         sti_space;
         int                     sti_rep_buf_size[REQ_MAX_FIELD_NR];
         struct lu_buf           sti_buf;
 };
index 3b7d1d2..c4d22e8 100644 (file)
@@ -50,7 +50,7 @@
 #include "fid_internal.h"
 
 static int seq_client_rpc(struct lu_client_seq *seq,
-                          struct lu_range *range,
+                          struct lu_range *space,
                           __u32 opc, const char *opcname)
 {
         int rc, size[3] = { sizeof(struct ptlrpc_body),
@@ -100,17 +100,17 @@ static int seq_client_rpc(struct lu_client_seq *seq,
                 GOTO(out_req, rc);
 
         out = req_capsule_server_get(&pill, &RMF_SEQ_RANGE);
-        *range = *out;
+        *space = *out;
 
-        if (!range_is_sane(range)) {
+        if (!range_is_sane(space)) {
                 CERROR("%s: Invalid range received from server: "
-                       DRANGE"\n", seq->lcs_name, PRANGE(range));
+                       DRANGE"\n", seq->lcs_name, PRANGE(space));
                 GOTO(out_req, rc = -EINVAL);
         }
 
-        if (range_is_exhausted(range)) {
+        if (range_is_exhausted(space)) {
                 CERROR("%s: Range received from server is exhausted: "
-                       DRANGE"]\n", seq->lcs_name, PRANGE(range));
+                       DRANGE"]\n", seq->lcs_name, PRANGE(space));
                 GOTO(out_req, rc = -EINVAL);
         }
 
@@ -118,7 +118,7 @@ static int seq_client_rpc(struct lu_client_seq *seq,
         *in = *out;
 
         CDEBUG(D_INFO, "%s: Allocated %s-sequence "DRANGE"]\n",
-               seq->lcs_name, opcname, PRANGE(range));
+               seq->lcs_name, opcname, PRANGE(space));
 
         EXIT;
 out_req:
@@ -137,11 +137,11 @@ static int __seq_client_alloc_super(struct lu_client_seq *seq,
         if (seq->lcs_srv) {
                 LASSERT(env != NULL);
                 rc = seq_server_alloc_super(seq->lcs_srv, NULL,
-                                            &seq->lcs_range,
+                                            &seq->lcs_space,
                                             env);
         } else {
 #endif
-                rc = seq_client_rpc(seq, &seq->lcs_range,
+                rc = seq_client_rpc(seq, &seq->lcs_space,
                                     SEQ_ALLOC_SUPER, "super");
 #ifdef __KERNEL__
         }
@@ -173,11 +173,11 @@ static int __seq_client_alloc_meta(struct lu_client_seq *seq,
         if (seq->lcs_srv) {
                 LASSERT(env != NULL);
                 rc = seq_server_alloc_meta(seq->lcs_srv, NULL,
-                                           &seq->lcs_range,
+                                           &seq->lcs_space,
                                            env);
         } else {
 #endif
-                rc = seq_client_rpc(seq, &seq->lcs_range,
+                rc = seq_client_rpc(seq, &seq->lcs_space,
                                     SEQ_ALLOC_META, "meta");
 #ifdef __KERNEL__
         }
@@ -205,11 +205,13 @@ static int __seq_client_alloc_seq(struct lu_client_seq *seq, seqno_t *seqnr)
         int rc = 0;
         ENTRY;
 
-        LASSERT(range_is_sane(&seq->lcs_range));
+        LASSERT(range_is_sane(&seq->lcs_space));
 
-        /* if we still have free sequences in meta-sequence we allocate new seq
-         * from given range, if not - allocate new meta-sequence. */
-        if (range_space(&seq->lcs_range) == 0) {
+        /*
+         * If we still have free sequences in meta-sequence we allocate new seq
+         * from given range, if not - allocate new meta-sequence.
+         */
+        if (range_space(&seq->lcs_space) == 0) {
                 rc = __seq_client_alloc_meta(seq, NULL);
                 if (rc) {
                         CERROR("%s: Can't allocate new meta-sequence, "
@@ -217,13 +219,13 @@ static int __seq_client_alloc_seq(struct lu_client_seq *seq, seqno_t *seqnr)
                         RETURN(rc);
                 } else {
                         CDEBUG(D_INFO|D_WARNING, "%s: New range - "DRANGE"\n",
-                               seq->lcs_name, PRANGE(&seq->lcs_range));
+                               seq->lcs_name, PRANGE(&seq->lcs_space));
                 }
         }
 
-        LASSERT(range_space(&seq->lcs_range) > 0);
-        *seqnr = seq->lcs_range.lr_start;
-        seq->lcs_range.lr_start++;
+        LASSERT(range_space(&seq->lcs_space) > 0);
+        *seqnr = seq->lcs_space.lr_start;
+        seq->lcs_space.lr_start++;
 
         CDEBUG(D_INFO, "%s: Allocated sequence ["LPX64"]\n",
                seq->lcs_name, *seqnr);
@@ -371,7 +373,7 @@ int seq_client_init(struct lu_client_seq *seq,
         seq->lcs_srv = srv;
         seq->lcs_type = type;
         fid_zero(&seq->lcs_fid);
-        range_zero(&seq->lcs_range);
+        range_zero(&seq->lcs_space);
         sema_init(&seq->lcs_sem, 1);
         seq->lcs_width = LUSTRE_SEQ_MAX_WIDTH;
 
index 8ad592d..fb4e93f 100644 (file)
@@ -52,17 +52,17 @@ enum {
         SEQ_TXN_STORE_CREDITS = 20
 };
 
-static struct lu_buf *seq_record_buf(struct seq_thread_info *info)
+static struct lu_buf *seq_store_buf(struct seq_thread_info *info)
 {
         struct lu_buf *buf;
 
         buf = &info->sti_buf;
-        buf->lb_buf = &info->sti_record;
-        buf->lb_len = sizeof(info->sti_record);
+        buf->lb_buf = &info->sti_space;
+        buf->lb_len = sizeof(info->sti_space);
         return buf;
 }
 
-/* this function implies that caller takes care about locking */
+/* This function implies that caller takes care about locking. */
 int seq_store_write(struct lu_server_seq *seq,
                     const struct lu_env *env)
 {
@@ -78,24 +78,20 @@ int seq_store_write(struct lu_server_seq *seq,
         info = lu_context_key_get(&env->le_ctx, &seq_thread_key);
         LASSERT(info != NULL);
 
-        /* stub here, will fix it later */
+        /* Stub here, will fix it later. */
         info->sti_txn.tp_credits = SEQ_TXN_STORE_CREDITS;
 
         th = dt_dev->dd_ops->dt_trans_start(env, dt_dev, &info->sti_txn);
         if (!IS_ERR(th)) {
-                /* store ranges in le format */
-                range_cpu_to_le(&info->sti_record.ssr_space, &seq->lss_space);
-                range_cpu_to_le(&info->sti_record.ssr_super, &seq->lss_super);
+                /* Store ranges in le format. */
+                range_cpu_to_le(&info->sti_space, &seq->lss_space);
 
                 rc = dt_obj->do_body_ops->dbo_write(env, dt_obj,
-                                                    seq_record_buf(info),
+                                                    seq_store_buf(info),
                                                     &pos, th, BYPASS_CAPA);
-                if (rc == sizeof(info->sti_record)) {
-                        struct lu_range *r = (seq->lss_type == LUSTRE_SEQ_SERVER ?
-                                              &seq->lss_super : &seq->lss_space);
-                        
+                if (rc == sizeof(info->sti_space)) {
                         CDEBUG(D_INFO|D_WARNING, "%s: Space - "DRANGE"\n",
-                               seq->lss_name, PRANGE(r));
+                               seq->lss_name, PRANGE(&seq->lss_space));
                         rc = 0;
                 } else if (rc >= 0) {
                         rc = -EIO;
@@ -109,8 +105,10 @@ int seq_store_write(struct lu_server_seq *seq,
        RETURN(rc);
 }
 
-/* this function implies that caller takes care about locking or locking is not
- * needed (init time). */
+/*
+ * This function implies that caller takes care about locking or locking is not
+ * needed (init time).
+ */
 int seq_store_read(struct lu_server_seq *seq,
                    const struct lu_env *env)
 {
@@ -123,25 +121,19 @@ int seq_store_read(struct lu_server_seq *seq,
         info = lu_context_key_get(&env->le_ctx, &seq_thread_key);
         LASSERT(info != NULL);
 
-        rc = dt_obj->do_body_ops->dbo_read(env, dt_obj,
-                                           seq_record_buf(info), &pos,
-                                           BYPASS_CAPA);
-
-        if (rc == sizeof(info->sti_record)) {
-                struct lu_range *r = (seq->lss_type == LUSTRE_SEQ_SERVER ?
-                                      &seq->lss_super : &seq->lss_space);
-                
-                range_le_to_cpu(&seq->lss_space, &info->sti_record.ssr_space);
-                range_le_to_cpu(&seq->lss_super, &info->sti_record.ssr_super);
+        rc = dt_obj->do_body_ops->dbo_read(env, dt_obj, seq_store_buf(info),
+                                           &pos, BYPASS_CAPA);
 
+        if (rc == sizeof(info->sti_space)) {
+                range_le_to_cpu(&seq->lss_space, &info->sti_space);
                 CDEBUG(D_INFO|D_WARNING, "%s: Space - "DRANGE"\n",
-                       seq->lss_name, PRANGE(r));
+                       seq->lss_name, PRANGE(&seq->lss_space));
                 rc = 0;
         } else if (rc == 0) {
                 rc = -ENODATA;
         } else if (rc >= 0) {
                 CERROR("%s: Read only %d bytes of %d\n", seq->lss_name,
-                       rc, sizeof(info->sti_record));
+                       rc, sizeof(info->sti_space));
                 rc = -EIO;
         }
        
index 831a9bf..d666047 100644 (file)
@@ -70,9 +70,6 @@ seq_proc_write_common(struct file *file, const char *buffer,
         RETURN(0);
 }
 
-/*
- * Server side procfs stuff.
- */
 static int
 seq_proc_read_common(char *page, char **start, off_t off,
                      int count, int *eof, void *data,
@@ -82,14 +79,17 @@ seq_proc_read_common(char *page, char **start, off_t off,
        ENTRY;
 
         *eof = 1;
-        rc = snprintf(page, count, DRANGE"]\n",
-                     PRANGE(range));
+        rc = snprintf(page, count, "[%Lx - %Lx]\n",
+                      PRANGE(range));
        RETURN(rc);
 }
 
+/*
+ * Server side procfs stuff.
+ */
 static int
-seq_proc_write_space(struct file *file, const char *buffer,
-                    unsigned long count, void *data)
+seq_server_proc_write_space(struct file *file, const char *buffer,
+                            unsigned long count, void *data)
 {
         struct lu_server_seq *seq = (struct lu_server_seq *)data;
        int rc;
@@ -112,8 +112,8 @@ seq_proc_write_space(struct file *file, const char *buffer,
 }
 
 static int
-seq_proc_read_space(char *page, char **start, off_t off,
-                   int count, int *eof, void *data)
+seq_server_proc_read_space(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;
@@ -130,50 +130,8 @@ seq_proc_read_space(char *page, char **start, off_t off,
 }
 
 static int
-seq_proc_write_super(struct file *file, const char *buffer,
-                    unsigned long count, void *data)
-{
-        struct lu_server_seq *seq = (struct lu_server_seq *)data;
-       int rc;
-       ENTRY;
-
-        LASSERT(seq != NULL);
-
-       down(&seq->lss_sem);
-       rc = seq_proc_write_common(file, buffer, count,
-                                   data, &seq->lss_super);
-
-       if (rc == 0) {
-               CDEBUG(D_WARNING, "%s: Super has changed to "
-                       DRANGE"\n", seq->lss_name, PRANGE(&seq->lss_super));
-       }
-       
-       up(&seq->lss_sem);
-       
-        RETURN(count);
-}
-
-static int
-seq_proc_read_super(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->lss_sem);
-       rc = seq_proc_read_common(page, start, off, count, eof,
-                                  data, &seq->lss_super);
-       up(&seq->lss_sem);
-       
-       RETURN(rc);
-}
-
-static int
-seq_proc_read_controller(char *page, char **start, off_t off,
-                        int count, int *eof, void *data)
+seq_server_proc_read_server(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;
@@ -195,8 +153,8 @@ seq_proc_read_controller(char *page, char **start, off_t off,
 }
 
 static int
-seq_proc_write_super_width(struct file *file, const char *buffer,
-                           unsigned long count, void *data)
+seq_server_proc_write_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;
@@ -210,11 +168,11 @@ seq_proc_write_super_width(struct file *file, const char *buffer,
         if (rc)
                 RETURN(rc);
 
-        seq->lss_super_width = val;
+        seq->lss_width = val;
         
        if (rc == 0) {
-               CDEBUG(D_WARNING, "%s: Super width has changed to "
-                       LPU64"\n", seq->lss_name, seq->lss_super_width);
+               CDEBUG(D_WARNING, "%s: Allocation unit has changed to "
+                       LPU64"\n", seq->lss_name, seq->lss_width);
        }
        
        up(&seq->lss_sem);
@@ -223,8 +181,8 @@ seq_proc_write_super_width(struct file *file, const char *buffer,
 }
 
 static int
-seq_proc_read_super_width(char *page, char **start, off_t off,
-                          int count, int *eof, void *data)
+seq_server_proc_read_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;
@@ -233,62 +191,16 @@ seq_proc_read_super_width(char *page, char **start, off_t off,
         LASSERT(seq != NULL);
 
        down(&seq->lss_sem);
-        rc = snprintf(page, count, LPU64"\n", seq->lss_super_width);
+        rc = snprintf(page, count, LPU64"\n", seq->lss_width);
        up(&seq->lss_sem);
        
        RETURN(rc);
 }
 
+/* Client side procfs stuff */
 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->lss_sem);
-
-        rc = lprocfs_write_helper(buffer, count, &val);
-        if (rc)
-                RETURN(rc);
-
-        if (val <= seq->lss_super_width) {
-                seq->lss_meta_width = val;
-                
-                if (rc == 0) {
-                        CDEBUG(D_WARNING, "%s: Meta width has changed to "
-                               LPU64"\n", seq->lss_name, seq->lss_meta_width);
-                }
-        }
-       
-       up(&seq->lss_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->lss_sem);
-        rc = snprintf(page, count, LPU64"\n", seq->lss_meta_width);
-       up(&seq->lss_sem);
-       
-       RETURN(rc);
-}
-
-/* client side procfs stuff */
-static int
-seq_proc_write_range(struct file *file, const char *buffer,
-                     unsigned long count, void *data)
+seq_client_proc_write_space(struct file *file, const char *buffer,
+                            unsigned long count, void *data)
 {
         struct lu_client_seq *seq = (struct lu_client_seq *)data;
        int rc;
@@ -298,11 +210,12 @@ seq_proc_write_range(struct file *file, const char *buffer,
 
        down(&seq->lcs_sem);
        rc = seq_proc_write_common(file, buffer, count,
-                                   data, &seq->lcs_range);
+                                   data, &seq->lcs_space);
 
        if (rc == 0) {
-               CDEBUG(D_WARNING, "%s: Range has changed to "
-                      DRANGE"\n", seq->lcs_name, PRANGE(&seq->lcs_range));
+               CDEBUG(D_WARNING, "%s: Sequences space has "
+                       "changed to "DRANGE"\n", seq->lcs_name,
+                       PRANGE(&seq->lcs_space));
        }
        
        up(&seq->lcs_sem);
@@ -311,8 +224,8 @@ seq_proc_write_range(struct file *file, const char *buffer,
 }
 
 static int
-seq_proc_read_range(char *page, char **start, off_t off,
-                    int count, int *eof, void *data)
+seq_client_proc_read_space(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;
@@ -322,15 +235,15 @@ seq_proc_read_range(char *page, char **start, off_t off,
 
        down(&seq->lcs_sem);
        rc = seq_proc_read_common(page, start, off, count, eof,
-                                  data, &seq->lcs_range);
+                                  data, &seq->lcs_space);
        up(&seq->lcs_sem);
        
        RETURN(rc);
 }
 
 static int
-seq_proc_write_seq_width(struct file *file, const char *buffer,
-                         unsigned long count, void *data)
+seq_client_proc_write_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;
@@ -348,9 +261,8 @@ seq_proc_write_seq_width(struct file *file, const char *buffer,
                 seq->lcs_width = val;
                 
                 if (rc == 0) {
-                        CDEBUG(D_WARNING, "%s: Sequence width "
-                               "has changed to "LPU64"\n",
-                               seq->lcs_name, seq->lcs_width);
+                        CDEBUG(D_WARNING, "%s: Allocation unit has changed to "
+                               ""LPU64"\n", seq->lcs_name, seq->lcs_width);
                 }
         }
        
@@ -360,8 +272,8 @@ seq_proc_write_seq_width(struct file *file, const char *buffer,
 }
 
 static int
-seq_proc_read_seq_width(char *page, char **start, off_t off,
-                        int count, int *eof, void *data)
+seq_client_proc_read_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;
@@ -377,8 +289,8 @@ seq_proc_read_seq_width(char *page, char **start, off_t off,
 }
 
 static int
-seq_proc_read_next_fid(char *page, char **start, off_t off,
-                       int count, int *eof, void *data)
+seq_client_proc_read_next_fid(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;
@@ -394,8 +306,8 @@ seq_proc_read_next_fid(char *page, char **start, off_t off,
 }
 
 static int
-seq_proc_read_server(char *page, char **start, off_t off,
-                     int count, int *eof, void *data)
+seq_client_proc_read_server(char *page, char **start, off_t off,
+                            int count, int *eof, void *data)
 {
         struct lu_client_seq *seq = (struct lu_client_seq *)data;
         struct client_obd *cli = &seq->lcs_exp->exp_obd->u.cli;
@@ -409,17 +321,15 @@ seq_proc_read_server(char *page, char **start, off_t off,
 }
 
 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 },
-       { "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 },
+       { "space",    seq_server_proc_read_space, seq_server_proc_write_space, NULL },
+       { "width",    seq_server_proc_read_width, seq_server_proc_write_width, NULL },
+       { "server",   seq_server_proc_read_server, NULL, NULL },
        { NULL }};
 
 struct lprocfs_vars seq_client_proc_list[] = {
-       { "range",       seq_proc_read_range, seq_proc_write_range, NULL },
-       { "server",      seq_proc_read_server, NULL, NULL },
-       { "next_fid" ,   seq_proc_read_next_fid, NULL, NULL },
-       { "seq_width",   seq_proc_read_seq_width, seq_proc_write_seq_width, NULL },
+       { "space",    seq_client_proc_read_space, seq_client_proc_write_space, NULL },
+       { "width",    seq_client_proc_read_width, seq_client_proc_write_width, NULL },
+       { "server",   seq_client_proc_read_server, NULL, NULL },
+       { "next_fid", seq_client_proc_read_next_fid, NULL, NULL },
        { NULL }};
 #endif
index 5304093..62a6e21 100644 (file)
 struct lu_site;
 struct lu_context;
 
-/* whole sequences space range and zero range definitions */
+/* Whole sequences space range and zero range definitions */
 extern const struct lu_range LUSTRE_SEQ_SPACE_RANGE;
 extern const struct lu_range LUSTRE_SEQ_ZERO_RANGE;
 extern const struct lu_fid LUSTRE_BFL_FID;
 
 enum {
-        /* this is how may FIDs may be allocated in one sequence. 16384 for now */
+        /*
+         * This is how may FIDs may be allocated in one sequence. 16384 for
+         * now.
+         */
         LUSTRE_SEQ_MAX_WIDTH = 0x0000000000004000ULL,
 
-        /* how many sequences may be allocate for meta-sequence (this is 128
-         * sequences). */
+        /*
+         * How many sequences may be allocate for meta-sequence (this is 128
+         * sequences).
+         */
         LUSTRE_SEQ_META_WIDTH = 0x0000000000000080ULL,
 
-        /* this is how many sequences may be in one super-sequence allocated to
-         * MDTs. */
+        /*
+         * This is how many sequences may be in one super-sequence allocated to
+         * MDTs.
+         */
         LUSTRE_SEQ_SUPER_WIDTH = (LUSTRE_SEQ_META_WIDTH * LUSTRE_SEQ_META_WIDTH)
 };
 
@@ -67,32 +74,38 @@ enum lu_cli_type {
 
 struct lu_server_seq;
 
-/* client sequence manager interface */
+/* Client sequence manager interface. */
 struct lu_client_seq {
         /* sequence-controller export. */
         struct obd_export      *lcs_exp;
         struct semaphore        lcs_sem;
 
-        /* range of allowed for allocation sequeces. When using lu_client_seq on
+        /*
+         * Range of allowed for allocation sequeces. When using lu_client_seq on
          * clients, this contains meta-sequence range. And for servers this
-         * contains super-sequence range. */
-        struct lu_range         lcs_range;
+         * contains super-sequence range.
+         */
+        struct lu_range         lcs_space;
 
-        /* seq related proc */
+        /* Seq related proc */
         cfs_proc_dir_entry_t   *lcs_proc_dir;
 
-        /* this holds last allocated fid in last obtained seq */
+        /* This holds last allocated fid in last obtained seq */
         struct lu_fid           lcs_fid;
 
         /* LUSTRE_SEQ_METADATA or LUSTRE_SEQ_DATA */
         enum lu_cli_type        lcs_type;
 
-        /* service uuid, passed from MDT + seq name to form unique seq name to
-         * use it with procfs. */
+        /*
+         * Service uuid, passed from MDT + seq name to form unique seq name to
+         * use it with procfs.
+         */
         char                    lcs_name[80];
 
-        /* sequence width, that is how many objects may be allocated in one
-         * sequence. Default value for it is LUSTRE_SEQ_MAX_WIDTH. */
+        /*
+         * Sequence width, that is how many objects may be allocated in one
+         * sequence. Default value for it is LUSTRE_SEQ_MAX_WIDTH.
+         */
         __u64                   lcs_width;
 
         /* seq-server for direct talking */
@@ -101,40 +114,41 @@ struct lu_client_seq {
 
 /* server sequence manager interface */
 struct lu_server_seq {
-        /* available sequence space */
+        /* Available sequences space */
         struct lu_range         lss_space;
 
-        /* super-sequence range, all super-sequences for other servers are
-         * allocated from it. */
-        struct lu_range         lss_super;
-
-        /* device for server side seq manager needs (saving sequences to backing
-         * store). */
+        /*
+         * Device for server side seq manager needs (saving sequences to backing
+         * store).
+         */
         struct dt_device       *lss_dev;
 
         /* /seq file object device */
         struct dt_object       *lss_obj;
 
-        /* seq related proc */
+        /* Seq related proc */
         cfs_proc_dir_entry_t   *lss_proc_dir;
 
         /* LUSTRE_SEQ_SERVER or LUSTRE_SEQ_CONTROLLER */
         enum lu_mgr_type       lss_type;
 
-        /* client interafce to request controller */
+        /* Client interafce to request controller */
         struct lu_client_seq   *lss_cli;
 
-        /* semaphore for protecting allocation */
+        /* Semaphore for protecting allocation */
         struct semaphore        lss_sem;
 
-        /* service uuid, passed from MDT + seq name to form unique seq name to
-         * use it with procfs. */
+        /*
+         * Service uuid, passed from MDT + seq name to form unique seq name to
+         * use it with procfs.
+         */
         char                    lss_name[80];
 
-        /* allocation chunks for super and meta sequences. Default values are
-         * LUSTRE_SEQ_SUPER_WIDTH and LUSTRE_SEQ_META_WIDTH. */
-        __u64                   lss_super_width;
-        __u64                   lss_meta_width;
+        /*
+         * Allocation chunks for super and meta sequences. Default values are
+         * LUSTRE_SEQ_SUPER_WIDTH and LUSTRE_SEQ_META_WIDTH.
+         */
+        __u64                   lss_width;
 };
 
 int seq_query(struct com_thread_info *info);
index 4e2c6ca..06cc70b 100755 (executable)
@@ -66,14 +66,14 @@ seq_set_width()
 {
     local mds=$1
     local width=$2
-    local file=`ls /proc/fs/lustre/seq/cli-srv-$mds-mdc-*/seq_width` 
+    local file=`ls /proc/fs/lustre/seq/cli-srv-$mds-mdc-*/width` 
     echo $width > $file
 }
 
 seq_get_width()
 {
     local mds=$1
-    local file=`ls /proc/fs/lustre/seq/cli-srv-$mds-mdc-*/seq_width` 
+    local file=`ls /proc/fs/lustre/seq/cli-srv-$mds-mdc-*/width` 
     cat $file
 }