From 6f06e35bbca056c987db43db9ae239a5056a6b5c Mon Sep 17 00:00:00 2001 From: girish Date: Thu, 2 Jul 2009 10:03:27 +0000 Subject: [PATCH] b=18442 back out patch due to bug 20042 --- lustre/include/lustre/liblustreapi.h | 8 --- lustre/tests/Makefile.am | 2 + lustre/tests/sanity.sh | 7 ++- lustre/utils/lfs.c | 25 +------- lustre/utils/liblustreapi.c | 118 +++++++++++++---------------------- 5 files changed, 54 insertions(+), 106 deletions(-) diff --git a/lustre/include/lustre/liblustreapi.h b/lustre/include/lustre/liblustreapi.h index 2230935..0c88b120 100644 --- a/lustre/include/lustre/liblustreapi.h +++ b/lustre/include/lustre/liblustreapi.h @@ -86,14 +86,6 @@ extern int llapi_file_get_stripe(const char *path, struct lov_user_md *lum); #define HAVE_LLAPI_FILE_LOOKUP extern int llapi_file_lookup(int dirfd, const char *name); -#define VERBOSE_COUNT 0x1 -#define VERBOSE_SIZE 0x2 -#define VERBOSE_OFFSET 0x4 -#define VERBOSE_POOL 0x8 -#define VERBOSE_DETAIL 0x10 -#define VERBOSE_ALL (VERBOSE_COUNT | VERBOSE_SIZE | VERBOSE_OFFSET | \ - VERBOSE_POOL) - struct find_param { unsigned int maxdepth; time_t atime; diff --git a/lustre/tests/Makefile.am b/lustre/tests/Makefile.am index 9cb34f2..4529a8c 100644 --- a/lustre/tests/Makefile.am +++ b/lustre/tests/Makefile.am @@ -45,6 +45,7 @@ noinst_PROGRAMS += small_write multiop ll_sparseness_verify noinst_PROGRAMS += ll_sparseness_write mrename ll_dirstripe_verify mkdirmany noinst_PROGRAMS += openfilleddirunlink rename_many memhog iopentest1 iopentest2 noinst_PROGRAMS += mmap_sanity flock_test writemany reads flocks_test +noinst_PROGRAMS += ll_getstripe_info # noinst_PROGRAMS += copy_attr mkdirdeep bin_PROGRAMS = mcreate munlink testdir = $(libdir)/lustre/tests @@ -58,6 +59,7 @@ endif # TESTS mmap_sanity_SOURCES= mmap_sanity.c LIBLUSTREAPI := $(top_builddir)/lustre/utils/liblustreapi.a +ll_getstripe_info_LDADD=$(LIBLUSTREAPI) multiop_LDADD=$(LIBLUSTREAPI) -lrt ll_dirstripe_verify_SOURCES= ll_dirstripe_verify.c diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 2caf491..bcf6b06 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -35,6 +35,7 @@ SETSTRIPE=${SETSTRIPE:-"$LFS setstripe"} GETSTRIPE=${GETSTRIPE:-"$LFS getstripe"} LFIND=${LFIND:-"$LFS find"} LVERIFY=${LVERIFY:-ll_dirstripe_verify} +LSTRIPEINFO=${LSTRIPEINFO:-ll_getstripe_info} LCTL=${LCTL:-lctl} MCREATE=${MCREATE:-mcreate} OPENFILE=${OPENFILE:-openfile} @@ -1133,7 +1134,7 @@ run_test 27v "skip object creation on slow OST =================" test_27w() { # bug 10997 mkdir -p $DIR/d27w || error "mkdir failed" $SETSTRIPE $DIR/d27w/f0 -s 65536 || error "lstripe failed" - size=`$GETSTRIPE $DIR/d27w/f0 -qs` + size=`$LSTRIPEINFO $DIR/d27w/f0 | awk {'print $1'}` [ $size -ne 65536 ] && error "stripe size $size != 65536" || true [ "$OSTCOUNT" -lt "2" ] && skip "skipping multiple stripe count/offset test" && return @@ -1141,8 +1142,8 @@ test_27w() { # bug 10997 offset=$(($i-1)) log setstripe $DIR/d27w/f$i -c $i -i $offset $SETSTRIPE $DIR/d27w/f$i -c $i -i $offset || error "lstripe -c $i -i $offset failed" - count=`$GETSTRIPE -qc $DIR/d27w/f$i` - index=`$GETSTRIPE -qo $DIR/d27w/f$i` + count=`$LSTRIPEINFO $DIR/d27w/f$i | awk {'print $2'}` + index=`$LSTRIPEINFO $DIR/d27w/f$i | awk {'print $3'}` [ $count -ne $i ] && error "stripe count $count != $i" || true [ $index -ne $offset ] && error "stripe offset $index != $offset" || true done diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index 85017bf..e288707 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -119,8 +119,6 @@ command_t cmdlist[] = { "To list the striping info for a given file or files in a\n" "directory or recursively for all files in a directory tree.\n" "usage: getstripe [--obd|-O ] [--quiet | -q] [--verbose | -v]\n" - " [--count | -c ] [--size | -s ] [--index | -i ]\n" - " [--offset | -o ] [--pool | -p ]\n" " [--recursive | -r] ..."}, {"pool_list", lfs_poollist, 0, "List pools or pool OSTs\n" @@ -784,15 +782,10 @@ static int lfs_getstripe(int argc, char **argv) {"obd", 1, 0, 'O'}, {"quiet", 0, 0, 'q'}, {"recursive", 0, 0, 'r'}, - {"count", 0, 0, 'c'}, - {"size", 0, 0, 's'}, - {"index", 0, 0, 'i'}, - {"offset", 0, 0, 'o'}, - {"pool", 0, 0, 'p'}, {"verbose", 0, 0, 'v'}, {0, 0, 0, 0} }; - char short_opts[] = "hO:qrvcsiop"; + char short_opts[] = "hO:qrv"; int c, rc; struct find_param param = { 0 }; @@ -811,27 +804,15 @@ static int lfs_getstripe(int argc, char **argv) break; case 'q': param.quiet++; + param.verbose = 0; break; case 'r': param.recursive = 1; break; case 'v': - param.verbose = VERBOSE_ALL | VERBOSE_DETAIL; + param.verbose++; param.quiet = 0; break; - case 'c': - param.verbose |= VERBOSE_COUNT; - break; - case 's': - param.verbose |= VERBOSE_SIZE; - break; - case 'i': - case 'o': - param.verbose |= VERBOSE_OFFSET; - break; - case 'p': - param.verbose |= VERBOSE_POOL; - break; case '?': return CMD_HELP; default: diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index 4081a5e..764b59a 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -788,61 +788,6 @@ retry_get_uuids: return 0; } -static void lov_dump_user_lmm_header(struct lov_user_md *lum, char *path, - int is_dir, int verbose, int quiet, - char *pool_name) -{ - char *prefix = is_dir ? "" : "lmm_"; - char nl = is_dir ? ' ' : '\n'; - - if (verbose && path) - llapi_printf(LLAPI_MSG_NORMAL, "%s\n", path); - - if ((verbose & VERBOSE_DETAIL) && !is_dir) { - llapi_printf(LLAPI_MSG_NORMAL, "lmm_magic: 0x%08X\n", - lum->lmm_magic); - llapi_printf(LLAPI_MSG_NORMAL, "lmm_object_gr: "LPX64"\n", - lum->lmm_object_gr); - llapi_printf(LLAPI_MSG_NORMAL, "lmm_object_id: "LPX64"\n", - lum->lmm_object_id); - } - - if (verbose & VERBOSE_COUNT) { - if (!quiet) - llapi_printf(LLAPI_MSG_NORMAL, "%sstripe_count: ", - prefix); - llapi_printf(LLAPI_MSG_NORMAL, "%u%c", - (int)lum->lmm_stripe_count, nl); - } - - if (verbose & VERBOSE_SIZE) { - if (!quiet) - llapi_printf(LLAPI_MSG_NORMAL, "%sstripe_size: ", - prefix); - llapi_printf(LLAPI_MSG_NORMAL, "%u%c", lum->lmm_stripe_size, - nl); - } - - if ((verbose & VERBOSE_DETAIL) && !is_dir) { - llapi_printf(LLAPI_MSG_NORMAL, "lmm_stripe_pattern: %x%c", - lum->lmm_pattern, nl); - } - - if (verbose & VERBOSE_OFFSET) { - if (!quiet) - llapi_printf(LLAPI_MSG_NORMAL, "%sstripe_offset: ", - prefix); - llapi_printf(LLAPI_MSG_NORMAL, "%u%c", - lum->lmm_objects[0].l_ost_idx, nl); - } - - if ((verbose & VERBOSE_POOL) && (pool_name != NULL)) - llapi_printf(LLAPI_MSG_NORMAL, "pool: %s%c", pool_name, nl); - - if (is_dir) - llapi_printf(LLAPI_MSG_NORMAL, "\n"); -} - static void lov_dump_user_lmm_join(struct lov_user_md_v1 *lum, char *path, int is_dir, int obdindex, int quiet, int header, int body) @@ -858,20 +803,29 @@ static void lov_dump_user_lmm_join(struct lov_user_md_v1 *lum, char *path, break; } } - } else { - if (!quiet) - llapi_printf(LLAPI_MSG_NORMAL, "%s\n", path); + } else if (!quiet) { + llapi_printf(LLAPI_MSG_NORMAL, "%s\n", path); obdstripe = 1; } if (header && obdstripe == 1) { - lov_dump_user_lmm_header(lum, NULL, 0, header, quiet, NULL); - + llapi_printf(LLAPI_MSG_NORMAL, "lmm_magic: 0x%08X\n", + lumj->lmm_magic); + llapi_printf(LLAPI_MSG_NORMAL, "lmm_object_gr: "LPX64"\n", + lumj->lmm_object_gr); + llapi_printf(LLAPI_MSG_NORMAL, "lmm_object_id: "LPX64"\n", + lumj->lmm_object_id); + llapi_printf(LLAPI_MSG_NORMAL, "lmm_stripe_count: %u\n", + (int)lumj->lmm_stripe_count); + llapi_printf(LLAPI_MSG_NORMAL, "lmm_stripe_size: %u\n", + lumj->lmm_stripe_size); + llapi_printf(LLAPI_MSG_NORMAL, "lmm_stripe_pattern: %x\n", + lumj->lmm_pattern); llapi_printf(LLAPI_MSG_NORMAL, "lmm_extent_count: %x\n", lumj->lmm_extent_count); } - if (body && !(header && VERBOSE_ALL)) { + if (body) { unsigned long long start = -1, end = 0; if (!quiet && obdstripe == 1) llapi_printf(LLAPI_MSG_NORMAL, @@ -922,9 +876,8 @@ static void lov_dump_user_lmm_v1v3(struct lov_user_md *lum, char *pool_name, break; } } - } else { - if (!quiet) - llapi_printf(LLAPI_MSG_NORMAL, "%s\n", path); + } else if (!quiet) { + llapi_printf(LLAPI_MSG_NORMAL, "%s\n", path); obdstripe = 1; } @@ -935,20 +888,39 @@ static void lov_dump_user_lmm_v1v3(struct lov_user_md *lum, char *pool_name, llapi_printf(LLAPI_MSG_NORMAL, "(Default) "); lum->lmm_object_gr = LOV_OBJECT_GROUP_CLEAR; } - /* maintain original behavior */ - if (!header) - header |= VERBOSE_ALL; - lov_dump_user_lmm_header(lum, path, is_dir, header, - quiet, pool_name); + llapi_printf(LLAPI_MSG_NORMAL, + "stripe_count: %d stripe_size: %u " + "stripe_offset: %d%s%s\n", + lum->lmm_stripe_count == (__u16)-1 ? -1 : + lum->lmm_stripe_count, + lum->lmm_stripe_size, + lum->lmm_stripe_offset == (__u16)-1 ? -1 : + lum->lmm_stripe_offset, + pool_name != NULL ? " pool: " : "", + pool_name != NULL ? pool_name : ""); } return; } - if (header && (obdstripe == 1)) - lov_dump_user_lmm_header(lum, NULL, is_dir, header, quiet, - pool_name); + if (header && (obdstripe == 1)) { + llapi_printf(LLAPI_MSG_NORMAL, "lmm_magic: 0x%08X\n", + lum->lmm_magic); + llapi_printf(LLAPI_MSG_NORMAL, "lmm_object_gr: "LPX64"\n", + lum->lmm_object_gr); + llapi_printf(LLAPI_MSG_NORMAL, "lmm_object_id: "LPX64"\n", + lum->lmm_object_id); + llapi_printf(LLAPI_MSG_NORMAL, "lmm_stripe_count: %u\n", + lum->lmm_stripe_count); + llapi_printf(LLAPI_MSG_NORMAL, "lmm_stripe_size: %u\n", + lum->lmm_stripe_size); + llapi_printf(LLAPI_MSG_NORMAL, "lmm_stripe_pattern: %x\n", + lum->lmm_pattern); + if (pool_name != NULL) + llapi_printf(LLAPI_MSG_NORMAL, + "lmm_pool_name: %s\n", pool_name); + } - if (body && !(header && VERBOSE_ALL)) { + if (body) { if ((!quiet) && (obdstripe == 1)) llapi_printf(LLAPI_MSG_NORMAL, "\tobdidx\t\t objid\t\tobjid\t\t group\n"); -- 1.8.3.1