Whamcloud - gitweb
LU-2075 fld: use predefined FIDs
[fs/lustre-release.git] / lustre / fid / fid_handler.c
index e0a3bfa..df3a999 100644 (file)
@@ -121,26 +121,26 @@ static int __seq_server_alloc_super(struct lu_server_seq *seq,
                                     struct lu_seq_range *out,
                                     const struct lu_env *env)
 {
-        struct lu_seq_range *space = &seq->lss_space;
-        int rc;
-        ENTRY;
+       struct lu_seq_range *space = &seq->lss_space;
+       int rc;
+       ENTRY;
 
-        LASSERT(range_is_sane(space));
+       LASSERT(range_is_sane(space));
 
-        if (range_is_exhausted(space)) {
-                CERROR("%s: Sequences space is exhausted\n",
-                       seq->lss_name);
-                RETURN(-ENOSPC);
-        } else {
-                range_alloc(out, space, seq->lss_width);
-        }
+       if (range_is_exhausted(space)) {
+               CERROR("%s: Sequences space is exhausted\n",
+                      seq->lss_name);
+               RETURN(-ENOSPC);
+       } else {
+               range_alloc(out, space, seq->lss_width);
+       }
 
-        rc = seq_store_update(env, seq, out, 1 /* sync */);
+       rc = seq_store_update(env, seq, out, 1 /* sync */);
 
-        CDEBUG(D_INFO, "%s: super-sequence allocation rc = %d "
-               DRANGE"\n", seq->lss_name, rc, PRANGE(out));
+       LCONSOLE_INFO("%s: super-sequence allocation rc = %d " DRANGE"\n",
+                     seq->lss_name, rc, PRANGE(out));
 
-        RETURN(rc);
+       RETURN(rc);
 }
 
 int seq_server_alloc_super(struct lu_server_seq *seq,
@@ -203,7 +203,7 @@ static int range_alloc_set(const struct lu_env *env,
 
         if (range_is_exhausted(loset)) {
                 /* reached high water mark. */
-                struct lu_device *dev = seq->lss_site->ms_lu.ls_top_dev;
+               struct lu_device *dev = seq->lss_site->ms_lu->ls_top_dev;
                 int obd_num_clients = dev->ld_obd->obd_num_exports;
                 __u64 set_sz;
 
@@ -234,40 +234,44 @@ static int __seq_server_alloc_meta(struct lu_server_seq *seq,
                                    struct lu_seq_range *out,
                                    const struct lu_env *env)
 {
-        struct lu_seq_range *space = &seq->lss_space;
-        int rc = 0;
-
-        ENTRY;
-
-        LASSERT(range_is_sane(space));
-
-        /* Check if available space ends and allocate new super seq */
-        if (range_is_exhausted(space)) {
-                if (!seq->lss_cli) {
-                        CERROR("%s: No sequence controller is attached.\n",
-                               seq->lss_name);
-                        RETURN(-ENODEV);
-                }
-
-                rc = seq_client_alloc_super(seq->lss_cli, env);
-                if (rc) {
-                        CERROR("%s: Can't allocate super-sequence, rc %d\n",
-                               seq->lss_name, rc);
-                        RETURN(rc);
-                }
-
-                /* Saving new range to allocation space. */
-                *space = seq->lss_cli->lcs_space;
-                LASSERT(range_is_sane(space));
-        }
-
-        rc = range_alloc_set(env, out, seq);
-        if (rc == 0) {
-                CDEBUG(D_INFO, "%s: Allocated meta-sequence "
-                       DRANGE"\n", seq->lss_name, PRANGE(out));
-        }
-
-        RETURN(rc);
+       struct lu_seq_range *space = &seq->lss_space;
+       int rc = 0;
+
+       ENTRY;
+
+       LASSERT(range_is_sane(space));
+
+       /* Check if available space ends and allocate new super seq */
+       if (range_is_exhausted(space)) {
+               if (!seq->lss_cli) {
+                       CERROR("%s: No sequence controller is attached.\n",
+                              seq->lss_name);
+                       RETURN(-ENODEV);
+               }
+
+               rc = seq_client_alloc_super(seq->lss_cli, env);
+               if (rc) {
+                       CERROR("%s: Can't allocate super-sequence, rc %d\n",
+                              seq->lss_name, rc);
+                       RETURN(rc);
+               }
+
+               /* Saving new range to allocation space. */
+               *space = seq->lss_cli->lcs_space;
+               LASSERT(range_is_sane(space));
+       }
+
+       rc = range_alloc_set(env, out, seq);
+       if (rc != 0) {
+               CERROR("%s: Allocated meta-sequence failed: rc = %d\n",
+                       seq->lss_name, rc);
+               RETURN(rc);
+       }
+
+       CDEBUG(D_INFO, "%s: Allocated meta-sequence " DRANGE"\n",
+               seq->lss_name, PRANGE(out));
+
+       RETURN(rc);
 }
 
 int seq_server_alloc_meta(struct lu_server_seq *seq,
@@ -505,9 +509,9 @@ int seq_server_init(struct lu_server_seq *seq,
                         LUSTRE_SEQ_SPACE_RANGE;
 
                 seq->lss_space.lsr_index = ms->ms_node_id;
-                CDEBUG(D_INFO, "%s: No data found "
-                       "on store. Initialize space\n",
-                       seq->lss_name);
+               LCONSOLE_INFO("%s: No data found "
+                             "on store. Initialize space\n",
+                             seq->lss_name);
 
                 rc = seq_store_update(env, seq, NULL, 0);
                 if (rc) {
@@ -553,18 +557,6 @@ EXPORT_SYMBOL(seq_server_fini);
 
 cfs_proc_dir_entry_t *seq_type_proc_dir = NULL;
 
-static struct lu_local_obj_desc llod_seq_srv = {
-        .llod_name      = LUSTRE_SEQ_SRV_NAME,
-        .llod_oid       = FID_SEQ_SRV_OID,
-        .llod_is_index  = 0,
-};
-
-static struct lu_local_obj_desc llod_seq_ctl = {
-        .llod_name      = LUSTRE_SEQ_CTL_NAME,
-        .llod_oid       = FID_SEQ_CTL_OID,
-        .llod_is_index  = 0,
-};
-
 static int __init fid_mod_init(void)
 {
         seq_type_proc_dir = lprocfs_register(LUSTRE_SEQ_NAME,
@@ -573,9 +565,6 @@ static int __init fid_mod_init(void)
         if (IS_ERR(seq_type_proc_dir))
                 return PTR_ERR(seq_type_proc_dir);
 
-        llo_local_obj_register(&llod_seq_srv);
-        llo_local_obj_register(&llod_seq_ctl);
-
         LU_CONTEXT_KEY_INIT(&seq_thread_key);
         lu_context_key_register(&seq_thread_key);
         return 0;
@@ -583,9 +572,6 @@ static int __init fid_mod_init(void)
 
 static void __exit fid_mod_exit(void)
 {
-        llo_local_obj_unregister(&llod_seq_srv);
-        llo_local_obj_unregister(&llod_seq_ctl);
-
         lu_context_key_degister(&seq_thread_key);
         if (seq_type_proc_dir != NULL && !IS_ERR(seq_type_proc_dir)) {
                 lprocfs_remove(&seq_type_proc_dir);