Whamcloud - gitweb
LU-9679 lustre: remove some "#ifdef CONFIG*" from .c files.
[fs/lustre-release.git] / lustre / llite / llite_internal.h
index b6b0908..93b1a51 100644 (file)
 #include <linux/compat.h>
 #include <linux/aio.h>
 #include <lustre_compat.h>
+#include <lustre_crypto.h>
+
+#ifndef VM_FAULT_RETRY
+#include <linux/mm_types.h>
+#endif
 
 #include "vvp_internal.h"
 #include "range_lock.h"
@@ -142,6 +147,7 @@ struct ll_inode_info {
        s64                             lli_atime;
        s64                             lli_mtime;
        s64                             lli_ctime;
+       s64                             lli_btime;
        spinlock_t                      lli_agl_lock;
 
        /* Try to make the d::member and f::member are aligned. Before using
@@ -183,6 +189,7 @@ struct ll_inode_info {
                        char                   *lli_symlink_name;
                        struct ll_trunc_sem     lli_trunc_sem;
                        struct range_lock_tree  lli_write_tree;
+                       struct mutex            lli_setattr_mutex;
 
                        struct rw_semaphore     lli_glimpse_sem;
                        ktime_t                 lli_glimpse_time;
@@ -229,6 +236,10 @@ struct ll_inode_info {
                        struct mutex             lli_group_mutex;
                        __u64                    lli_group_users;
                        unsigned long            lli_group_gid;
+
+                       __u64                    lli_attr_valid;
+                       __u64                    lli_lazysize;
+                       __u64                    lli_lazyblocks;
                };
        };
 
@@ -338,6 +349,35 @@ static inline void trunc_sem_up_write(struct ll_trunc_sem *sem)
        wake_up_var(&sem->ll_trunc_readers);
 }
 
+#ifdef CONFIG_LUSTRE_FS_POSIX_ACL
+static inline void lli_clear_acl(struct ll_inode_info *lli)
+{
+       if (lli->lli_posix_acl) {
+               posix_acl_release(lli->lli_posix_acl);
+               lli->lli_posix_acl = NULL;
+       }
+}
+
+static inline void lli_replace_acl(struct ll_inode_info *lli,
+                                  struct lustre_md *md)
+{
+       spin_lock(&lli->lli_lock);
+       if (lli->lli_posix_acl)
+               posix_acl_release(lli->lli_posix_acl);
+       lli->lli_posix_acl = md->posix_acl;
+       spin_unlock(&lli->lli_lock);
+}
+#else
+static inline void lli_clear_acl(struct ll_inode_info *lli)
+{
+}
+
+static inline void lli_replace_acl(struct ll_inode_info *lli,
+                                  struct lustre_md *md)
+{
+}
+#endif
+
 static inline __u32 ll_layout_version_get(struct ll_inode_info *lli)
 {
        __u32 gen;
@@ -428,6 +468,23 @@ int ll_inode_init_security(struct dentry *dentry, struct inode *inode,
 int ll_listsecurity(struct inode *inode, char *secctx_name,
                    size_t secctx_name_size);
 
+static inline bool obd_connect_has_enc(struct obd_connect_data *data)
+{
+#ifdef HAVE_LUSTRE_CRYPTO
+       return data->ocd_connect_flags & OBD_CONNECT_FLAGS2 &&
+               data->ocd_connect_flags2 & OBD_CONNECT2_ENCRYPT;
+#else
+       return false;
+#endif
+}
+
+static inline void obd_connect_set_enc(struct obd_connect_data *data)
+{
+#ifdef HAVE_LUSTRE_CRYPTO
+       data->ocd_connect_flags2 |= OBD_CONNECT2_ENCRYPT;
+#endif
+}
+
 /*
  * Locking to guarantee consistency of non-atomic updates to long long i_size,
  * consistency between file size and KMS.
@@ -580,6 +637,8 @@ enum stats_track_type {
                                         2.10, abandoned */
 #define LL_SBI_TINY_WRITE   0x2000000 /* tiny write support */
 #define LL_SBI_FILE_HEAT    0x4000000 /* file heat support */
+#define LL_SBI_TEST_DUMMY_ENCRYPTION    0x8000000 /* test dummy encryption */
+#define LL_SBI_ENCRYPT    0x10000000 /* client side encryption */
 #define LL_SBI_FLAGS {         \
        "nolck",        \
        "checksum",     \
@@ -608,6 +667,8 @@ enum stats_track_type {
        "pio",          \
        "tiny_write",   \
        "file_heat",    \
+       "test_dummy_encryption", \
+       "noencrypt",    \
 }
 
 /* This is embedded into llite super-blocks to keep track of connect
@@ -1017,7 +1078,8 @@ int ll_getattr(const struct path *path, struct kstat *stat,
 #else
 int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat);
 #endif
-int ll_getattr_dentry(struct dentry *de, struct kstat *stat);
+int ll_getattr_dentry(struct dentry *de, struct kstat *stat, u32 request_mask,
+                     unsigned int flags);
 struct posix_acl *ll_get_acl(struct inode *inode, int type);
 #ifdef HAVE_IOP_SET_ACL
 #ifdef CONFIG_LUSTRE_FS_POSIX_ACL
@@ -1397,7 +1459,9 @@ struct ll_statahead_info {
        atomic_t                sai_cache_count; /* entry count in cache */
 };
 
-int ll_statahead(struct inode *dir, struct dentry **dentry, bool unplug);
+int ll_revalidate_statahead(struct inode *dir, struct dentry **dentry,
+                           bool unplug);
+int ll_start_statahead(struct inode *dir, struct dentry *dentry, bool agl);
 void ll_authorize_statahead(struct inode *dir, void *key);
 void ll_deauthorize_statahead(struct inode *dir, void *key);
 
@@ -1476,7 +1540,8 @@ dentry_may_statahead(struct inode *dir, struct dentry *dentry)
         * 'lld_sa_generation == lli->lli_sa_generation'.
         */
        ldd = ll_d2d(dentry);
-       if (ldd != NULL && ldd->lld_sa_generation == lli->lli_sa_generation)
+       if (ldd != NULL && lli->lli_sa_generation &&
+           ldd->lld_sa_generation == lli->lli_sa_generation)
                return false;
 
        return true;
@@ -1553,8 +1618,8 @@ static inline void __d_lustre_invalidate(struct dentry *dentry)
  */
 static inline void d_lustre_invalidate(struct dentry *dentry, int nested)
 {
-       CDEBUG(D_DENTRY, "invalidate dentry %.*s (%p) parent %p inode %p "
-              "refc %d\n", dentry->d_name.len, dentry->d_name.name, dentry,
+       CDEBUG(D_DENTRY, "invalidate dentry %pd (%p) parent %p inode %p refc %d\n",
+              dentry, dentry,
               dentry->d_parent, dentry->d_inode, ll_d_count(dentry));
 
        spin_lock_nested(&dentry->d_lock,
@@ -1630,4 +1695,9 @@ static inline struct pcc_super *ll_info2pccs(struct ll_inode_info *lli)
        return ll_i2pccs(ll_info2i(lli));
 }
 
+#ifdef HAVE_LUSTRE_CRYPTO
+/* crypto.c */
+extern const struct llcrypt_operations lustre_cryptops;
+#endif
+
 #endif /* LLITE_INTERNAL_H */