Whamcloud - gitweb
- one more portion of fixes and cleanups after Nikita's CODEINSP.
authoryury <yury>
Thu, 10 Aug 2006 15:37:26 +0000 (15:37 +0000)
committeryury <yury>
Thu, 10 Aug 2006 15:37:26 +0000 (15:37 +0000)
lustre/fld/fld_handler.c
lustre/fld/fld_internal.h
lustre/fld/fld_request.c
lustre/fld/lproc_fld.c
lustre/include/lustre_fld.h

index e495e36..2485cc0 100644 (file)
@@ -67,31 +67,28 @@ static void __exit fld_mod_exit(void)
 }
 
 /* insert index entry and update cache */
-int fld_server_create(struct lu_server_fld *fld,
-                      const struct lu_context *ctx,
-                      seqno_t seq, mdsno_t mds)
+static int fld_server_create(struct lu_server_fld *fld,
+                             const struct lu_context *ctx,
+                             seqno_t seq, mdsno_t mds)
 {
         return fld_index_create(fld, ctx, seq, mds);
 }
-EXPORT_SYMBOL(fld_server_create);
 
 /* delete index entry */
-int fld_server_delete(struct lu_server_fld *fld,
-                      const struct lu_context *ctx,
-                      seqno_t seq)
+static int fld_server_delete(struct lu_server_fld *fld,
+                             const struct lu_context *ctx,
+                             seqno_t seq)
 {
         return fld_index_delete(fld, ctx, seq);
 }
-EXPORT_SYMBOL(fld_server_delete);
 
 /* issue on-disk index lookup */
-int fld_server_lookup(struct lu_server_fld *fld,
-                      const struct lu_context *ctx,
-                      seqno_t seq, mdsno_t *mds)
+static int fld_server_lookup(struct lu_server_fld *fld,
+                             const struct lu_context *ctx,
+                             seqno_t seq, mdsno_t *mds)
 {
         return fld_index_lookup(fld, ctx, seq, mds);
 }
-EXPORT_SYMBOL(fld_server_lookup);
 
 static int fld_server_handle(struct lu_server_fld *fld,
                              const struct lu_context *ctx,
index 8d0b3ef..8f3dad2 100644 (file)
@@ -40,7 +40,7 @@ enum {
         FLD_HTABLE_SIZE = 256
 };
 
-extern struct lu_fld_hash fld_hash[2];
+extern struct lu_fld_hash fld_hash[];
 
 #ifdef __KERNEL__
 #define FLD_SERVICE_WATCHDOG_TIMEOUT (obd_timeout * 1000)
index 20e6f2a..7389e4a 100644 (file)
@@ -93,7 +93,7 @@ fld_dht_scan(struct lu_client_fld *fld, seqno_t seq)
         return fld_dht_scan(fld, seq);
 }
 
-struct lu_fld_hash fld_hash[2] = {
+struct lu_fld_hash fld_hash[3] = {
         {
                 .fh_name = "DHT",
                 .fh_hash_func = fld_dht_hash,
@@ -103,6 +103,9 @@ struct lu_fld_hash fld_hash[2] = {
                 .fh_name = "RRB",
                 .fh_hash_func = fld_rrb_hash,
                 .fh_scan_func = fld_rrb_scan
+        },
+        {
+                0,
         }
 };
 
@@ -372,47 +375,39 @@ out_req:
         return rc;
 }
 
-static int __fld_client_create(struct lu_client_fld *fld,
-                               seqno_t seq, mdsno_t mds,
-                    struct md_fld *md_fld)
+int fld_client_create(struct lu_client_fld *fld,
+                      seqno_t seq, mdsno_t mds)
 {
+        struct md_fld md_fld = { .mf_seq = seq, .mf_mds = mds };
         struct fld_target *target;
-        __u32 rc;
+        int rc;
         ENTRY;
 
         target = fld_client_get_target(fld, seq);
         LASSERT(target != NULL);
 
-        rc = fld_client_rpc(target->fldt_exp, md_fld, FLD_CREATE);
+        rc = fld_client_rpc(target->fldt_exp, &md_fld, FLD_CREATE);
 
-        if (rc  == 0) {
-                /* do not return result of calling fld_cache_insert()
+        if (rc == 0) {
+                /*
+                 * Do not return result of calling fld_cache_insert()
                  * here. First of all because it may return -EEXISTS. Another
                  * reason is that, we do not want to stop proceeding because of
-                 * cache errors. --umka */
+                 * cache errors. --umka
+                 */
                 fld_cache_insert(fld->fld_cache, seq, mds);
         }
-
-        RETURN(rc);
-}
-
-int fld_client_create(struct lu_client_fld *fld,
-                      seqno_t seq, mdsno_t mds)
-{
-        struct md_fld md_fld = { .mf_seq = seq, .mf_mds = mds };
-        __u32 rc;
-        ENTRY;
-
-        rc = __fld_client_create(fld, seq, mds, &md_fld);
         RETURN(rc);
 }
 EXPORT_SYMBOL(fld_client_create);
 
-static int __fld_client_delete(struct lu_client_fld *fld,
-                               seqno_t seq, struct md_fld *md_fld)
+int fld_client_delete(struct lu_client_fld *fld,
+                      seqno_t seq)
 {
+        struct md_fld md_fld = { .mf_seq = seq, .mf_mds = 0 };
         struct fld_target *target;
-        __u32 rc;
+        int rc;
+        ENTRY;
 
         fld_cache_delete(fld->fld_cache, seq);
 
@@ -420,25 +415,16 @@ static int __fld_client_delete(struct lu_client_fld *fld,
         LASSERT(target != NULL);
 
         rc = fld_client_rpc(target->fldt_exp,
-                            md_fld, FLD_DELETE);
-        RETURN(rc);
-}
-
-int fld_client_delete(struct lu_client_fld *fld,
-                      seqno_t seq)
-{
-        struct md_fld md_fld = { .mf_seq = seq, .mf_mds = 0 };
-        __u32 rc;
-
-        rc = __fld_client_delete(fld, seq, &md_fld);
+                            &md_fld, FLD_DELETE);
+        
         RETURN(rc);
 }
 EXPORT_SYMBOL(fld_client_delete);
 
-static int __fld_client_lookup(struct lu_client_fld *fld,
-                               seqno_t seq, mdsno_t *mds,
-                               struct md_fld *md_fld)
+int fld_client_lookup(struct lu_client_fld *fld,
+                      seqno_t seq, mdsno_t *mds)
 {
+        struct md_fld md_fld = { .mf_seq = seq, .mf_mds = 0 };
         struct fld_target *target;
         int rc;
         ENTRY;
@@ -453,25 +439,16 @@ static int __fld_client_lookup(struct lu_client_fld *fld,
         LASSERT(target != NULL);
 
         rc = fld_client_rpc(target->fldt_exp,
-                            md_fld, FLD_LOOKUP);
-        if (rc == 0)
-                *mds = md_fld->mf_mds;
-
-        /* do not return error here as well. See previous comment in same
-         * situation in function fld_client_create(). --umka */
-        fld_cache_insert(fld->fld_cache, seq, *mds);
-
-        RETURN(rc);
-}
-
-int fld_client_lookup(struct lu_client_fld *fld,
-                      seqno_t seq, mdsno_t *mds)
-{
-        struct md_fld md_fld = { .mf_seq = seq, .mf_mds = 0 };
-        int rc;
-        ENTRY;
-
-        rc = __fld_client_lookup(fld, seq, mds, &md_fld);
+                            &md_fld, FLD_LOOKUP);
+        if (rc == 0) {
+                *mds = md_fld.mf_mds;
+
+                /*
+                 * Do not return error here as well. See previous comment in
+                 * same situation in function fld_client_create(). --umka
+                 */
+                fld_cache_insert(fld->fld_cache, seq, *mds);
+        }
         RETURN(rc);
 }
 EXPORT_SYMBOL(fld_client_lookup);
index 983c9d7..817db2f 100644 (file)
@@ -106,9 +106,8 @@ fld_proc_write_hash(struct file *file, const char *buffer,
 
         LASSERT(fld != NULL);
 
-        for (i = 0; i < ARRAY_SIZE(fld_hash); i++) {
-                if (fld_hash[i].fh_name == NULL ||
-                    count != strlen(fld_hash[i].fh_name))
+        for (i = 0; fld_hash[i].fh_name != NULL; i++) {
+                if (count != strlen(fld_hash[i].fh_name))
                         continue;
                         
                 if (!strncmp(fld_hash[i].fh_name, buffer, count)) {
index 363f44e..1b3ed54 100644 (file)
@@ -117,18 +117,6 @@ int fld_server_init(struct lu_server_fld *fld,
 void fld_server_fini(struct lu_server_fld *fld,
                      const struct lu_context *ctx);
 
-int fld_server_lookup(struct lu_server_fld *fld,
-                      const struct lu_context *ctx,
-                      seqno_t seq, mdsno_t *mds);
-        
-int fld_server_create(struct lu_server_fld *fld,
-                      const struct lu_context *ctx,
-                      seqno_t seq, mdsno_t mds);
-
-int fld_server_delete(struct lu_server_fld *fld,
-                      const struct lu_context *ctx,
-                      seqno_t seq);
-
 /* client methods */
 int fld_client_init(struct lu_client_fld *fld,
                     const char *uuid,