Whamcloud - gitweb
Merge b_md to HEAD for 0.5.19 release.
[fs/lustre-release.git] / lustre / utils / lfind.c
index 26f6a3f..93777d6 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/lustre_lite.h>
 #include <linux/obd_lov.h>
 
-#warning Max obds per lov currently hardcoded to 1000 in lov/lov_obd.c
+/* XXX Max obds per lov currently hardcoded to 1000 in lov/lov_obd.c */
 #define MAX_LOV_UUID_COUNT     1000
 #define OBD_NOT_FOUND          ((__u32)-1)
 
@@ -128,7 +128,7 @@ init()
        else
                buflen = lmmlen;
 
-#warning max ioctl buffer size currently hardcoded to 8192
+       /* XXX max ioctl buffer size currently hardcoded to 8192 */
        if (buflen > 8192) {
                int nuuids, remaining, nluoinfos;
 
@@ -194,12 +194,12 @@ processFile(const char *path, const struct stat *sp, int flag, struct FTW *ftwp)
        if (flag != FTW_F)
                return 0;
 
-       if ((obdcount == 0) && (getobdindex(path) == OBD_NOT_FOUND)) {
+       if (getobdindex(path) == OBD_NOT_FOUND && obdcount == 0) {
                /* terminate nftw walking this tree */
                return(1);
        }
 
-       if ((fd = open(path, O_RDONLY)) < 0) {
+       if ((fd = open(path, O_RDONLY | O_LOV_DELAY_CREATE)) < 0) {
                errMsg("open \"%.20s\" failed.", path);
                perror("open");
                exit(1);
@@ -212,21 +212,24 @@ processFile(const char *path, const struct stat *sp, int flag, struct FTW *ftwp)
        if ((rc = ioctl(fd, LL_IOC_LOV_GETSTRIPE, (void *)lmm)) < 0) {
                errMsg("LL_IOC_LOV_GETSTRIPE ioctl failed.");
                perror("ioctl");
-               exit(1);
+               return 0;
        }
 
        close(fd);
 
-       if (query || verbose || lmm->lmm_objects[obdindex].l_object_id)
+       if (query || verbose ||
+           (obdindex != OBD_NOT_FOUND &&
+            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:      "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);
-               printf("lmm_stripe_pattern: %d\n", lmm->lmm_stripe_pattern);
+               printf("lmm_stripe_offset:  %u\n", (int)lmm->lmm_stripe_offset);
+               printf("lmm_stripe_count:   %u\n", (int)lmm->lmm_stripe_count);
+               printf("lmm_stripe_size:    %u\n", (int)lmm->lmm_stripe_size);
+               printf("lmm_ost_count:      %u\n", lmm->lmm_ost_count);
+               printf("lmm_stripe_pattern: %d\n", lmm->lmm_magic & 0xf);
        }
 
        count = lmm->lmm_ost_count;