]> Pileus Git - ~andy/linux/blobdiff - drivers/staging/lustre/lustre/llite/llite_internal.h
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
[~andy/linux] / drivers / staging / lustre / lustre / llite / llite_internal.h
index d37c183109baf8e7c162160b6a25913c1ad9e638..7ee5c02783f96fa8f9962b88949d476e55b4ed2a 100644 (file)
@@ -47,6 +47,7 @@
 #include <lustre_mdc.h>
 #include <linux/lustre_intent.h>
 #include <linux/compat.h>
+#include <linux/posix_acl_xattr.h>
 
 #ifndef FMODE_EXEC
 #define FMODE_EXEC 0
@@ -125,6 +126,10 @@ enum lli_flags {
        LLIF_SRVLOCK        = (1 << 5),
        /* File data is modified. */
        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 {
@@ -277,8 +282,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.
@@ -400,6 +424,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",        \
@@ -407,6 +432,7 @@ enum stats_track_type {
        "flock",        \
        "xattr",        \
        "acl",          \
+       "???",          \
        "rmt_client",   \
        "mds_capa",     \
        "oss_capa",     \
@@ -419,7 +445,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
@@ -459,7 +487,8 @@ struct ll_sb_info {
        struct lu_fid        ll_root_fid; /* root object fid */
 
        int                    ll_flags;
-       unsigned int                      ll_umounting:1;
+       unsigned int              ll_umounting:1,
+                                 ll_xattr_cache_enabled:1;
        struct list_head                ll_conn_chain; /* per-conn chain of SBs */
        struct lustre_client_ocd  ll_lco;
 
@@ -608,10 +637,14 @@ extern struct kmem_cache *ll_file_data_slab;
 struct lustre_handle;
 struct ll_file_data {
        struct ll_readahead_state fd_ras;
-       int fd_omode;
        struct ccc_grouplock fd_grouplock;
        __u64 lfd_pos;
        __u32 fd_flags;
+       fmode_t fd_omode;
+       /* openhandle if lease exists for this file.
+        * Borrow lli->lli_och_mutex to protect assignment */
+       struct obd_client_handle *fd_lease_och;
+       struct obd_client_handle *fd_och;
        struct file *fd_file;
        /* Indicate whether need to report failure when close.
         * true: failure is known, not report again.
@@ -644,7 +677,12 @@ static inline int ll_need_32bit_api(struct ll_sb_info *sbi)
 #if BITS_PER_LONG == 32
        return 1;
 #else
-       return unlikely(is_compat_task() || (sbi->ll_flags & LL_SBI_32BIT_API));
+       return unlikely(
+#ifdef CONFIG_COMPAT
+               is_compat_task() ||
+#endif
+               (sbi->ll_flags & LL_SBI_32BIT_API)
+       );
 #endif
 }
 
@@ -664,15 +702,22 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
 void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi);
 void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count);
 void lprocfs_llite_init_vars(struct lprocfs_static_vars *lvars);
+void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid,
+                      struct ll_file_data *file, loff_t pos,
+                      size_t count, int rw);
 #else
 static inline int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
                        struct super_block *sb, char *osc, char *mdc){return 0;}
 static inline void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi) {}
-static void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count) {}
-static void lprocfs_llite_init_vars(struct lprocfs_static_vars *lvars)
+static inline
+void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count) {}
+static inline void lprocfs_llite_init_vars(struct lprocfs_static_vars *lvars)
 {
        memset(lvars, 0, sizeof(*lvars));
 }
+static inline void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid,
+                                    struct ll_file_data *file, loff_t pos,
+                                    size_t count, int rw) {}
 #endif
 
 
@@ -721,7 +766,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);
 int ll_revalidate_nd(struct dentry *dentry, unsigned int flags);
@@ -747,9 +793,6 @@ int ll_md_setattr(struct dentry *dentry, struct md_op_data *op_data,
                  struct md_open_data **mod);
 void ll_pack_inode2opdata(struct inode *inode, struct md_op_data *op_data,
                          struct lustre_handle *fh);
-extern void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid,
-                             struct ll_file_data *file, loff_t pos,
-                             size_t count, int rw);
 int ll_getattr_it(struct vfsmount *mnt, struct dentry *de,
               struct lookup_intent *it, struct kstat *stat);
 int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat);
@@ -776,6 +819,12 @@ int ll_get_grouplock(struct inode *inode, struct file *file, unsigned long arg);
 int ll_put_grouplock(struct inode *inode, struct file *file, unsigned long arg);
 int ll_fid2path(struct inode *inode, void *arg);
 int ll_data_version(struct inode *inode, __u64 *data_version, int extent_lock);
+int ll_hsm_release(struct inode *inode);
+
+struct obd_client_handle *ll_lease_open(struct inode *inode, struct file *file,
+                                       fmode_t mode, __u64 flags);
+int ll_lease_close(struct obd_client_handle *och, struct inode *inode,
+                  bool *lease_broken);
 
 /* llite/dcache.c */
 
@@ -802,7 +851,7 @@ void ll_kill_super(struct super_block *sb);
 struct inode *ll_inode_from_resource_lock(struct ldlm_lock *lock);
 struct inode *ll_inode_from_lock(struct ldlm_lock *lock);
 void ll_clear_inode(struct inode *inode);
-int ll_setattr_raw(struct dentry *dentry, struct iattr *attr);
+int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import);
 int ll_setattr(struct dentry *de, struct iattr *attr);
 int ll_statfs(struct dentry *de, struct kstatfs *sfs);
 int ll_statfs_internal(struct super_block *sb, struct obd_statfs *osfs,
@@ -1579,5 +1628,9 @@ enum {
 
 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 */