Whamcloud - gitweb
LU-1445 fid: Add DATA fid type in fid_request.
[fs/lustre-release.git] / lustre / include / lustre / lustre_idl.h
index 7807e79..6dc2a5b 100644 (file)
@@ -455,16 +455,30 @@ static inline int fid_seq_is_mdt0(obd_seq seq)
         return (seq == FID_SEQ_OST_MDT0);
 }
 
-static inline int fid_seq_is_cmd(const __u64 seq)
+static inline int fid_seq_is_mdt(const __u64 seq)
 {
-        return (seq >= FID_SEQ_OST_MDT1 && seq <= FID_SEQ_OST_MAX);
+       return seq == FID_SEQ_OST_MDT0 || seq >= FID_SEQ_NORMAL;
 };
 
-static inline int fid_seq_is_mdt(const __u64 seq)
+static inline int fid_seq_is_echo(obd_seq seq)
 {
-        return seq == FID_SEQ_OST_MDT0 ||
-               (seq >= FID_SEQ_OST_MDT1 && seq <= FID_SEQ_OST_MAX);
-};
+       return (seq == FID_SEQ_ECHO);
+}
+
+static inline int fid_is_echo(const struct lu_fid *fid)
+{
+       return fid_seq_is_echo(fid_seq(fid));
+}
+
+static inline int fid_seq_is_llog(obd_seq seq)
+{
+       return (seq == FID_SEQ_LLOG);
+}
+
+static inline int fid_is_llog(const struct lu_fid *fid)
+{
+       return fid_seq_is_llog(fid_seq(fid));
+}
 
 static inline int fid_seq_is_rsvd(const __u64 seq)
 {
@@ -679,6 +693,13 @@ static inline obd_id ostid_id(struct ost_id *ostid)
         return ostid->oi_id;
 }
 
+/* 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;
+}
+
 /**
  * Get inode number from a igif.
  * \param fid a igif to get inode number from.
@@ -768,11 +789,10 @@ static inline void fid_be_to_cpu(struct lu_fid *dst, const struct lu_fid *src)
 
 static inline int fid_is_sane(const struct lu_fid *fid)
 {
-        return
-                fid != NULL &&
-                ((fid_seq(fid) >= FID_SEQ_START && fid_oid(fid) != 0
-                                                && fid_ver(fid) == 0) ||
-                fid_is_igif(fid) || fid_seq_is_rsvd(fid_seq(fid)));
+       return fid != NULL &&
+              ((fid_seq(fid) >= FID_SEQ_START && fid_ver(fid) == 0) ||
+              fid_is_igif(fid) || fid_is_idif(fid) ||
+              fid_seq_is_rsvd(fid_seq(fid)));
 }
 
 static inline int fid_is_zero(const struct lu_fid *fid)
@@ -1210,7 +1230,7 @@ extern void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb);
                                OBD_CONNECT_64BITHASH | OBD_CONNECT_JOBSTATS | \
                                OBD_CONNECT_EINPROGRESS | \
                                OBD_CONNECT_LIGHTWEIGHT | OBD_CONNECT_UMASK | \
-                               OBD_CONNECT_LVB_TYPE)
+                               OBD_CONNECT_LVB_TYPE | OBD_CONNECT_LAYOUTLOCK)
 #define OST_CONNECT_SUPPORTED  (OBD_CONNECT_SRVLOCK | OBD_CONNECT_GRANT | \
                                 OBD_CONNECT_REQPORTAL | OBD_CONNECT_VERSION | \
                                 OBD_CONNECT_TRUNCLOCK | OBD_CONNECT_INDEX | \
@@ -1225,7 +1245,8 @@ extern void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb);
                                 OBD_CONNECT_MAX_EASIZE | \
                                OBD_CONNECT_EINPROGRESS | \
                                OBD_CONNECT_JOBSTATS | \
-                               OBD_CONNECT_LIGHTWEIGHT | OBD_CONNECT_LVB_TYPE)
+                               OBD_CONNECT_LIGHTWEIGHT | OBD_CONNECT_LVB_TYPE|\
+                               OBD_CONNECT_LAYOUTLOCK)
 #define ECHO_CONNECT_SUPPORTED (0)
 #define MGS_CONNECT_SUPPORTED  (OBD_CONNECT_VERSION | OBD_CONNECT_AT | \
                                OBD_CONNECT_FULL20 | OBD_CONNECT_IMP_RECOV | \
@@ -1868,10 +1889,7 @@ extern void lustre_swab_generic_32s (__u32 *val);
 #define MDS_INODELOCK_OPEN   0x000004       /* For opened files */
 #define MDS_INODELOCK_LAYOUT 0x000008       /* for layout */
 
-/* Do not forget to increase MDS_INODELOCK_MAXSHIFT when adding new bits
- * XXX: MDS_INODELOCK_MAXSHIFT should be increased to 3 once the layout lock is
- * supported */
-#define MDS_INODELOCK_MAXSHIFT 2
+#define MDS_INODELOCK_MAXSHIFT 3
 /* This FULL lock is useful to take on unlink sort of operations */
 #define MDS_INODELOCK_FULL ((1<<(MDS_INODELOCK_MAXSHIFT+1))-1)
 
@@ -3249,6 +3267,25 @@ struct getinfo_fid2path {
 
 void lustre_swab_fid2path (struct getinfo_fid2path *gf);
 
+enum {
+        LAYOUT_INTENT_ACCESS    = 0,
+        LAYOUT_INTENT_READ      = 1,
+        LAYOUT_INTENT_WRITE     = 2,
+        LAYOUT_INTENT_GLIMPSE   = 3,
+        LAYOUT_INTENT_TRUNC     = 4,
+        LAYOUT_INTENT_RELEASE   = 5,
+        LAYOUT_INTENT_RESTORE   = 6
+};
+
+/* enqueue layout lock with intent */
+struct layout_intent {
+       __u32 li_opc; /* intent operation for enqueue, read, write etc */
+       __u32 li_flags;
+       __u64 li_start;
+       __u64 li_end;
+};
+
+void lustre_swab_layout_intent(struct layout_intent *li);
 
 #endif
 /** @} lustreidl */