From: James Nunez Date: Fri, 1 Nov 2013 18:18:05 +0000 (-0600) Subject: LU-3867 utils: llapi_create_volatile_idx uses 0 instead idx X-Git-Tag: 2.5.52~17 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=d5a07cd08ad07fe0de0c5bda2b3b65c36461f601 LU-3867 utils: llapi_create_volatile_idx uses 0 instead idx 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 Signed-off-by: Bobbie Lind Change-Id: I27e2beb8524683aba07c48297614dd02d7957af4 Reviewed-on: http://review.whamcloud.com/7613 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: Andreas Dilger --- diff --git a/lustre/include/lustre/lustre_user.h b/lustre/include/lustre/lustre_user.h index 9ed47bc..cca3216 100644 --- a/lustre/include/lustre/lustre_user.h +++ b/lustre/include/lustre/lustre_user.h @@ -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 diff --git a/lustre/include/obd.h b/lustre/include/obd.h index fd9363e..13c6cd7 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -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 */ diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index 843574f..461af1e 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -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);