Whamcloud - gitweb
LU-2869 llite: extended attribute cache
[fs/lustre-release.git] / lustre / llite / llite_internal.h
index 4fc1e4b..e827f01 100644 (file)
@@ -126,6 +126,8 @@ enum lli_flags {
        LLIF_DATA_MODIFIED      = (1 << 6),
        /* File is being restored */
        LLIF_FILE_RESTORING     = (1 << 7),
+       /* Xattr cache is attached to the file */
+       LLIF_XATTR_CACHE        = (1 << 8),
 };
 
 struct ll_inode_info {
@@ -278,8 +280,27 @@ struct ll_inode_info {
        struct mutex                    lli_layout_mutex;
        /* valid only inside LAYOUT ibits lock, protected by lli_layout_mutex */
        __u32                           lli_layout_gen;
+
+       struct rw_semaphore             lli_xattrs_list_rwsem;
+       struct mutex                    lli_xattrs_enq_lock;
+       struct list_head                lli_xattrs; /* ll_xattr_entry->xe_list */
 };
 
+int ll_xattr_cache_destroy(struct inode *inode);
+
+int ll_xattr_cache_get(struct inode *inode,
+                       const char *name,
+                       char *buffer,
+                       size_t size,
+                       __u64 valid);
+
+int ll_xattr_cache_update(struct inode *inode,
+                       const char *name,
+                       const char *newval,
+                       size_t size,
+                       __u64 valid,
+                       int flags);
+
 /*
  * Locking to guarantee consistency of non-atomic updates to long long i_size,
  * consistency between file size and KMS.
@@ -401,6 +422,7 @@ enum stats_track_type {
 #define LL_SBI_VERBOSE        0x10000 /* verbose mount/umount */
 #define LL_SBI_LAYOUT_LOCK    0x20000 /* layout lock support */
 #define LL_SBI_USER_FID2PATH  0x40000 /* allow fid2path by unprivileged users */
+#define LL_SBI_XATTR_CACHE    0x80000 /* support for xattr cache */
 
 #define LL_SBI_FLAGS {         \
        "nolck",        \
@@ -408,6 +430,7 @@ enum stats_track_type {
        "flock",        \
        "xattr",        \
        "acl",          \
+       "???",          \
        "rmt_client",   \
        "mds_capa",     \
        "oss_capa",     \
@@ -420,7 +443,9 @@ enum stats_track_type {
        "agl",          \
        "verbose",      \
        "layout",       \
-       "user_fid2path" }
+       "user_fid2path",\
+       "xattr",        \
+}
 
 /* default value for ll_sb_info->contention_time */
 #define SBI_DEFAULT_CONTENTION_SECONDS     60
@@ -468,7 +493,8 @@ struct ll_sb_info {
         struct lu_fid             ll_root_fid; /* root object fid */
 
         int                       ll_flags;
-       int                       ll_umounting:1;
+       unsigned int              ll_umounting:1,
+                                 ll_xattr_cache_enabled:1;
         cfs_list_t                ll_conn_chain; /* per-conn chain of SBs */
         struct lustre_client_ocd  ll_lco;
 
@@ -744,7 +770,8 @@ extern int ll_inode_revalidate_it(struct dentry *, struct lookup_intent *,
 extern int ll_have_md_lock(struct inode *inode, __u64 *bits,
                            ldlm_mode_t l_req_mode);
 extern ldlm_mode_t ll_take_md_lock(struct inode *inode, __u64 bits,
-                                   struct lustre_handle *lockh, __u64 flags);
+                                  struct lustre_handle *lockh, __u64 flags,
+                                  ldlm_mode_t mode);
 int __ll_inode_revalidate_it(struct dentry *, struct lookup_intent *,
                              __u64 bits);
 #ifdef HAVE_IOP_ATOMIC_OPEN
@@ -1634,4 +1661,7 @@ int ll_layout_conf(struct inode *inode, const struct cl_object_conf *conf);
 int ll_layout_refresh(struct inode *inode, __u32 *gen);
 int ll_layout_restore(struct inode *inode);
 
+int ll_xattr_init(void);
+void ll_xattr_fini(void);
+
 #endif /* LLITE_INTERNAL_H */