From: John L. Hammond Date: Tue, 3 Jun 2014 07:04:51 +0000 (-0500) Subject: LU-4587 utils: remove llapi_ping_target() X-Git-Tag: 2.6.0-RC1~90 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=122aaddbf14fd89aa86b0595774695fb96d661e7 LU-4587 utils: remove llapi_ping_target() Remove llapi_ping_target(). This ioctl() based function was prototyped in lustreapi.h but not provided by lustreapi. Replace its only use (in lfs) with the equivalent /proc based function llapi_target_check(), which is provided by lustreapi. Remove the now unnecessary calls to ptl_initialize(), obd_initialize() and obd_finalize() in lfs main(). Signed-off-by: John L. Hammond Change-Id: I02d7ea706f02827bbd4bd1b9bf0d216b0e2c131b Reviewed-on: http://review.whamcloud.com/10566 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Emoly Liu Reviewed-by: Yang Sheng Reviewed-by: Andreas Dilger Reviewed-by: James Simmons --- diff --git a/lustre/include/lustre/lustreapi.h b/lustre/include/lustre/lustreapi.h index ce17f58..54b9d1c 100644 --- a/lustre/include/lustre/lustreapi.h +++ b/lustre/include/lustre/lustreapi.h @@ -248,9 +248,6 @@ extern int llapi_search_mounts(const char *pathname, int index, extern int llapi_search_fsname(const char *pathname, char *fsname); extern int llapi_getname(const char *path, char *buf, size_t size); -extern void llapi_ping_target(char *obd_type, char *obd_name, - char *obd_uuid, void *args); - extern int llapi_search_rootpath(char *pathname, const char *fsname); extern int llapi_nodemap_exists(const char *name); extern int llapi_mv(char *path, struct find_param *param); diff --git a/lustre/utils/Makefile.am b/lustre/utils/Makefile.am index 67144f8..f737ddb 100644 --- a/lustre/utils/Makefile.am +++ b/lustre/utils/Makefile.am @@ -11,9 +11,11 @@ AM_LDFLAGS := -L$(top_builddir)/lnet/utils MNTMODLDFLAGS := -rdynamic -ldl MNTMODCFLAGS := -DPLUGIN_DIR=\"${pkglibdir}\" +LIBCFSUTIL := $(top_builddir)/libcfs/libcfs/libcfsutil.a + LIBPTLCTL := $(top_builddir)/lnet/utils/libptlctl.a \ - $(top_builddir)/libcfs/libcfs/libcfsutil.a \ - $(top_builddir)/libcfs/libcfs/libcfs.a + $(top_builddir)/libcfs/libcfs/libcfs.a \ + $(LIBCFSUTIL) sbin_scripts = lrun bin_scripts = llstat llobdstat plot-llstat llbackup @@ -48,9 +50,9 @@ lctl_SOURCES = lustre_lfsck.c obd.c lustre_cfg.c lctl.c obdctl.h lctl_LDADD := liblustreapi.a $(LIBPTLCTL) $(PTHREAD_LIBS) $(LIBREADLINE) lctl_DEPENDENCIES := $(LIBPTLCTL) liblustreapi.a -lfs_SOURCES = lfs.c obd.c lustre_cfg.c -lfs_LDADD := liblustreapi.a $(LIBPTLCTL) $(PTHREAD_LIBS) $(LIBREADLINE) -lfs_DEPENDENCIES := $(LIBPTLCTL) liblustreapi.a +lfs_SOURCES = lfs.c +lfs_LDADD := liblustreapi.a $(LIBCFSUTIL) $(LIBREADLINE) +lfs_DEPENDENCIES := liblustreapi.a loadgen_SOURCES = loadgen.c lustre_cfg.c obd.c loadgen_LDADD := liblustreapi.a $(LIBPTLCTL) $(PTHREAD_LIBS) $(LIBREADLINE) diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index daba1eb..c34f9ba 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -67,10 +67,8 @@ #include #include -#include #include #include -#include "obdctl.h" /* all functions */ static int lfs_setstripe(int argc, char **argv); @@ -2029,9 +2027,7 @@ static int lfs_check(int argc, char **argv) return rc; } - rc = llapi_target_iterate(num_types, obd_types, - mntdir, llapi_ping_target); - + rc = llapi_target_check(num_types, obd_types, mntdir); if (rc) fprintf(stderr, "error: %s: %s status failed\n", argv[0],argv[1]); @@ -3849,10 +3845,6 @@ int main(int argc, char **argv) setlinebuf(stdout); - ptl_initialize(argc, argv); - if (obd_initialize(argc, argv) < 0) - exit(2); - Parser_init("lfs > ", cmdlist); if (argc > 1) { @@ -3861,7 +3853,6 @@ int main(int argc, char **argv) rc = Parser_commands(); } - obd_finalize(argc, argv); return rc < 0 ? -rc : rc; } diff --git a/lustre/utils/obd.c b/lustre/utils/obd.c index 75a4422..dcc263f 100644 --- a/lustre/utils/obd.c +++ b/lustre/utils/obd.c @@ -4241,35 +4241,6 @@ int jt_get_obj_version(int argc, char **argv) return 0; } -void llapi_ping_target(char *obd_type, char *obd_name, - char *obd_uuid, void *args) -{ - int rc; - struct obd_ioctl_data data; - char rawbuf[MAX_IOC_BUFLEN], *buf = rawbuf; - - memset(&data, 0, sizeof(data)); - data.ioc_inlbuf4 = obd_name; - data.ioc_inllen4 = strlen(obd_name) + 1; - data.ioc_dev = OBD_DEV_BY_DEVNAME; - memset(buf, 0, sizeof(rawbuf)); - if (obd_ioctl_pack(&data, &buf, sizeof(rawbuf))) { - fprintf(stderr, "error: invalid ioctl\n"); - return; - } - rc = l_ioctl(OBD_DEV_ID, OBD_IOC_PING_TARGET, buf); - if (rc) - rc = errno; - if (rc == ENOTCONN || rc == ESHUTDOWN) { - printf("%s: INACTIVE\n", obd_name); - } else if (rc) { - printf("%s: check error: %s\n", - obd_name, strerror(errno)); - } else { - printf("%s: active\n", obd_name); - } -} - int jt_changelog_register(int argc, char **argv) { char rawbuf[MAX_IOC_BUFLEN], *buf = rawbuf;