From d2cb789537485eec9bfc5bc7d4c85025b0488478 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Fri, 26 Feb 2021 16:57:28 -0500 Subject: [PATCH] LU-13107 utils: remove lctl lov_getconfig command 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 Reviewed-on: https://review.whamcloud.com/37106 Tested-by: jenkins Reviewed-by: James Simmons Tested-by: Maloo Reviewed-by: Bobi Jam Reviewed-by: Oleg Drokin --- lustre/include/uapi/linux/lustre/lustre_ioctl.h | 3 +- lustre/lov/lov_obd.c | 43 ---------- lustre/tests/sanity.sh | 11 +-- lustre/utils/lctl.c | 5 -- lustre/utils/obd.c | 104 ------------------------ lustre/utils/obdctl.h | 1 - 6 files changed, 5 insertions(+), 162 deletions(-) diff --git a/lustre/include/uapi/linux/lustre/lustre_ioctl.h b/lustre/include/uapi/linux/lustre/lustre_ioctl.h index 43dbf5a..927f585 100644 --- a/lustre/include/uapi/linux/lustre/lustre_ioctl.h +++ b/lustre/include/uapi/linux/lustre/lustre_ioctl.h @@ -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) diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index e8c8301..762e20a 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -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; diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 7d68c91..986228d 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -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))" diff --git a/lustre/utils/lctl.c b/lustre/utils/lctl.c index 830d240..0b09bb1 100644 --- a/lustre/utils/lctl.c +++ b/lustre/utils/lctl.c @@ -556,11 +556,6 @@ command_t cmdlist[] = { "remove one log from catalog or plain log, erase it from disk.\n" "usage: llog_remove [--log_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 "}, /* network operations */ {"add_interface", jt_ptl_add_interface, 0, "add interface entry\n" "usage: add_interface ip [netmask]"}, diff --git a/lustre/utils/obd.c b/lustre/utils/obd.c index d3762de..1ccaaad 100644 --- a/lustre/utils/obd.c +++ b/lustre/utils/obd.c @@ -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; diff --git a/lustre/utils/obdctl.h b/lustre/utils/obdctl.h index 8fbf115..742173a 100644 --- a/lustre/utils/obdctl.h +++ b/lustre/utils/obdctl.h @@ -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); -- 1.8.3.1