Whamcloud - gitweb
LU-1303 fld: verify support for range lookups
authorAlex Zhuravlev <alexey.zhuravlev@intel.com>
Sat, 29 Sep 2012 20:38:18 +0000 (00:38 +0400)
committerAndreas Dilger <adilger@whamcloud.com>
Sun, 30 Sep 2012 06:36:09 +0000 (02:36 -0400)
if the underlying storage does not support range lookups,
then FLD disables any mappings with server index different
from 0, thus disabling DNE and FID-on-OST features.

Signed-off-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Change-Id: Id93b01385acfafde024dff33557656afdcd1e4b3
Reviewed-on: http://review.whamcloud.com/4133
Reviewed-by: Mike Pershin <tappro@whamcloud.com>
Tested-by: Hudson
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
lustre/fld/fld_handler.c
lustre/fld/fld_index.c
lustre/include/lustre_fld.h

index 9f3f1ef..1d28b21 100644 (file)
@@ -117,6 +117,11 @@ int fld_declare_server_create(struct lu_server_fld *fld,
 
         ENTRY;
 
 
         ENTRY;
 
+       if (fld->lsf_no_range_lookup) {
+               /* Stub for underlying FS which can't lookup ranges */
+               return 0;
+       }
+
         /* for ldiskfs OSD it's enough to declare operation with any ops
          * with DMU we'll probably need to specify exact key/value */
         rc = dt_obj->do_index_ops->dio_declare_delete(env, dt_obj, NULL, th);
         /* for ldiskfs OSD it's enough to declare operation with any ops
          * with DMU we'll probably need to specify exact key/value */
         rc = dt_obj->do_index_ops->dio_declare_delete(env, dt_obj, NULL, th);
index 2c3ebe8..e4c4169 100644 (file)
@@ -72,7 +72,7 @@ static const struct lu_seq_range IGIF_FLD_RANGE = {
 };
 
 const struct dt_index_features fld_index_features = {
 };
 
 const struct dt_index_features fld_index_features = {
-        .dif_flags       = DT_IND_UPDATE,
+       .dif_flags       = DT_IND_UPDATE | DT_IND_RANGE,
         .dif_keysize_min = sizeof(seqno_t),
         .dif_keysize_max = sizeof(seqno_t),
         .dif_recsize_min = sizeof(struct lu_seq_range),
         .dif_keysize_min = sizeof(seqno_t),
         .dif_keysize_max = sizeof(seqno_t),
         .dif_recsize_min = sizeof(struct lu_seq_range),
@@ -149,6 +149,11 @@ int fld_declare_index_create(struct lu_server_fld *fld,
 
         ENTRY;
 
 
         ENTRY;
 
+       if (fld->lsf_no_range_lookup) {
+               /* Stub for underlying FS which can't lookup ranges */
+               return 0;
+       }
+
         start = range->lsr_start;
         LASSERT(range_is_sane(range));
 
         start = range->lsr_start;
         LASSERT(range_is_sane(range));
 
@@ -180,6 +185,17 @@ int fld_index_create(struct lu_server_fld *fld,
 
         ENTRY;
 
 
         ENTRY;
 
+       if (fld->lsf_no_range_lookup) {
+               /* Stub for underlying FS which can't lookup ranges */
+               if (range->lsr_index != 0) {
+                       CERROR("%s: FLD backend does not support range"
+                              "lookups, so DNE and FIDs-on-OST are not"
+                              "supported in this configuration\n",
+                              fld->lsf_name);
+                       return -EINVAL;
+               }
+       }
+
         start = range->lsr_start;
         LASSERT(range_is_sane(range));
 
         start = range->lsr_start;
         LASSERT(range_is_sane(range));
 
@@ -248,6 +264,17 @@ int fld_index_lookup(struct lu_server_fld *fld,
 
         ENTRY;
 
 
         ENTRY;
 
+       if (fld->lsf_no_range_lookup) {
+               /* Stub for underlying FS which can't lookup ranges */
+               range->lsr_start = 0;
+               range->lsr_end = ~0;
+               range->lsr_index = 0;
+               range->lsr_flags = LU_SEQ_RANGE_MDT;
+
+               range_cpu_to_be(range, range);
+               return 0;
+       }
+
         info = lu_context_key_get(&env->le_ctx, &fld_thread_key);
         fld_rec = &info->fti_rec;
 
         info = lu_context_key_get(&env->le_ctx, &fld_thread_key);
         fld_rec = &info->fti_rec;
 
@@ -322,9 +349,21 @@ int fld_index_init(struct lu_server_fld *fld,
                                 lu_object_put(env, &dt_obj->do_lu);
                                 fld->lsf_obj = NULL;
                         }
                                 lu_object_put(env, &dt_obj->do_lu);
                                 fld->lsf_obj = NULL;
                         }
-                } else
-                        CERROR("%s: File \"%s\" is not an index!\n",
-                               fld->lsf_name, fld_index_name);
+               } else if (rc == -ERANGE) {
+                       CWARN("%s: File \"%s\" doesn't support range lookup, "
+                             "using stub. DNE and FIDs on OST will not work "
+                             "with this backend\n",
+                             fld->lsf_name, fld_index_name);
+
+                       LASSERT(dt_obj->do_index_ops == NULL);
+                       fld->lsf_no_range_lookup = 1;
+                       rc = 0;
+               } else {
+                       CERROR("%s: File \"%s\" is not index, rc %d!\n",
+                              fld->lsf_name, fld_index_name, rc);
+                       lu_object_put(env, &fld->lsf_obj->do_lu);
+                       fld->lsf_obj = NULL;
+               }
 
 
         } else {
 
 
         } else {
index 0279814..836ecfd 100644 (file)
@@ -97,6 +97,11 @@ struct lu_server_fld {
         /**
          * Fld service name in form "fld-srv-lustre-MDTXXX" */
         char                     lsf_name[80];
         /**
          * Fld service name in form "fld-srv-lustre-MDTXXX" */
         char                     lsf_name[80];
+
+       /**
+        * Backend does not support range lookups,
+        * indexes other that 0 will be prohibited */
+       int                      lsf_no_range_lookup;
 };
 
 struct lu_client_fld {
 };
 
 struct lu_client_fld {