Whamcloud - gitweb
LU-2886 obdclass: use common way to store lastid
[fs/lustre-release.git] / lustre / include / lustre / lustre_idl.h
index 176b747..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);
 }
 
 /**