Whamcloud - gitweb
LU-3867 utils: llapi_create_volatile_idx uses 0 instead idx 13/7613/4
authorJames Nunez <james.a.nunez@intel.com>
Fri, 1 Nov 2013 18:18:05 +0000 (12:18 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 2 Dec 2013 12:55:54 +0000 (12:55 +0000)
If llapi_create_volatile_idx() is passed an MDT index other than
-1, it always uses 0 as the MDT index rather than the one provided.

This patch removes the use of LUSTRE_VOLATILE_IDX and uses
LUSTRE_VOLATILE_HDR with the MDT index instead, uses the provided
MDT index in the volatile file name and uses base 16 when reading
the MDT index from the file name using strtoul.

Signed-off-by: James Nunez <james.a.nunez@intel.com>
Signed-off-by: Bobbie Lind <bobbie.j.lind@intel.com>
Change-Id: I27e2beb8524683aba07c48297614dd02d7957af4
Reviewed-on: http://review.whamcloud.com/7613
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/include/lustre/lustre_user.h
lustre/include/obd.h
lustre/utils/liblustreapi.c

index 9ed47bc..cca3216 100644 (file)
@@ -598,8 +598,6 @@ enum {
  */
 #define LUSTRE_VOLATILE_HDR    ".\x0c\x13\x14\x12:VOLATILE"
 #define LUSTRE_VOLATILE_HDR_LEN        14
-/* hdr + MDT index */
-#define LUSTRE_VOLATILE_IDX    LUSTRE_VOLATILE_HDR":%.4X:"
 
 typedef enum lustre_quota_version {
         LUSTRE_QUOTA_V2 = 1
index fd9363e..13c6cd7 100644 (file)
@@ -1590,7 +1590,7 @@ static inline bool filename_is_volatile(const char *name, int namelen, int *idx)
        }
        /* we have an idx, read it */
        start = name + LUSTRE_VOLATILE_HDR_LEN + 1;
-       *idx = strtoul(start, &end, 0);
+       *idx = strtoul(start, &end, 16);
        /* error cases:
         * no digit, no trailing :, negative value
         */
index 843574f..461af1e 100644 (file)
@@ -4322,7 +4322,7 @@ int llapi_create_volatile_idx(char *directory, int idx, int mode)
                         LUSTRE_VOLATILE_HDR"::%.4X", random);
        else
                snprintf(filename, sizeof(filename),
-                        LUSTRE_VOLATILE_IDX"%.4X", 0, random);
+                        LUSTRE_VOLATILE_HDR":%.4X:%.4X", idx, random);
 
        rc = snprintf(file_path, sizeof(file_path),
                      "%s/%s", directory, filename);