Whamcloud - gitweb
LU-1199 build: Cleanup ldiskfs kernel config defines
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_internal.h
index 1dec8c2..75a2a8a 100644 (file)
 /* struct dirent64 */
 #include <linux/dirent.h>
 
+#include <ldiskfs/ldiskfs_config.h>
 #include <ldiskfs/ldiskfs.h>
 #include <ldiskfs/ldiskfs_jbd2.h>
-#ifdef HAVE_LDISKFS_JOURNAL_CALLBACK_ADD
-# define journal_callback ldiskfs_journal_cb_entry
-# define osd_journal_callback_set(handle, func, jcb) \
-         ldiskfs_journal_callback_add(handle, func, jcb)
-#else
-# define osd_journal_callback_set(handle, func, jcb) \
-         jbd2_journal_callback_set(handle, func, jcb)
-#endif
 
 /* fsfilt_{get|put}_ops */
 #include <lustre_fsfilt.h>
@@ -176,7 +169,7 @@ struct osd_mdobj {
 };
 
 struct osd_mdobj_map {
-       struct dentry   *omm_agent_dentry;
+       struct dentry   *omm_remote_parent;
 };
 
 #define osd_ldiskfs_find_entry(dir, dentry, de, lock)   \
@@ -267,6 +260,7 @@ struct osd_device {
        spinlock_t                od_osfs_lock;
 
        unsigned int              od_noscrub:1,
+                                 od_dirent_journal:1,
                                  od_handle_nolma:1;
 
        struct fsfilt_operations *od_fsops;
@@ -325,12 +319,14 @@ enum {
        OSD_OT_MAX              = 11
 };
 
-#define OSD_TRACK_DECLARES
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 3, 90, 0)
+# define OSD_TRACK_DECLARES
+#endif
 
 struct osd_thandle {
         struct thandle          ot_super;
         handle_t               *ot_handle;
-        struct journal_callback ot_jcb;
+        struct ldiskfs_journal_cb_entry ot_jcb;
         cfs_list_t              ot_dcb_list;
         /* Link to the device, for debugging. */
         struct lu_ref_link     *ot_dev_link;
@@ -470,20 +466,22 @@ struct osd_it_quota {
 #define MAX_BLOCKS_PER_PAGE (CFS_PAGE_SIZE / 512)
 
 struct osd_iobuf {
-        cfs_waitq_t        dr_wait;
-        cfs_atomic_t       dr_numreqs;  /* number of reqs being processed */
-        int                dr_max_pages;
-        int                dr_npages;
-        int                dr_error;
-        int                dr_frags;
-        unsigned int       dr_ignore_quota:1;
-        unsigned int       dr_elapsed_valid:1; /* we really did count time */
-        unsigned int       dr_rw:1;
-        struct page       *dr_pages[PTLRPC_MAX_BRW_PAGES];
-        unsigned long      dr_blocks[PTLRPC_MAX_BRW_PAGES*MAX_BLOCKS_PER_PAGE];
-        unsigned long      dr_start_time;
-        unsigned long      dr_elapsed;  /* how long io took */
-        struct osd_device *dr_dev;
+       cfs_waitq_t        dr_wait;
+       cfs_atomic_t       dr_numreqs;  /* number of reqs being processed */
+       int                dr_max_pages;
+       int                dr_npages;
+       int                dr_error;
+       int                dr_frags;
+       unsigned int       dr_ignore_quota:1;
+       unsigned int       dr_elapsed_valid:1; /* we really did count time */
+       unsigned int       dr_rw:1;
+       struct lu_buf      dr_pg_buf;
+       struct page      **dr_pages;
+       struct lu_buf      dr_bl_buf;
+       unsigned long     *dr_blocks;
+       unsigned long      dr_start_time;
+       unsigned long      dr_elapsed;  /* how long io took */
+       struct osd_device *dr_dev;
        unsigned int       dr_init_at;  /* the line iobuf was initialized */
 };
 
@@ -539,10 +537,10 @@ struct osd_thread_info {
                struct osd_it_quota     oti_it_quota;
        };
 
-        /** pre-allocated buffer used by oti_it_ea, size OSD_IT_EA_BUFSIZE */
-        void                  *oti_it_ea_buf;
+       /** pre-allocated buffer used by oti_it_ea, size OSD_IT_EA_BUFSIZE */
+       void                    *oti_it_ea_buf;
 
-        cfs_kstatfs_t          oti_ksfs;
+       struct kstatfs          oti_ksfs;
 
         /** IAM iterator for index operation. */
         struct iam_iterator    oti_idx_it;
@@ -571,18 +569,20 @@ struct osd_thread_info {
                /* old LMA for compatibility */
                char                    oti_mdt_attrs_old[LMA_OLD_SIZE];
        };
-        /** 0-copy IO */
-        struct osd_iobuf       oti_iobuf;
-        struct inode           oti_inode;
-        int                    oti_created[PTLRPC_MAX_BRW_PAGES];
-        struct lu_env          oti_obj_delete_tx_env;
+       /** 0-copy IO */
+       struct osd_iobuf       oti_iobuf;
+       struct inode           oti_inode;
 #define OSD_FID_REC_SZ 32
-        char                   oti_ldp[OSD_FID_REC_SZ];
-        char                   oti_ldp2[OSD_FID_REC_SZ];
+       char                   oti_ldp[OSD_FID_REC_SZ];
+       char                   oti_ldp2[OSD_FID_REC_SZ];
 
        /* used by quota code */
        union {
+#ifdef HAVE_DQUOT_FS_DISK_QUOTA
+               struct fs_disk_quota    oti_fdq;
+#else
                struct if_dqblk         oti_dqblk;
+#endif
                struct if_dqinfo        oti_dqinfo;
        };
        struct lquota_id_info   oti_qi;
@@ -606,6 +606,17 @@ struct osd_thread_info {
 
 extern int ldiskfs_pdo;
 
+static inline int __osd_xattr_set(struct osd_thread_info *info,
+                                 struct inode *inode, const char *name,
+                                 const void *buf, int buflen, int fl)
+{
+       struct dentry *dentry = &info->oti_child_dentry;
+
+       ll_vfs_dq_init(inode);
+       dentry->d_inode = inode;
+       return inode->i_op->setxattr(dentry, name, buf, buflen, fl);
+}
+
 #ifdef LPROCFS
 /* osd_lproc.c */
 void lprocfs_osd_init_vars(struct lprocfs_static_vars *lvars);
@@ -621,11 +632,11 @@ int osd_object_auth(const struct lu_env *env, struct dt_object *dt,
 struct inode *osd_iget(struct osd_thread_info *info, struct osd_device *dev,
                       struct osd_inode_id *id);
 int osd_ea_fid_set(struct osd_thread_info *info, struct inode *inode,
-                  const struct lu_fid *fid);
+                  const struct lu_fid *fid, __u64 flags);
 int osd_get_lma(struct osd_thread_info *info, struct inode *inode,
                struct dentry *dentry, struct lustre_mdt_attrs *lma);
 
-int osd_obj_map_init(struct osd_device *osd);
+int osd_obj_map_init(const struct lu_env *env, struct osd_device *osd);
 void osd_obj_map_fini(struct osd_device *dev);
 int osd_obj_map_lookup(struct osd_thread_info *info, struct osd_device *osd,
                        const struct lu_fid *fid, struct osd_inode_id *id);
@@ -654,14 +665,13 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len);
 
 int osd_fld_lookup(const struct lu_env *env, struct osd_device *osd,
                   const struct lu_fid *fid, struct lu_seq_range *range);
-struct dentry *osd_agent_lookup(struct osd_mdobj_map *omm, int index);
-struct dentry *osd_agent_load(const struct osd_device *osd, int mdt_index,
-                             int create);
-
-int osd_delete_agent_inode(const struct lu_env *env, struct osd_device *osd,
-                          struct osd_object *obj, struct osd_thandle *oh);
-int osd_create_agent_inode(const struct lu_env *env, struct osd_device *osd,
-                          struct osd_object *obj, struct osd_thandle *oh);
+
+int osd_delete_from_remote_parent(const struct lu_env *env,
+                                 struct osd_device *osd,
+                                 struct osd_object *obj,
+                                 struct osd_thandle *oh);
+int osd_add_to_remote_parent(const struct lu_env *env, struct osd_device *osd,
+                            struct osd_object *obj, struct osd_thandle *oh);
 
 /* osd_quota_fmt.c */
 int walk_tree_dqentry(const struct lu_env *env, struct osd_object *obj,