Whamcloud - gitweb
b=21109 mds_lov_read_objids cleanup and conf-sanity tests
authorVladimir Saveliev <Vladimir.Saveliev@sun.com>
Fri, 21 May 2010 11:54:03 +0000 (15:54 +0400)
committerRobert Read <robert.read@oracle.com>
Mon, 24 May 2010 16:13:47 +0000 (09:13 -0700)
calculate mds->mds_lov_objid_lastidx and mds->mds_lov_objid_lastpage correctly
have index strings big enough to store indicies in decimal
test to check size of lov_objid and
test to check configuraion with big indicies

i=adilger
i=panda
i=nathan

lustre/mds/mds_lov.c
lustre/mgs/mgs_llog.c
lustre/tests/conf-sanity.sh

index 80490f4..5ace81b 100644 (file)
@@ -395,7 +395,7 @@ static int mds_lov_read_objids(struct obd_device *obd)
         if (size == 0)
                 RETURN(0);
 
-        page = (size / (OBJID_PER_PAGE() * sizeof(obd_id))) + 1;
+        page = (size + MDS_LOV_ALLOC_SIZE - 1) / MDS_LOV_ALLOC_SIZE;
         CDEBUG(D_INFO, "file size %lu pages %d\n", size, page);
         for (i = 0; i < page; i++) {
                 obd_id *data;
@@ -409,23 +409,22 @@ static int mds_lov_read_objids(struct obd_device *obd)
                 data = mds->mds_lov_page_array[i];
 
                 rc = fsfilt_read_record(obd, mds->mds_lov_objid_filp, data,
-                                        OBJID_PER_PAGE()*sizeof(obd_id), &off);
+                                        MDS_LOV_ALLOC_SIZE, &off);
                 if (rc < 0) {
                         CERROR("Error reading objids %d\n", rc);
                         GOTO(out, rc);
                 }
+                if (off == off_old) /* hole is read */
+                        off += MDS_LOV_ALLOC_SIZE;
 
-                count += (off - off_old) / sizeof(obd_id);
+                count = (off - off_old) / sizeof(obd_id);
                 if (mds_lov_update_from_read(mds, data, count)) {
                         CERROR("Can't update mds data\n");
                         GOTO(out, rc = -EIO);
                 }
-
-                if (off == off_old)
-                        break; /* eof */
         }
-        mds->mds_lov_objid_lastpage = i;
-        mds->mds_lov_objid_lastidx = count % OBJID_PER_PAGE();
+        mds->mds_lov_objid_lastpage = page - 1;
+        mds->mds_lov_objid_lastidx = count - 1;
 
         CDEBUG(D_INFO, "Read %u - %u %u objid\n", mds->mds_lov_objid_count,
                mds->mds_lov_objid_lastpage, mds->mds_lov_objid_lastidx);
@@ -448,7 +447,7 @@ int mds_lov_write_objids(struct obd_device *obd)
 
         cfs_foreach_bit(mds->mds_lov_page_dirty, i) {
                 obd_id *data =  mds->mds_lov_page_array[i];
-                unsigned int size = OBJID_PER_PAGE()*sizeof(obd_id);
+                unsigned int size = MDS_LOV_ALLOC_SIZE;
                 loff_t off = i * size;
 
                 LASSERT(data != NULL);
index 5cb8264..7b69c45 100644 (file)
@@ -1372,7 +1372,7 @@ static int mgs_write_log_mdc_to_lmv(struct obd_device *obd, struct fs_db *fsdb,
 {
         struct llog_handle *llh = NULL;
         char *mdcname, *nodeuuid, *mdcuuid, *lmvuuid;
-        char index[5];
+        char index[6];
         int i, rc;
         ENTRY;
 
@@ -1669,7 +1669,7 @@ static int mgs_write_log_osc_to_lov(struct obd_device *obd, struct fs_db *fsdb,
 {
         struct llog_handle *llh = NULL;
         char *nodeuuid, *oscname, *oscuuid, *lovuuid, *svname;
-        char index[5];
+        char index[6];
         int i, rc;
 
         ENTRY;
index 5587acf..c5c3bfa 100644 (file)
@@ -2366,6 +2366,58 @@ test_54b() {
 }
 run_test 54b "llverfs"
 
+lov_objid_size()
+{
+       local max_ost_index=$1
+       echo -n $(((max_ost_index + 1) * 8))
+}
+
+test_55() {
+       local mdsdev=$(mdsdevname 1)
+       local ostdev=$(ostdevname 1)
+       local saved_opts=$OST_MKFS_OPTS
+
+       for i in 0 1023 2048
+       do
+               OST_MKFS_OPTS="$saved_opts --index $i"
+               reformat
+
+               setup_noconfig
+               stopall
+
+               setup
+               sync
+               echo checking size of lov_objid for ost index $i
+               LOV_OBJID_SIZE=$(do_facet mds1 "$DEBUGFS -R 'stat lov_objid' $mdsdev 2>/dev/null" | grep ^User | awk '{print $6}')
+               if [ "$LOV_OBJID_SIZE" != $(lov_objid_size $i) ]; then
+                       error "lov_objid size has to be $(lov_objid_size $i), not $LOV_OBJID_SIZE"
+               else
+                       echo ok, lov_objid size is correct: $LOV_OBJID_SIZE
+               fi
+               stopall
+       done
+
+       OST_MKFS_OPTS=$saved_opts
+       reformat
+}
+run_test 55 "check lov_objid size"
+
+test_56() {
+       add mds1 $MDS_MKFS_OPTS --mkfsoptions='\"-J size=16\"' --reformat $(mdsdevname 1)
+       add ost1 $OST_MKFS_OPTS --index=1000 --reformat $(ostdevname 1)
+       add ost2 $OST_MKFS_OPTS --index=10000 --reformat $(ostdevname 2)
+
+       start_mds
+       start_ost
+       start_ost2 || error "Unable to start second ost"
+       mount_client $MOUNT || error "Unable to mount client"
+       echo ok
+       $LFS osts
+       stopall
+       reformat
+}
+run_test 56 "check big indexes"
+
 cleanup_gss
 equals_msg `basename $0`: test complete
 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG && grep -q FAIL $TESTSUITELOG && exit 1 || true