Whamcloud - gitweb
LU-15850 llite: pass dmv inherit depth instead of dir depth
[fs/lustre-release.git] / lustre / llite / llite_internal.h
index 9b7386c..b3188d0 100644 (file)
@@ -171,6 +171,10 @@ struct ll_inode_info {
                        pid_t                           lli_opendir_pid;
                        /* directory depth to ROOT */
                        unsigned short                  lli_dir_depth;
+                       /* directory depth to ancestor whose default LMV is
+                        * inherited.
+                        */
+                       unsigned short                  lli_inherit_depth;
                        /* stat will try to access statahead entries or start
                         * statahead if this flag is set, and this flag will be
                         * set upon dir open, and cleared when dir is closed,
@@ -489,6 +493,23 @@ static inline void obd_connect_set_enc(struct obd_connect_data *data)
 #endif
 }
 
+static inline bool obd_connect_has_name_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_NAME;
+#else
+       return false;
+#endif
+}
+
+static inline void obd_connect_set_name_enc(struct obd_connect_data *data)
+{
+#ifdef HAVE_LUSTRE_CRYPTO
+       data->ocd_connect_flags2 |= OBD_CONNECT2_ENCRYPT_NAME;
+#endif
+}
+
 /*
  * Locking to guarantee consistency of non-atomic updates to long long i_size,
  * consistency between file size and KMS.
@@ -654,6 +675,7 @@ enum ll_sbi_flags {
        LL_SBI_TINY_WRITE,              /* tiny write support */
        LL_SBI_FILE_HEAT,               /* file heat support */
        LL_SBI_PARALLEL_DIO,            /* parallel (async) O_DIRECT RPCs */
+       LL_SBI_ENCRYPT_NAME,            /* name encryption */
        LL_SBI_NUM_FLAGS
 };
 
@@ -691,7 +713,8 @@ struct ll_sb_info {
        unsigned int             ll_xattr_cache_enabled:1,
                                 ll_xattr_cache_set:1, /* already set to 0/1 */
                                 ll_client_common_fill_super_succeeded:1,
-                                ll_checksum_set:1;
+                                ll_checksum_set:1,
+                                ll_inode_cache_enabled:1;
 
        struct lustre_client_ocd ll_lco;
 
@@ -1116,7 +1139,11 @@ int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat);
 int ll_getattr_dentry(struct dentry *de, struct kstat *stat, u32 request_mask,
                      unsigned int flags, bool foreign);
 #ifdef CONFIG_LUSTRE_FS_POSIX_ACL
-struct posix_acl *ll_get_acl(struct inode *inode, int type);
+struct posix_acl *ll_get_acl(struct inode *inode, int type
+#ifdef HAVE_GET_ACL_RCU_ARG
+                            , bool rcu
+#endif /* HAVE_GET_ACL_RCU_ARG */
+                            );
 int ll_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
               struct posix_acl *acl, int type);
 #else  /* !CONFIG_LUSTRE_FS_POSIX_ACL */
@@ -1162,6 +1189,9 @@ int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename,
                              struct ptlrpc_request **request);
 int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump,
                      int set_default);
+int ll_dir_get_default_layout(struct inode *inode, void **plmm, int *plmm_size,
+                             struct ptlrpc_request **request, u64 valid,
+                             enum get_default_layout_type type);
 int ll_dir_getstripe_default(struct inode *inode, void **lmmp,
                             int *lmm_size, struct ptlrpc_request **request,
                             struct ptlrpc_request **root_request, u64 valid);
@@ -1228,7 +1258,7 @@ int ll_flush_ctx(struct inode *inode);
 void ll_umount_begin(struct super_block *sb);
 int ll_remount_fs(struct super_block *sb, int *flags, char *data);
 int ll_show_options(struct seq_file *seq, struct dentry *dentry);
-void ll_dirty_page_discard_warn(struct page *page, int ioret);
+void ll_dirty_page_discard_warn(struct inode *inode, int ioret);
 int ll_prep_inode(struct inode **inode, struct req_capsule *pill,
                  struct super_block *sb, struct lookup_intent *it);
 int ll_obd_statfs(struct inode *inode, void __user *arg);
@@ -1395,9 +1425,22 @@ static inline struct lu_fid *ll_inode2fid(struct inode *inode)
 
 static inline bool ll_dir_striped(struct inode *inode)
 {
+       struct ll_inode_info *lli;
+       bool rc;
+
        LASSERT(inode);
-       return S_ISDIR(inode->i_mode) &&
-              lmv_dir_striped(ll_i2info(inode)->lli_lsm_md);
+       if (!S_ISDIR(inode->i_mode))
+               return false;
+
+       lli = ll_i2info(inode);
+       if (!lli->lli_lsm_md)
+               return false;
+
+       down_read(&lli->lli_lsm_sem);
+       rc = lmv_dir_striped(lli->lli_lsm_md);
+       up_read(&lli->lli_lsm_sem);
+
+       return rc;
 }
 
 static inline loff_t ll_file_maxbytes(struct inode *inode)
@@ -1723,7 +1766,7 @@ static inline struct pcc_super *ll_info2pccs(struct ll_inode_info *lli)
  */
 struct ll_digest_filename {
        struct lu_fid ldf_fid;
-       char ldf_excerpt[LLCRYPT_FNAME_DIGEST_SIZE];
+       char ldf_excerpt[LL_CRYPTO_BLOCK_SIZE];
 };
 
 int ll_setup_filename(struct inode *dir, const struct qstr *iname,
@@ -1735,6 +1778,13 @@ int ll_fname_disk_to_usr(struct inode *inode,
                         struct lu_fid *fid);
 int ll_revalidate_d_crypto(struct dentry *dentry, unsigned int flags);
 int ll_file_open_encrypt(struct inode *inode, struct file *filp);
+static inline char *xattr_for_enc(struct inode *inode)
+{
+       if (ll_sbi_has_name_encrypt(ll_i2sbi(inode)))
+               return LL_XATTR_NAME_ENCRYPTION_CONTEXT;
+
+       return LL_XATTR_NAME_ENCRYPTION_CONTEXT_OLD;
+}
 #ifdef HAVE_LUSTRE_CRYPTO
 extern const struct llcrypt_operations lustre_cryptops;
 #endif