Whamcloud - gitweb
LU-8066 obd_type: discard obd_types linked list.
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_internal.h
index accc6bf..fe9c8f0 100644 (file)
@@ -55,7 +55,7 @@
 
 /* LUSTRE_OSD_NAME */
 #include <obd.h>
-/* class_register_type(), class_unregister_type(), class_get_type() */
+/* class_register_type(), class_unregister_type() */
 #include <obd_class.h>
 #include <lustre_disk.h>
 #include <dt_object.h>
@@ -267,7 +267,9 @@ struct osd_device {
                                  od_check_ff:1,
                                  od_is_ost:1,
                                  od_in_init:1,
-                                 od_index_in_idif:1;
+                                 od_index_in_idif:1,
+       /* Other flags */
+                                 od_nonrotational:1;
 
        __s64                     od_auto_scrub_interval;
        __u32                     od_dirent_journal;
@@ -299,6 +301,7 @@ struct osd_device {
        /* service name associated with the osd device */
        char                      od_svname[MAX_OBD_NAME];
        char                      od_mntdev[MAX_OBD_NAME];
+       uuid_t                  od_uuid;
 
        /* quota slave instance for inode */
        struct qsd_instance      *od_quota_slave_md;
@@ -556,6 +559,22 @@ struct osd_iobuf {
        unsigned int       dr_init_at;  /* the line iobuf was initialized */
 };
 
+#ifdef HAVE_INODE_TIMESPEC64
+# define osd_timespec                  timespec64
+# define osd_timespec_trunc(ts, gran)  timespec64_trunc((ts), (gran))
+#else
+# define osd_timespec                  timespec
+# define osd_timespec_trunc(ts, gran)  timespec_trunc((ts), (gran))
+#endif
+
+static inline struct osd_timespec osd_inode_time(struct inode *inode,
+                                                s64 seconds)
+{
+       struct osd_timespec ts = { .tv_sec = seconds };
+
+       return osd_timespec_trunc(ts, inode->i_sb->s_time_gran);
+}
+
 #define OSD_INS_CACHE_SIZE     8
 
 struct osd_thread_info {
@@ -586,11 +605,6 @@ struct osd_thread_info {
        struct osd_inode_id    oti_id3;
         struct ost_id          oti_ostid;
 
-        /*
-         * XXX temporary: for ->i_op calls.
-         */
-        struct timespec        oti_time;
-
         /**
          * following ipd and it structures are used for osd_index_iam_lookup()
          * these are defined separately as we might do index operation
@@ -649,10 +663,8 @@ struct osd_thread_info {
        union {
 #if defined(HAVE_DQUOT_QC_DQBLK)
                struct qc_dqblk         oti_qdq;
-#elif defined(HAVE_DQUOT_FS_DISK_QUOTA)
-               struct fs_disk_quota    oti_fdq;
 #else
-               struct if_dqblk         oti_dqblk;
+               struct fs_disk_quota    oti_fdq;
 #endif
                struct if_dqinfo        oti_dqinfo;
        };
@@ -677,6 +689,12 @@ struct osd_thread_info {
 
 extern int ldiskfs_pdo;
 
+#ifdef HAVE_BVEC_ITER_ALL
+#define DECLARE_BVEC_ITER_ALL(iter) struct bvec_iter_all iter
+#else
+#define DECLARE_BVEC_ITER_ALL(iter) int iter
+#endif
+
 #ifndef HAVE_VFS_SETXATTR
 #define osd_setxattr(dentry, inode, name, buf, len, flag) \
                ((inode)->i_op->setxattr(dentry, name, buf, len, flag))
@@ -710,7 +728,7 @@ static inline int __osd_xattr_set(struct osd_thread_info *info,
 {
        struct dentry *dentry = &info->oti_child_dentry;
 
-       ll_vfs_dq_init(inode);
+       dquot_initialize(inode);
        dentry->d_inode = inode;
        dentry->d_sb = inode->i_sb;
        return osd_setxattr(dentry, inode, name, buf, buflen, fl);
@@ -728,7 +746,7 @@ int osd_register_proc_index_in_idif(struct osd_device *osd);
 
 #endif
 int osd_statfs(const struct lu_env *env, struct dt_device *dev,
-               struct obd_statfs *sfs);
+              struct obd_statfs *sfs, struct obd_statfs_info *info);
 struct inode *osd_iget(struct osd_thread_info *info, struct osd_device *dev,
                       struct osd_inode_id *id);
 struct inode *
@@ -779,6 +797,12 @@ int osd_oii_lookup(struct osd_device *dev, const struct lu_fid *fid,
                   struct osd_inode_id *id);
 void osd_scrub_dump(struct seq_file *m, struct osd_device *dev);
 
+struct dentry *osd_lookup_one_len_unlocked(struct osd_device *dev,
+                                          const char *name,
+                                          struct dentry *base, int len);
+struct dentry *osd_lookup_one_len(struct osd_device *dev, const char *name,
+                                 struct dentry *base, int len);
+
 int osd_fld_lookup(const struct lu_env *env, struct osd_device *osd,
                   u64 seq, struct lu_seq_range *range);
 
@@ -864,6 +888,13 @@ static inline void i_projid_write(struct inode *inode, __u32 projid)
 }
 #endif
 
+#ifdef HAVE_LDISKFS_IGET_WITH_FLAGS
+# define osd_ldiskfs_iget(sb, ino) \
+               ldiskfs_iget((sb), (ino), LDISKFS_IGET_HANDLE)
+#else
+# define osd_ldiskfs_iget(sb, ino) ldiskfs_iget((sb), (ino))
+#endif
+
 #ifdef HAVE_LDISKFS_INFO_JINODE
 # define osd_attach_jinode(inode) ldiskfs_inode_attach_jinode(inode)
 #else  /* HAVE_LDISKFS_INFO_JINODE */
@@ -891,7 +922,7 @@ static inline struct buffer_head *osd_ldiskfs_append(handle_t *handle,
                ldiskfs_journal_start(inode, type, nblocks)
 # define osd_transaction_size(dev) \
                (osd_journal(dev)->j_max_transaction_buffers / 2)
-#else
+#else /* ! defined LDISKFS_HT_MISC */
 # define LDISKFS_HT_MISC       0
 # define osd_journal_start_sb(sb, type, nblock) \
                ldiskfs_journal_start_sb(sb, nblock)
@@ -1503,4 +1534,10 @@ static inline bool bio_integrity_prep_fn(struct bio *bio,
 }
 #endif
 
+#ifdef HAVE_BIO_BI_PHYS_SEGMENTS
+#define osd_bio_nr_segs(bio)           ((bio)->bi_phys_segments)
+#else
+#define osd_bio_nr_segs(bio)           bio_segments((bio))
+#endif /* HAVE_BIO_BI_PHYS_SEGMENTS */
+
 #endif /* _OSD_INTERNAL_H */