Commit 25782b53 authored by Andreas Dilger's avatar Andreas Dilger Committed by Greg Kroah-Hartman

staging: lustre: misc: clean up DFID related error messages

Improve the error messages related to DFID output and parsing
for usage in userspace.
Signed-off-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1606
Reviewed-on: http://review.whamcloud.com/6156Reviewed-by: default avatarFrank Zago <fzago@cray.com>
Reviewed-by: default avatarBen Evans <bevans@cray.com>
Reviewed-by: default avatarJames Simmons <uja.ornl@yahoo.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b6c6539b
...@@ -537,13 +537,14 @@ static inline void ostid_set_id(struct ost_id *oi, __u64 oid) ...@@ -537,13 +537,14 @@ static inline void ostid_set_id(struct ost_id *oi, __u64 oid)
{ {
if (fid_seq_is_mdt0(oi->oi.oi_seq)) { if (fid_seq_is_mdt0(oi->oi.oi_seq)) {
if (oid >= IDIF_MAX_OID) { if (oid >= IDIF_MAX_OID) {
CERROR("Bad %llu to set " DOSTID "\n", oid, POSTID(oi)); CERROR("Too large OID %#llx to set MDT0 " DOSTID "\n",
oid, POSTID(oi));
return; return;
} }
oi->oi.oi_id = oid; oi->oi.oi_id = oid;
} else if (fid_is_idif(&oi->oi_fid)) { } else if (fid_is_idif(&oi->oi_fid)) {
if (oid >= IDIF_MAX_OID) { if (oid >= IDIF_MAX_OID) {
CERROR("Bad %llu to set "DOSTID"\n", CERROR("Too large OID %#llx to set IDIF " DOSTID "\n",
oid, POSTID(oi)); oid, POSTID(oi));
return; return;
} }
...@@ -569,7 +570,7 @@ static inline int fid_set_id(struct lu_fid *fid, __u64 oid) ...@@ -569,7 +570,7 @@ static inline int fid_set_id(struct lu_fid *fid, __u64 oid)
if (fid_is_idif(fid)) { if (fid_is_idif(fid)) {
if (oid >= IDIF_MAX_OID) { if (oid >= IDIF_MAX_OID) {
CERROR("Too large OID %#llx to set IDIF "DFID"\n", CERROR("Too large OID %#llx to set IDIF " DFID "\n",
(unsigned long long)oid, PFID(fid)); (unsigned long long)oid, PFID(fid));
return -EBADF; return -EBADF;
} }
...@@ -578,7 +579,7 @@ static inline int fid_set_id(struct lu_fid *fid, __u64 oid) ...@@ -578,7 +579,7 @@ static inline int fid_set_id(struct lu_fid *fid, __u64 oid)
fid->f_ver = oid >> 48; fid->f_ver = oid >> 48;
} else { } else {
if (oid >= OBIF_MAX_OID) { if (oid >= OBIF_MAX_OID) {
CERROR("Too large OID %#llx to set REG "DFID"\n", CERROR("Too large OID %#llx to set REG " DFID "\n",
(unsigned long long)oid, PFID(fid)); (unsigned long long)oid, PFID(fid));
return -EBADF; return -EBADF;
} }
......
...@@ -528,25 +528,20 @@ static inline void obd_uuid2fsname(char *buf, char *uuid, int buflen) ...@@ -528,25 +528,20 @@ static inline void obd_uuid2fsname(char *buf, char *uuid, int buflen)
} }
/* printf display format /* printf display format
* e.g. printf("file FID is "DFID"\n", PFID(fid)); * * usage: printf("file FID is "DFID"\n", PFID(fid));
*/ */
#define FID_NOBRACE_LEN 40 #define FID_NOBRACE_LEN 40
#define FID_LEN (FID_NOBRACE_LEN + 2) #define FID_LEN (FID_NOBRACE_LEN + 2)
#define DFID_NOBRACE "%#llx:0x%x:0x%x" #define DFID_NOBRACE "%#llx:0x%x:0x%x"
#define DFID "["DFID_NOBRACE"]" #define DFID "["DFID_NOBRACE"]"
#define PFID(fid) \ #define PFID(fid) (unsigned long long)(fid)->f_seq, (fid)->f_oid, (fid)->f_ver
(fid)->f_seq, \
(fid)->f_oid, \
(fid)->f_ver
/* scanf input parse format -- strip '[' first. /* scanf input parse format for fids in DFID_NOBRACE format
* e.g. sscanf(fidstr, SFID, RFID(&fid)); * Need to strip '[' from DFID format first or use "["SFID"]" at caller.
* usage: sscanf(fidstr, SFID, RFID(&fid));
*/ */
#define SFID "0x%llx:0x%x:0x%x" #define SFID "0x%llx:0x%x:0x%x"
#define RFID(fid) \ #define RFID(fid) &((fid)->f_seq), &((fid)->f_oid), &((fid)->f_ver)
&((fid)->f_seq), \
&((fid)->f_oid), \
&((fid)->f_ver)
/********* Quotas **********/ /********* Quotas **********/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment