Whamcloud - gitweb
LU-13107 utils: remove lctl lov_getconfig command 06/37106/11
authorAndreas Dilger <adilger@whamcloud.com>
Fri, 26 Feb 2021 21:57:28 +0000 (16:57 -0500)
committerOleg Drokin <green@whamcloud.com>
Sat, 13 Mar 2021 18:33:43 +0000 (18:33 +0000)
The "lctl lov_getconfig" command has been obsolete for some time,
but was kept around for sanity test_44a to work properly.  Now
that LU-11656 has landed, "lfs getstripe -d $DIR" can be used to
get the actual layout used for files created in a directory.

Remove the lov_getconfig command along with the IOC definition
it was using.

Test-Parameters: envdefinitions=ONLY=41a testlist=sanity
Change-Id: If94471b50fafc157c043d241dc19cdcd714cab07
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/37106
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/uapi/linux/lustre/lustre_ioctl.h
lustre/lov/lov_obd.c
lustre/tests/sanity.sh
lustre/utils/lctl.c
lustre/utils/obd.c
lustre/utils/obdctl.h

index 43dbf5a..927f585 100644 (file)
@@ -163,10 +163,9 @@ static inline __u32 obd_ioctl_packlen(struct obd_ioctl_data *data)
 #define OBD_IOC_GETNAME                _IOWR('f', 131, OBD_IOC_DATA_TYPE)
 #define OBD_IOC_GETMDNAME      _IOR('f', 131, char[MAX_OBD_NAME])
 #define OBD_IOC_GETDTNAME      OBD_IOC_GETNAME
-#define OBD_IOC_LOV_GET_CONFIG _IOWR('f', 132, OBD_IOC_DATA_TYPE)
+/*      OBD_IOC_LOV_GET_CONFIG _IOWR('f', 132, OBD_IOC_DATA_TYPE) until 2.14 */
 #define OBD_IOC_CLIENT_RECOVER _IOW('f', 133, OBD_IOC_DATA_TYPE)
 /* was OBD_IOC_PING_TARGET     _IOW('f', 136, OBD_IOC_DATA_TYPE) until 2.11 */
-
 /*     OBD_IOC_DEC_FS_USE_COUNT _IO('f', 139) */
 /* was OBD_IOC_NO_TRANSNO      _IOW('f', 140, OBD_IOC_DATA_TYPE) until 2.14 */
 #define OBD_IOC_SET_READONLY   _IOW('f', 141, OBD_IOC_DATA_TYPE)
index e8c8301..762e20a 100644 (file)
@@ -953,7 +953,6 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
        struct obd_device *obd = class_exp2obd(exp);
        struct lov_obd *lov = &obd->u.lov;
        int i = 0, rc = 0, count = lov->desc.ld_tgt_count;
-       struct obd_uuid *uuidp;
 
        ENTRY;
        switch (cmd) {
@@ -1003,48 +1002,6 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                        RETURN(-EFAULT);
                break;
         }
-       case OBD_IOC_LOV_GET_CONFIG: {
-               struct obd_ioctl_data *data = NULL;
-               struct lov_desc *desc;
-               __u32 *genp;
-
-               len = 0;
-               if (obd_ioctl_getdata(&data, &len, uarg))
-                       RETURN(-EINVAL);
-
-               if (sizeof(*desc) > data->ioc_inllen1) {
-                       OBD_FREE_LARGE(data, len);
-                       RETURN(-EINVAL);
-               }
-
-               if (sizeof(uuidp->uuid) * count > data->ioc_inllen2) {
-                       OBD_FREE_LARGE(data, len);
-                       RETURN(-EINVAL);
-               }
-
-               if (sizeof(__u32) * count > data->ioc_inllen3) {
-                       OBD_FREE_LARGE(data, len);
-                       RETURN(-EINVAL);
-               }
-
-               desc = (struct lov_desc *)data->ioc_inlbuf1;
-               memcpy(desc, &lov->desc, sizeof(*desc));
-
-               uuidp = (struct obd_uuid *)data->ioc_inlbuf2;
-               genp = (__u32 *)data->ioc_inlbuf3;
-               /* the uuid will be empty for deleted OSTs */
-               for (i = 0; i < count; i++, uuidp++, genp++) {
-                       if (!lov->lov_tgts[i])
-                               continue;
-                       *uuidp = lov->lov_tgts[i]->ltd_uuid;
-                       *genp = lov->lov_tgts[i]->ltd_gen;
-               }
-
-               if (copy_to_user(uarg, data, len))
-                       rc = -EFAULT;
-               OBD_FREE_LARGE(data, len);
-               break;
-       }
         case OBD_IOC_QUOTACTL: {
                 struct if_quotactl *qctl = karg;
                 struct lov_tgt_desc *tgt = NULL;
index 7d68c91..986228d 100755 (executable)
@@ -5242,17 +5242,14 @@ test_44A() { # was test_44
 run_test 44A "zero length read from a sparse stripe"
 
 test_44a() {
-       local nstripe=$($LCTL lov_getconfig $DIR | grep default_stripe_count: |
-               awk '{ print $2 }')
+       local nstripe=$($LFS getstripe -c -d $DIR)
        [ -z "$nstripe" ] && skip "can't get stripe info"
        [[ $nstripe -gt $OSTCOUNT ]] &&
-               skip "Wrong default_stripe_count: $nstripe OSTCOUNT: $OSTCOUNT"
+               skip "Wrong default stripe_count: $nstripe OSTCOUNT: $OSTCOUNT"
 
-       local stride=$($LCTL lov_getconfig $DIR | grep default_stripe_size: |
-               awk '{ print $2 }')
+       local stride=$($LFS getstripe -S -d $DIR)
        if [[ $nstripe -eq 0 || $nstripe -eq -1 ]]; then
-               nstripe=$($LCTL lov_getconfig $DIR | grep obd_count: |
-                       awk '{ print $2 }')
+               nstripe=$($LFS df $DIR | grep OST: | wc -l)
        fi
 
        OFFSETS="0 $((stride/2)) $((stride-1))"
index 830d240..0b09bb1 100644 (file)
@@ -556,11 +556,6 @@ command_t cmdlist[] = {
         "remove one log from catalog or plain log, erase it from disk.\n"
         "usage: llog_remove <logname|LLOG_ID> [--log_id <id>]"},
        {"==== obsolete (DANGEROUS) ====", NULL, 0, "obsolete (DANGEROUS)"},
-       /* some test scripts still use these */
-       /* saving for sanity 44a */
-       {"lov_getconfig", jt_obd_lov_getconfig, 0,
-        "read lov configuration from an mds device\n"
-        "usage: lov_getconfig <mountpoint>"},
        /* network operations */
        {"add_interface", jt_ptl_add_interface, 0, "add interface entry\n"
         "usage: add_interface ip [netmask]"},
index d3762de..1ccaaad 100644 (file)
@@ -2253,110 +2253,6 @@ int jt_obd_test_brw(int argc, char **argv)
        return rc;
 }
 
-int jt_obd_lov_getconfig(int argc, char **argv)
-{
-       struct obd_ioctl_data data;
-       struct lov_desc desc;
-       struct obd_uuid *uuidarray;
-       char rawbuf[MAX_IOC_BUFLEN], *buf = rawbuf;
-       __u32 *obdgens;
-       char *path;
-       int rc, fd;
-
-       memset(&data, 0, sizeof(data));
-       data.ioc_dev = cur_device;
-
-       if (argc != 2)
-               return CMD_HELP;
-
-       path = argv[1];
-       fd = open(path, O_RDONLY);
-       if (fd < 0) {
-               fprintf(stderr, "open \"%s\" failed: %s\n", path,
-                       strerror(errno));
-               return -errno;
-       }
-
-       memset(&desc, 0, sizeof(desc));
-       obd_str2uuid(&desc.ld_uuid, argv[1]);
-       desc.ld_tgt_count = ((MAX_IOC_BUFLEN - sizeof(data) - sizeof(desc)) /
-                            (sizeof(*uuidarray) + sizeof(*obdgens)));
-
-repeat:
-       uuidarray = calloc(desc.ld_tgt_count, sizeof(*uuidarray));
-       if (!uuidarray) {
-               fprintf(stderr, "error: %s: no memory for %d uuid's\n",
-                       jt_cmdname(argv[0]), desc.ld_tgt_count);
-               rc = -ENOMEM;
-               goto out;
-       }
-       obdgens = calloc(desc.ld_tgt_count, sizeof(*obdgens));
-       if (!obdgens) {
-               fprintf(stderr, "error: %s: no memory for %d generation #'s\n",
-                       jt_cmdname(argv[0]), desc.ld_tgt_count);
-               rc = -ENOMEM;
-               goto out_uuidarray;
-       }
-
-       memset(buf, 0, sizeof(rawbuf));
-       data.ioc_inllen1 = sizeof(desc);
-       data.ioc_inlbuf1 = (char *)&desc;
-       data.ioc_inllen2 = desc.ld_tgt_count * sizeof(*uuidarray);
-       data.ioc_inlbuf2 = (char *)uuidarray;
-       data.ioc_inllen3 = desc.ld_tgt_count * sizeof(*obdgens);
-       data.ioc_inlbuf3 = (char *)obdgens;
-
-       if (llapi_ioctl_pack(&data, &buf, sizeof(rawbuf))) {
-               fprintf(stderr, "error: %s: invalid ioctl\n",
-                       jt_cmdname(argv[0]));
-               rc = -EINVAL;
-               goto out_obdgens;
-       }
-       rc = ioctl(fd, OBD_IOC_LOV_GET_CONFIG, buf);
-       if (rc == -ENOSPC) {
-               free(uuidarray);
-               free(obdgens);
-               goto repeat;
-       } else if (rc) {
-               fprintf(stderr, "error: %s: ioctl error: %s\n",
-                       jt_cmdname(argv[0]), strerror(rc = errno));
-       } else {
-               struct obd_uuid *uuidp;
-               __u32 *genp;
-               int i;
-
-               if (llapi_ioctl_unpack(&data, buf, sizeof(rawbuf))) {
-                       fprintf(stderr, "error: %s: invalid reply\n",
-                               jt_cmdname(argv[0]));
-                       rc = -EINVAL;
-                       goto out;
-               }
-               if (desc.ld_default_stripe_count == (__u32)-1)
-                       printf("default_stripe_count: %d\n", -1);
-               else
-                       printf("default_stripe_count: %u\n",
-                              desc.ld_default_stripe_count);
-               printf("default_stripe_size: %ju\n",
-                      (uintmax_t)desc.ld_default_stripe_size);
-               printf("default_stripe_offset: %jd\n",
-                      (uintmax_t)desc.ld_default_stripe_offset);
-               printf("default_stripe_pattern: %u\n", desc.ld_pattern);
-               printf("obd_count: %u\n", desc.ld_tgt_count);
-               printf("OBDS:\tobdidx\t\tobdgen\t\t obduuid\n");
-               uuidp = uuidarray;
-               genp = obdgens;
-               for (i = 0; i < desc.ld_tgt_count; i++, uuidp++, genp++)
-                       printf("\t%6u\t%14u\t\t %s\n", i, *genp, (char *)uuidp);
-       }
-out_obdgens:
-       free(obdgens);
-out_uuidarray:
-       free(uuidarray);
-out:
-       close(fd);
-       return rc;
-}
-
 static int do_activate(int argc, char **argv, int flag)
 {
        struct obd_ioctl_data data;
index 8fbf115..742173a 100644 (file)
@@ -118,7 +118,6 @@ int jt_obd_destroy(int argc, char **argv);
 int jt_obd_getattr(int argc, char **argv);
 int jt_obd_test_getattr(int argc, char **argv);
 int jt_obd_test_brw(int argc, char **argv);
-int jt_obd_lov_getconfig(int argc, char **argv);
 int jt_obd_test_ldlm(int argc, char **argv);
 int jt_obd_ldlm_regress_start(int argc, char **argv);
 int jt_obd_ldlm_regress_stop(int argc, char **argv);