# suggested boilerplate for test script
LCONF=${LCONF:-../utils/lconf}
-NAME=${NAME:-local2}
+NAME=${NAME:-local2-hack}
config=$NAME.xml
-mkconfig=./$NAME.sh
-if [ ! -f $config -o $mkconfig -nt $config ]; then
- sh $mkconfig $config || exit 1
-fi
-
-${LCONF} -v --reformat --gdb $config || exit 2
+${LCONF} --reformat --gdb $config || exit 2
../utils/lctl <<EOF
newdev
+++ /dev/null
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <time.h>
-#include <errno.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/fsuid.h>
-
-int main(int argc, char ** argv)
-{
- int rc, fsuid;
-
- if (argc < 2) {
- printf("Usage %s fsuid\n", argv[0]);
- return 1;
- }
-
- fsuid = strtoul(argv[2], NULL, 0);
- rc = setfsuid(fsuid);
- if (rc) {
- printf("mknod(%s) error: %s\n", argv[1], strerror(errno));
- }
- return rc;
-}
struct option longOpts[] = {
{"help", 0, 0, 'h'},
{"obd", 1, 0, 'o'},
- {"query", 0, 0, 'o'},
+ {"query", 0, 0, 'q'},
{"verbose", 0, 0, 'v'},
{0, 0, 0, 0}
};
close(fd);
- if (query || verbose)
- printf("\n%s:\n", path);
+ if (query || verbose || lmm->lmm_objects[obdindex].l_object_id)
+ printf("%s\n", path);
if (verbose) {
printf("lmm_magic: 0x%x\n", lmm->lmm_magic);
- printf("lmm_object_id: 0x%llx\n", lmm->lmm_object_id);
+ printf("lmm_object_id: "LPX64"\n", lmm->lmm_object_id);
printf("lmm_stripe_offset: %d\n", lmm->lmm_stripe_offset);
printf("lmm_stripe_count: %d\n", lmm->lmm_stripe_count);
printf("lmm_ost_count: %d\n", lmm->lmm_ost_count);
count = lmm->lmm_ost_count;
if (query || verbose) {
- struct lov_object_id *loi;
- __u64 oid;
-
- loi = lmm->lmm_objects;
-
- printf("obdidx\tobjid\n");
-
- for (i = 0; i < count; i++, loi++)
- if ((oid = loi->l_object_id))
- printf("%6d\t%5lld\n", i, oid);
+ long long oid;
+ int ost = lmm->lmm_stripe_offset;
+ int header = 1;
+
+ for (i = 0; i < count; i++, ost++) {
+ ost %= lmm->lmm_ost_count;
+ if ((oid = lmm->lmm_objects[ost].l_object_id)) {
+ if (header) {
+ printf("\tobdidx\t objid\n");
+ header = 0;
+ }
+ printf("\t%6u\t%8llu%s\n",
+ ost, oid, obdindex == ost ? " *" : "");
+ }
+ }
if (query)
return(0);
}
- if (lmm->lmm_objects[obdindex].l_object_id)
- printf("%s\n", path);
-
return(0);
}
obdcount = desc.ld_tgt_count;
- if (query) {
+ if (query || verbose) {
printf("OBDS:\n");
for (i = 0, uuidp = uuids; i < obdcount; i++, uuidp++)
printf("%4d: %s\n", i, (char *)uuidp);