Whamcloud - gitweb
LU-11971 utils: Send file creation time to clients
[fs/lustre-release.git] / lustre / utils / ll_decode_filter_fid.c
index c8370fb..c1c2b38 100644 (file)
@@ -23,7 +23,7 @@
  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2014, Intel Corporation.
+ * Copyright (c) 2011, 2017, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -87,6 +87,7 @@ int main(int argc, char *argv[])
        for (i = 1; i < argc; i++) {
                char buf[1024]; /* allow xattr that may be larger */
                struct filter_fid *ff = (void *)buf;
+               static int printed;
                int size;
 
                size = getxattr(argv[i], "trusted.fid", buf,
@@ -120,7 +121,8 @@ int main(int argc, char *argv[])
 
                                printf("%s: parent="DFID" stripe=%u "
                                       "stripe_size=%u stripe_count=%u",
-                                      argv[i], loa->loa_parent_fid.f_seq,
+                                      argv[i],
+                                      (unsigned long long)loa->loa_parent_fid.f_seq,
                                       loa->loa_parent_fid.f_oid, 0, /* ver */
                                       loa->loa_parent_fid.f_stripe_idx &
                                                        PFID_STRIPE_COUNT_MASK,
@@ -132,8 +134,8 @@ int main(int argc, char *argv[])
                                               "component_start=%llu "
                                               "component_end=%llu",
                                               loa->loa_comp_id,
-                                              loa->loa_comp_start,
-                                              loa->loa_comp_end);
+                                              (unsigned long long)loa->loa_comp_start,
+                                              (unsigned long long)loa->loa_comp_end);
                                printf("\n");
                                continue;
                        }
@@ -146,16 +148,21 @@ int main(int argc, char *argv[])
                }
 
                if (size != sizeof(struct filter_fid) &&
-                   size != sizeof(struct filter_fid_old) &&
-                   size != sizeof(struct lu_fid)) {
-                       fprintf(stderr, "%s: warning: fid larger than expected"
-                               " (%d bytes), recompile?\n", argv[i], size);
-                       continue;
+                   size != sizeof(struct filter_fid_18_23) &&
+                   size != sizeof(struct filter_fid_24_29) &&
+                   size != sizeof(struct filter_fid_210) && !printed) {
+                       fprintf(stderr,
+                               "%s: warning: ffid size is unexpected (%d bytes), recompile?\n",
+                               argv[i], size);
+                       printed = 1;
+
+                       if (size < sizeof(struct filter_fid_24_29))
+                               continue;
                }
 
                printf("%s: ", argv[i]);
-               if (size == sizeof(struct filter_fid_old)) {
-                       struct filter_fid_old *ffo = (void *)buf;
+               if (size == sizeof(struct filter_fid_18_23)) {
+                       struct filter_fid_18_23 *ffo = (void *)buf;
 
                        printf("objid=%llu seq=%llu ",
                               (unsigned long long)__le64_to_cpu(ffo->ff_objid),
@@ -168,7 +175,7 @@ int main(int argc, char *argv[])
                       /* this is stripe_nr actually */
                       __le32_to_cpu(ff->ff_parent.f_stripe_idx));
 
-               if (size >= sizeof(struct filter_fid)) {
+               if (size >= sizeof(struct filter_fid_210)) {
                        struct ost_layout *ol = &ff->ff_layout;
 
                        /* new filter_fid, support PFL */
@@ -180,9 +187,15 @@ int main(int argc, char *argv[])
                                       "component_start=%llu "
                                       "component_end=%llu",
                                       __le32_to_cpu(ol->ol_comp_id),
+                                      (unsigned long long)
                                       __le64_to_cpu(ol->ol_comp_start),
+                                      (unsigned long long)
                                       __le64_to_cpu(ol->ol_comp_end));
                }
+               if (size >= sizeof(struct filter_fid))
+                       printf(" layout_version=%u range=%u",
+                              __le32_to_cpu(ff->ff_layout_version),
+                              __le32_to_cpu(ff->ff_range));
 
                printf("\n");
        }