Whamcloud - gitweb
LU-2886 obdclass: use common way to store lastid
[fs/lustre-release.git] / lustre / include / lustre / lustre_idl.h
index 6e285bf..086fda1 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);
 }
 
 /**
@@ -1579,19 +1582,19 @@ struct lov_mds_md_v1 {            /* LOV EA mds/wire data (little-endian) */
  *      }
  * to identify the LOV(MDT) object, and lmm_object_seq will
  * be normal_fid, which make it hard to combine these conversion
- * to ostid_to FID. so we will do lmm_oi/fid conversion separately 
+ * to ostid_to FID. so we will do lmm_oi/fid conversion separately
  *
  * We can tell the lmm_oi by this way,
  * 1.8: lmm_object_id = {inode}, lmm_object_gr = 0
  * 2.1: lmm_object_id = {oid < 128k}, lmm_object_seq = FID_SEQ_NORMAL
  * 2.4: lmm_oi.f_seq = FID_SEQ_NORMAL, lmm_oi.f_oid = {oid < 128k},
  *      lmm_oi.f_ver = 0
- * 
+ *
  * But currently lmm_oi/lsm_oi does not have any "real" usages,
  * except for printing some information, and the user can always
  * get the real FID from LMA, besides this multiple case check might
  * make swab more complicate. So we will keep using id/seq for lmm_oi.
- */ 
+ */
 
 static inline void fid_to_lmm_oi(const struct lu_fid *fid,
                                 struct ost_id *oi)
@@ -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);