Whamcloud - gitweb
LU-3420 scrub: trigger OI scrub properly
[fs/lustre-release.git] / lustre / liblustre / tests / sanity.c
index e652cbb..b5b595c 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright (c) 2013, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -58,7 +58,7 @@
 
 #include <liblustre.h>
 #include "test_common.h"
-#include <lustre/liblustreapi.h>
+#include <lustre/lustreapi.h>
 
 #define _npages (2048)
 
@@ -396,7 +396,7 @@ int t14(char *name)
         char buf[1024];
         const int nfiles = 256;
         char *prefix = "test14_filename_long_prefix_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA___";
-        cfs_dirent_t *ent;
+       struct dirent64 *ent;
         int fd, i, rc, pos, index;
         loff_t base = 0;
         ENTER(">1 block(4k) directory readdir");
@@ -707,8 +707,9 @@ int t21(char *name)
         }
 
         t_fcntl(fd, F_SETFL, O_APPEND);
-        if (!(ret = t_fcntl(fd, F_GETFL)) & O_APPEND) {
-                printf("error get flag: ret %x\n", ret);
+        ret = t_fcntl(fd, F_GETFL);
+        if ((ret & O_APPEND) == 0) {
+                printf("error get flag: ret %o\n", ret);
                 return(-1);
         }
 
@@ -1256,21 +1257,23 @@ int t55(char *name)
         close(fd);
 
         if (opt_verbose) {
-                printf("lmm_magic:          0x%08X\n",  lum->lmm_magic);
-                printf("lmm_object_id:      "LPX64"\n", lum->lmm_object_id);
-                printf("lmm_object_gr:      "LPX64"\n", lum->lmm_object_gr);
-                printf("lmm_stripe_count:   %u\n", (int)lum->lmm_stripe_count);
-                printf("lmm_stripe_size:    %u\n",      lum->lmm_stripe_size);
-                printf("lmm_stripe_pattern: %x\n",      lum->lmm_pattern);
-
-                for (index = 0; index < lum->lmm_stripe_count; index++) {
-                        lo = lum->lmm_objects + index;
-                        printf("object %d:\n", index);
-                        printf("\tobject_gr:    "LPX64"\n", lo->l_object_gr);
-                        printf("\tobject_id:    "LPX64"\n", lo->l_object_id);
-                        printf("\tost_gen:      %#x\n", lo->l_ost_gen);
-                        printf("\tost_idx:      %u\n", lo->l_ost_idx);
-                }
+               printf("lmm_magic:          0x%08X\n",  lum->lmm_magic);
+               printf("lmm_object_id:      "LPX64"\n",
+                                               lmm_oi_id(&lum->lmm_oi));
+               printf("lmm_object_seq:     "LPX64"\n",
+                                               lmm_oi_seq(&lum->lmm_oi));
+               printf("lmm_stripe_count:   %u\n", (int)lum->lmm_stripe_count);
+               printf("lmm_stripe_size:    %u\n",      lum->lmm_stripe_size);
+               printf("lmm_stripe_pattern: %x\n",      lum->lmm_pattern);
+
+               for (index = 0; index < lum->lmm_stripe_count; index++) {
+                       lo = lum->lmm_objects + index;
+                       printf("object %d:\n", index);
+                       printf("\tobject_oid:   "DOSTID"\n",
+                              POSTID(&lo->l_ost_oi));
+                       printf("\tost_gen:      %#x\n", lo->l_ost_gen);
+                       printf("\tost_idx:      %u\n", lo->l_ost_idx);
+               }
         }
 
         if (lum->lmm_magic != LOV_USER_MAGIC ||
@@ -1321,22 +1324,24 @@ int t55(char *name)
         }
         close(fd);
 
-        if (opt_verbose) {
-                printf("lmm_magic:          0x%08X\n",  lum->lmm_magic);
-                printf("lmm_object_id:      "LPX64"\n", lum->lmm_object_id);
-                printf("lmm_object_gr:      "LPX64"\n", lum->lmm_object_gr);
-                printf("lmm_stripe_count:   %u\n", (int)lum->lmm_stripe_count);
-                printf("lmm_stripe_size:    %u\n",      lum->lmm_stripe_size);
-                printf("lmm_stripe_pattern: %x\n",      lum->lmm_pattern);
-
-                for (index = 0; index < lum->lmm_stripe_count; index++) {
-                        lo = lum->lmm_objects + index;
-                        printf("object %d:\n", index);
-                        printf("\tobject_gr:    "LPX64"\n", lo->l_object_gr);
-                        printf("\tobject_id:    "LPX64"\n", lo->l_object_id);
-                        printf("\tost_gen:      %#x\n", lo->l_ost_gen);
-                        printf("\tost_idx:      %u\n", lo->l_ost_idx);
-                }
+       if (opt_verbose) {
+               printf("lmm_magic:          0x%08X\n",  lum->lmm_magic);
+               printf("lmm_object_id:      "LPX64"\n",
+                                               lmm_oi_id(&lum->lmm_oi));
+               printf("lmm_object_seq:     "LPX64"\n",
+                                               lmm_oi_seq(&lum->lmm_oi));
+               printf("lmm_stripe_count:   %u\n", (int)lum->lmm_stripe_count);
+               printf("lmm_stripe_size:    %u\n",      lum->lmm_stripe_size);
+               printf("lmm_stripe_pattern: %x\n",      lum->lmm_pattern);
+
+               for (index = 0; index < lum->lmm_stripe_count; index++) {
+                       lo = lum->lmm_objects + index;
+                       printf("object %d:\n", index);
+                       printf("\tobject_oid:   "DOSTID"\n",
+                              POSTID(&lo->l_ost_oi));
+                       printf("\tost_gen:      %#x\n", lo->l_ost_gen);
+                       printf("\tost_idx:      %u\n", lo->l_ost_idx);
+               }
         }
 
         if (lum->lmm_magic != LOV_USER_MAGIC ||
@@ -1364,11 +1369,11 @@ int t55(char *name)
  */
 int t56(char *name)
 {
-        int fd;
-        size_t nbytes;
-        off_t basep = 0;
-        long rc = 0;
-        cfs_dirent_t dir;
+       int fd;
+       size_t nbytes;
+       off_t basep = 0;
+       long rc = 0;
+       struct dirent64 dir;
 
         ENTER("getdirentries should fail if nbytes is too small");