Whamcloud - gitweb
LU-957 lfsck: misc fixes for lfsck
authorFan Yong <yong.fan@whamcloud.com>
Fri, 6 Jul 2012 05:28:28 +0000 (13:28 +0800)
committerOleg Drokin <green@whamcloud.com>
Fri, 6 Jul 2012 23:19:57 +0000 (19:19 -0400)
Some fixes for typo, style, and code cleanup.

Signed-off-by: Fan Yong <yong.fan@whamcloud.com>
Change-Id: Ia027486de26cf8ee7f41da1a33a4fc39d9656752
Reviewed-on: http://review.whamcloud.com/3289
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/mdd/mdd_device.c
lustre/mdd/mdd_lfsck.c
lustre/tests/sanity-scrub.sh
lustre/tests/scrub-performance.sh
lustre/utils/lustre_lfsck.c

index 154225b..2334f03 100644 (file)
@@ -1686,7 +1686,7 @@ static struct lu_local_obj_desc llod_mdd_root = {
         .llod_feat      = &dt_directory_features,
 };
 
-static struct lu_local_obj_desc llod_lfsck_bookmark_key = {
+static struct lu_local_obj_desc llod_lfsck_bookmark = {
        .llod_name      = lfsck_bookmark_name,
        .llod_oid       = LFSCK_BOOKMARK_OID,
        .llod_is_index  = 0,
@@ -1700,7 +1700,7 @@ static int __init mdd_mod_init(void)
        llo_local_obj_register(&llod_capa_key);
        llo_local_obj_register(&llod_mdd_orphan);
        llo_local_obj_register(&llod_mdd_root);
-       llo_local_obj_register(&llod_lfsck_bookmark_key);
+       llo_local_obj_register(&llod_lfsck_bookmark);
 
        return class_register_type(&mdd_obd_device_ops, NULL, lvars.module_vars,
                                   LUSTRE_MDD_NAME, &mdd_device_type);
@@ -1711,7 +1711,7 @@ static void __exit mdd_mod_exit(void)
        llo_local_obj_unregister(&llod_capa_key);
        llo_local_obj_unregister(&llod_mdd_orphan);
        llo_local_obj_unregister(&llod_mdd_root);
-       llo_local_obj_unregister(&llod_lfsck_bookmark_key);
+       llo_local_obj_unregister(&llod_lfsck_bookmark);
 
        class_unregister_type(LUSTRE_MDD_NAME);
 }
index fc2c469..5cb24d3 100644 (file)
@@ -174,7 +174,7 @@ out:
                 *      To support that, we need to record the lfsck status in
                 *      the lfsck on-disk bookmark file. But now, there is not
                 *      lfsck component under the lfsck framework. To avoid to
-                *      introduce nunecessary bookmark incompatibility issues,
+                *      introduce unnecessary bookmark incompatibility issues,
                 *      we write nothing to the lfsck bookmark file now.
                 *
                 *      Instead, we will reuse dt_it_ops::put() method to notify
index aa32eb7..660c0bc 100644 (file)
@@ -322,7 +322,8 @@ test_6() {
        diff -q $LUSTRE/tests/test-framework.sh $DIR/$tdir/test-framework.sh ||
                error "(6) File diff failed unexpected!"
 
-       sleep 8
+       # Sleep 5 sec to guarantee at least one object processed by OI scrub
+       sleep 5
        # Fail the OI scrub to guarantee there is at least one checkpoint
        #define OBD_FAIL_OSD_SCRUB_FATAL         0x192
        do_facet $SINGLEMDS $LCTL set_param fail_loc=0x80000192
@@ -347,7 +348,7 @@ test_6() {
        #define OBD_FAIL_OSD_SCRUB_CRASH         0x191
        do_facet $SINGLEMDS $LCTL set_param fail_loc=0x80000191
        sleep 4
-       local POSITION0=$($SHOW_SCRUB | \
+       local POSITION0=$($SHOW_SCRUB |
                        awk '/^last_checkpoint_position/ {print $2}')
        POSITION0=$((POSITION0 + 1))
 
@@ -365,7 +366,7 @@ test_6() {
        [ "$STATUS" == "scanning" ] ||
                error "(13) Expect 'scanning', but got '$STATUS'"
 
-       local POSITION1=$($SHOW_SCRUB | \
+       local POSITION1=$($SHOW_SCRUB |
                        awk '/^latest_start_position/ {print $2}')
        [ $POSITION0 -eq $POSITION1 ] ||
                error "(14) Expect position: $POSITION0, but got $POSITION1"
index 8c9b675..814a919 100644 (file)
@@ -155,7 +155,7 @@ test_0() {
                        error "Fail to start MDS!"
 
                while true; do
-                       local STATUS=$($SHOW_SCRUB | \
+                       local STATUS=$($SHOW_SCRUB |
                                        awk '/^status/ { print $2 }')
                        [ "$STATUS" == "completed" ] && break
                        sleep 3 # check status every 3 seconds
index 2626b3f..89ec9b5 100644 (file)
@@ -20,7 +20,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright (c) 2011 Whamcloud, Inc.
+ * Copyright (c) 2012 Whamcloud, Inc.
  */
 /*
  * lustre/utils/lustre_lfsck.c
@@ -104,6 +104,20 @@ static void usage_stop(void)
                "-h: Help information.\n");
 }
 
+static int lfsck_pack_dev(struct obd_ioctl_data *data, char *arg)
+{
+       data->ioc_inllen4 = strlen(arg) + 1;
+       if (data->ioc_inllen4 > MAX_OBD_NAME) {
+               fprintf(stderr, "MDT device name is too long. "
+                       "Valid length should be less than %d\n", MAX_OBD_NAME);
+               return -EINVAL;
+       }
+
+       data->ioc_inlbuf4 = arg;
+       data->ioc_dev = OBD_DEV_BY_DEVNAME;
+       return 0;
+}
+
 int jt_lfsck_start(int argc, char **argv)
 {
        struct obd_ioctl_data data;
@@ -121,16 +135,9 @@ int jt_lfsck_start(int argc, char **argv)
                                  &index)) != EOF) {
                switch (opt) {
                case 'M':
-                       data.ioc_inllen4 = strlen(optarg) + 1;
-                       if (data.ioc_inllen4 > MAX_OBD_NAME) {
-                               fprintf(stderr, "MDT device name is too long. "
-                                       "Valid length should be less than %d\n",
-                                       MAX_OBD_NAME);
-                               return -EINVAL;
-                       }
-
-                       data.ioc_inlbuf4 = optarg;
-                       data.ioc_dev = OBD_DEV_BY_DEVNAME;
+                       rc = lfsck_pack_dev(&data, optarg);
+                       if (rc != 0)
+                               return rc;
                        break;
                case 'e':
                        if (strcmp(optarg, "abort") == 0) {
@@ -270,16 +277,9 @@ int jt_lfsck_stop(int argc, char **argv)
                                  &index)) != EOF) {
                switch (opt) {
                case 'M':
-                       data.ioc_inllen4 = strlen(optarg) + 1;
-                       if (data.ioc_inllen4 > MAX_OBD_NAME) {
-                               fprintf(stderr, "MDT device name is too long. "
-                                       "Valid length should be less than %d\n",
-                                       MAX_OBD_NAME);
-                               return -EINVAL;
-                       }
-
-                       data.ioc_inlbuf4 = optarg;
-                       data.ioc_dev = OBD_DEV_BY_DEVNAME;
+                       rc = lfsck_pack_dev(&data, optarg);
+                       if (rc != 0)
+                               return rc;
                        break;
                case 'h':
                        usage_stop();