Whamcloud - gitweb
LU-3302 llog: Do not use ostid swab for llogid
[fs/lustre-release.git] / lustre / include / lustre / lustre_idl.h
index 0704f12..efcca73 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2012, Intel Corporation.
+ * Copyright (c) 2011, 2013, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -383,6 +383,8 @@ extern void lustre_hsm_swab(struct hsm_attrs *attrs);
  * fid constants
  */
 enum {
+       /** LASTID file has zero OID */
+       LUSTRE_FID_LASTID_OID = 0UL,
         /** initial fid id value */
         LUSTRE_FID_INIT_OID  = 1UL
 };
@@ -425,10 +427,11 @@ static inline obd_id fid_ver_oid(const struct lu_fid *fid)
  */
 enum fid_seq {
        FID_SEQ_OST_MDT0        = 0,
-       FID_SEQ_LLOG            = 1,
+       FID_SEQ_LLOG            = 1, /* unnamed llogs */
        FID_SEQ_ECHO            = 2,
        FID_SEQ_OST_MDT1        = 3,
        FID_SEQ_OST_MAX         = 9, /* Max MDT count before OST_on_FID */
+       FID_SEQ_LLOG_NAME       = 10, /* named llogs */
        FID_SEQ_RSVD            = 11,
        FID_SEQ_IGIF            = 12,
        FID_SEQ_IGIF_MAX        = 0x0ffffffffULL,
@@ -500,7 +503,8 @@ static inline int fid_seq_is_llog(obd_seq seq)
 
 static inline int fid_is_llog(const struct lu_fid *fid)
 {
-       return fid_seq_is_llog(fid_seq(fid));
+       /* file with OID == 0 is not llog but contains last oid */
+       return fid_seq_is_llog(fid_seq(fid)) && fid_oid(fid) > 0;
 }
 
 static inline int fid_seq_is_rsvd(const __u64 seq)
@@ -783,8 +787,7 @@ static inline int fid_to_ostid(const struct lu_fid *fid, struct ost_id *ostid)
 /* Check whether the fid is for LAST_ID */
 static inline int fid_is_last_id(const struct lu_fid *fid)
 {
-       return (fid_is_idif(fid) || fid_is_norm(fid) || fid_is_echo(fid)) &&
-               fid_oid(fid) == 0;
+       return (fid_oid(fid) == 0);
 }
 
 /**
@@ -2542,29 +2545,29 @@ struct mdt_rec_setxattr {
  * rr_padding_x fields, then update lustre_swab_mdt_rec_reint() also.
  */
 struct mdt_rec_reint {
-        __u32           rr_opcode;
-        __u32           rr_cap;
-        __u32           rr_fsuid;
-        __u32           rr_fsuid_h;
-        __u32           rr_fsgid;
-        __u32           rr_fsgid_h;
-        __u32           rr_suppgid1;
-        __u32           rr_suppgid1_h;
-        __u32           rr_suppgid2;
-        __u32           rr_suppgid2_h;
-        struct lu_fid   rr_fid1;
-        struct lu_fid   rr_fid2;
-        obd_time        rr_mtime;
-        obd_time        rr_atime;
-        obd_time        rr_ctime;
-        __u64           rr_size;
-        __u64           rr_blocks;
-        __u32           rr_bias;
-        __u32           rr_mode;
-        __u32           rr_flags;
-        __u32           rr_padding_2; /* also fix lustre_swab_mdt_rec_reint */
-        __u32           rr_padding_3; /* also fix lustre_swab_mdt_rec_reint */
-        __u32           rr_padding_4; /* also fix lustre_swab_mdt_rec_reint */
+       __u32           rr_opcode;
+       __u32           rr_cap;
+       __u32           rr_fsuid;
+       __u32           rr_fsuid_h;
+       __u32           rr_fsgid;
+       __u32           rr_fsgid_h;
+       __u32           rr_suppgid1;
+       __u32           rr_suppgid1_h;
+       __u32           rr_suppgid2;
+       __u32           rr_suppgid2_h;
+       struct lu_fid   rr_fid1;
+       struct lu_fid   rr_fid2;
+       obd_time        rr_mtime;
+       obd_time        rr_atime;
+       obd_time        rr_ctime;
+       __u64           rr_size;
+       __u64           rr_blocks;
+       __u32           rr_bias;
+       __u32           rr_mode;
+       __u32           rr_flags;
+       __u32           rr_flags_h;
+       __u32           rr_umask;
+       __u32           rr_padding_4; /* also fix lustre_swab_mdt_rec_reint */
 };
 
 extern void lustre_swab_mdt_rec_reint(struct mdt_rec_reint *rr);
@@ -3271,6 +3274,7 @@ extern void lustre_swab_llogd_body (struct llogd_body *d);
 extern void lustre_swab_llog_hdr (struct llog_log_hdr *h);
 extern void lustre_swab_llogd_conn_body (struct llogd_conn_body *d);
 extern void lustre_swab_llog_rec(struct llog_rec_hdr *rec);
+extern void lustre_swab_llog_id(struct llog_logid *lid);
 
 struct lustre_cfg;
 extern void lustre_swab_lustre_cfg(struct lustre_cfg *lcfg);