These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / staging / lustre / lustre / llite / llite_internal.h
index 5f918e3..9096d31 100644 (file)
 #define VM_FAULT_RETRY 0
 #endif
 
-/* Kernel 3.1 kills LOOKUP_CONTINUE, LOOKUP_PARENT is equivalent to it.
- * seem kernel commit 49084c3bb2055c401f3493c13edae14d49128ca0 */
-#ifndef LOOKUP_CONTINUE
-#define LOOKUP_CONTINUE LOOKUP_PARENT
-#endif
-
 /** Only used on client-side for indicating the tail of dir hash/offset. */
 #define LL_DIR_END_OFF   0x7fffffffffffffffULL
 #define LL_DIR_END_OFF_32BIT    0x7fffffffUL
@@ -77,7 +71,7 @@ struct ll_dentry_data {
        struct rcu_head                 lld_rcu_head;
 };
 
-#define ll_d2d(de) ((struct ll_dentry_data*)((de)->d_fsdata))
+#define ll_d2d(de) ((struct ll_dentry_data *)((de)->d_fsdata))
 
 #define LLI_INODE_MAGIC                 0x111d0de5
 #define LLI_INODE_DEAD           0xdeadd00d
@@ -140,11 +134,9 @@ struct ll_inode_info {
        struct lu_fid              lli_pfid;
 
        struct list_head                      lli_close_list;
-       struct list_head                      lli_oss_capas;
        /* open count currently used by capability only, indicate whether
         * capability needs renewal */
        atomic_t                    lli_open_count;
-       struct obd_capa         *lli_mds_capa;
        unsigned long                 lli_rmtperm_time;
 
        /* handle is to be sent to MDS later on done_writing and setattr.
@@ -404,8 +396,8 @@ enum stats_track_type {
 #define LL_SBI_USER_XATTR      0x08 /* support user xattr */
 #define LL_SBI_ACL            0x10 /* support ACL */
 #define LL_SBI_RMT_CLIENT      0x40 /* remote client */
-#define LL_SBI_MDS_CAPA          0x80 /* support mds capa */
-#define LL_SBI_OSS_CAPA         0x100 /* support oss capa */
+#define LL_SBI_MDS_CAPA                 0x80 /* support mds capa, obsolete */
+#define LL_SBI_OSS_CAPA                0x100 /* support oss capa, obsolete */
 #define LL_SBI_LOCALFLOCK       0x200 /* Local flocks support by kernel */
 #define LL_SBI_LRU_RESIZE       0x400 /* lru resize support */
 #define LL_SBI_LAZYSTATFS       0x800 /* lazystatfs mount option */
@@ -462,7 +454,6 @@ struct eacl_table {
 };
 
 struct ll_sb_info {
-       struct list_head                  ll_list;
        /* this protects pglist and ra_info.  It isn't safe to
         * grab from interrupt contexts */
        spinlock_t                ll_lock;
@@ -471,7 +462,7 @@ struct ll_sb_info {
        struct obd_uuid    ll_sb_uuid;
        struct obd_export       *ll_md_exp;
        struct obd_export       *ll_dt_exp;
-       struct proc_dir_entry*    ll_proc_root;
+       struct dentry           *ll_debugfs_entry;
        struct lu_fid        ll_root_fid; /* root object fid */
 
        int                    ll_flags;
@@ -493,9 +484,6 @@ struct ll_sb_info {
        unsigned int          ll_namelen;
        struct file_operations   *ll_fop;
 
-       /* =0 - hold lock over whole read/write
-        * >0 - max. chunk to be read/written w/o lock re-acquiring */
-       unsigned long        ll_max_rw_chunk;
        unsigned int          ll_md_brw_size; /* used by readdir */
 
        struct lu_site     *ll_site;
@@ -524,10 +512,11 @@ struct ll_sb_info {
        struct rmtacl_ctl_table   ll_rct;
        struct eacl_table        ll_et;
        __kernel_fsid_t           ll_fsid;
+       struct kobject           ll_kobj; /* sysfs object */
+       struct super_block      *ll_sb; /* struct super_block (for sysfs code)*/
+       struct completion        ll_kobj_unregister;
 };
 
-#define LL_DEFAULT_MAX_RW_CHUNK      (32 * 1024 * 1024)
-
 struct ll_ra_read {
        pgoff_t      lrr_start;
        pgoff_t      lrr_count;
@@ -644,7 +633,8 @@ struct lov_stripe_md;
 
 extern spinlock_t inode_lock;
 
-extern struct proc_dir_entry *proc_lustre_fs_root;
+extern struct dentry *llite_root;
+extern struct kset *llite_kset;
 
 static inline struct inode *ll_info2i(struct ll_inode_info *lli)
 {
@@ -667,33 +657,16 @@ static inline int ll_need_32bit_api(struct ll_sb_info *sbi)
 
 void ll_ra_read_in(struct file *f, struct ll_ra_read *rar);
 void ll_ra_read_ex(struct file *f, struct ll_ra_read *rar);
-struct ll_ra_read *ll_ra_read_get(struct file *f);
 
 /* llite/lproc_llite.c */
-#if defined (CONFIG_PROC_FS)
-int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
-                               struct super_block *sb, char *osc, char *mdc);
-void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi);
+int ldebugfs_register_mountpoint(struct dentry *parent,
+                                struct super_block *sb, char *osc, char *mdc);
+void ldebugfs_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 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
-
 
 /* llite/dir.c */
 void ll_release_page(struct page *page, int remove);
@@ -714,7 +687,6 @@ struct inode *ll_iget(struct super_block *sb, ino_t hash,
 int ll_md_blocking_ast(struct ldlm_lock *, struct ldlm_lock_desc *,
                       void *data, int flag);
 struct dentry *ll_splice_alias(struct inode *inode, struct dentry *de);
-int ll_rmdir_entry(struct inode *dir, char *name, int namelen);
 
 /* llite/rw.c */
 int ll_prepare_write(struct file *, struct page *, unsigned from, unsigned to);
@@ -727,22 +699,18 @@ int ll_readahead(const struct lu_env *env, struct cl_io *io,
                 struct ll_readahead_state *ras, struct address_space *mapping,
                 struct cl_page_list *queue, int flags);
 
-#ifndef MS_HAS_NEW_AOPS
 extern const struct address_space_operations ll_aops;
-#else
-extern const struct address_space_operations_ext ll_aops;
-#endif
 
 /* llite/file.c */
 extern struct file_operations ll_file_operations;
 extern struct file_operations ll_file_operations_flock;
 extern struct file_operations ll_file_operations_noflock;
 extern struct inode_operations ll_file_inode_operations;
-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,
-                                  ldlm_mode_t mode);
+int ll_have_md_lock(struct inode *inode, __u64 *bits,
+                   ldlm_mode_t l_req_mode);
+ldlm_mode_t ll_take_md_lock(struct inode *inode, __u64 bits,
+                           struct lustre_handle *lockh, __u64 flags,
+                           ldlm_mode_t mode);
 int ll_file_open(struct inode *inode, struct file *file);
 int ll_file_release(struct inode *inode, struct file *file);
 int ll_glimpse_ioctl(struct ll_sb_info *sbi,
@@ -819,8 +787,6 @@ int ll_prep_inode(struct inode **inode, struct ptlrpc_request *req,
 int ll_obd_statfs(struct inode *inode, void *arg);
 int ll_get_max_mdsize(struct ll_sb_info *sbi, int *max_mdsize);
 int ll_get_default_mdsize(struct ll_sb_info *sbi, int *default_mdsize);
-int ll_get_max_cookiesize(struct ll_sb_info *sbi, int *max_cookiesize);
-int ll_get_default_cookiesize(struct ll_sb_info *sbi, int *default_cookiesize);
 int ll_process_config(struct lustre_cfg *lcfg);
 struct md_op_data *ll_prep_md_op_data(struct md_op_data *op_data,
                                      struct inode *i1, struct inode *i2,
@@ -829,6 +795,7 @@ struct md_op_data *ll_prep_md_op_data(struct md_op_data *op_data,
 void ll_finish_md_op_data(struct md_op_data *op_data);
 int ll_get_obd_name(struct inode *inode, unsigned int cmd, unsigned long arg);
 char *ll_get_fsname(struct super_block *sb, char *buf, int buflen);
+void ll_open_cleanup(struct super_block *sb, struct ptlrpc_request *open_req);
 
 /* llite/llite_nfs.c */
 extern struct export_operations lustre_export_operations;
@@ -851,7 +818,6 @@ struct ll_close_queue {
 
 struct ccc_object *cl_inode2ccc(struct inode *inode);
 
-
 void vvp_write_pending (struct ccc_object *club, struct ccc_page *page);
 void vvp_write_complete(struct ccc_object *club, struct ccc_page *page);
 
@@ -878,7 +844,7 @@ struct vvp_io {
                         * Inode modification time that is checked across DLM
                         * lock request.
                         */
-                       time_t           ft_mtime;
+                       time64_t            ft_mtime;
                        struct vm_area_struct *ft_vma;
                        /**
                         *  locked page returned from vvp_io
@@ -1028,6 +994,7 @@ static inline struct obd_export *ll_s2mdexp(struct super_block *sb)
 static inline struct client_obd *sbi2mdc(struct ll_sb_info *sbi)
 {
        struct obd_device *obd = sbi->ll_md_exp->exp_obd;
+
        if (obd == NULL)
                LBUG();
        return &obd->u.cli;
@@ -1080,25 +1047,6 @@ void free_rmtperm_hash(struct hlist_head *hash);
 int ll_update_remote_perm(struct inode *inode, struct mdt_remote_perm *perm);
 int lustre_check_remote_perm(struct inode *inode, int mask);
 
-/* llite/llite_capa.c */
-extern struct timer_list ll_capa_timer;
-
-int ll_capa_thread_start(void);
-void ll_capa_thread_stop(void);
-void ll_capa_timer_callback(unsigned long unused);
-
-struct obd_capa *ll_add_capa(struct inode *inode, struct obd_capa *ocapa);
-
-void ll_capa_open(struct inode *inode);
-void ll_capa_close(struct inode *inode);
-
-struct obd_capa *ll_mdscapa_get(struct inode *inode);
-struct obd_capa *ll_osscapa_get(struct inode *inode, __u64 opc);
-
-void ll_truncate_free_capa(struct obd_capa *ocapa);
-void ll_clear_inode_capas(struct inode *inode);
-void ll_print_capa_stat(struct ll_sb_info *sbi);
-
 /* llite/llite_cl.c */
 extern struct lu_device_type vvp_device_type;
 
@@ -1324,7 +1272,6 @@ typedef enum llioc_iter (*llioc_callback_t)(struct inode *inode,
 void *ll_iocontrol_register(llioc_callback_t cb, int count, unsigned int *cmd);
 void ll_iocontrol_unregister(void *magic);
 
-
 /* lclient compat stuff */
 #define cl_inode_info ll_inode_info
 #define cl_i2info(info) ll_i2info(info)
@@ -1372,8 +1319,6 @@ static inline int cl_merge_lvb(const struct lu_env *env, struct inode *inode)
 #define cl_inode_ctime(inode) LTIME_S((inode)->i_ctime)
 #define cl_inode_mtime(inode) LTIME_S((inode)->i_mtime)
 
-struct obd_capa *cl_capa_lookup(struct inode *inode, enum cl_req_type crt);
-
 int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end,
                       enum cl_fsync_mode mode, int ignore_layout);
 
@@ -1403,9 +1348,9 @@ static inline void cl_stats_tally(struct cl_device *dev, enum cl_req_type crt,
        ll_stats_ops_tally(ll_s2sbi(cl2ccc_dev(dev)->cdv_sb), opc, rc);
 }
 
-extern ssize_t ll_direct_rw_pages(const struct lu_env *env, struct cl_io *io,
-                                 int rw, struct inode *inode,
-                                 struct ll_dio_pages *pv);
+ssize_t ll_direct_rw_pages(const struct lu_env *env, struct cl_io *io,
+                          int rw, struct inode *inode,
+                          struct ll_dio_pages *pv);
 
 static inline int ll_file_nolock(const struct file *file)
 {
@@ -1493,7 +1438,15 @@ static inline void d_lustre_invalidate(struct dentry *dentry, int nested)
        spin_lock_nested(&dentry->d_lock,
                         nested ? DENTRY_D_LOCK_NESTED : DENTRY_D_LOCK_NORMAL);
        __d_lustre_invalidate(dentry);
-       if (d_count(dentry) == 0)
+       /*
+        * We should be careful about dentries created by d_obtain_alias().
+        * These dentries are not put in the dentry tree, instead they are
+        * linked to sb->s_anon through dentry->d_hash.
+        * shrink_dcache_for_umount() shrinks the tree and sb->s_anon list.
+        * If we unhashed such a dentry, unmount would not be able to find
+        * it and busy inodes would be reported.
+        */
+       if (d_count(dentry) == 0 && !(dentry->d_flags & DCACHE_DISCONNECTED))
                __d_drop(dentry);
        spin_unlock(&dentry->d_lock);
 }