Whamcloud - gitweb
LU-13344 osd-ldiskfs: timespec64 is broken
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_internal.h
index 6c62ca4..7dc4bde 100644 (file)
@@ -153,6 +153,7 @@ struct osd_object {
 
        struct list_head        oo_xattr_list;
        struct lu_object_header *oo_header;
+       __u64                   oo_dirent_count;
 };
 
 struct osd_obj_seq {
@@ -380,17 +381,18 @@ enum osd_full_scrub_ratio {
 
 enum osd_op_type {
        OSD_OT_ATTR_SET         = 0,
-       OSD_OT_PUNCH            = 1,
-       OSD_OT_XATTR_SET        = 2,
-       OSD_OT_CREATE           = 3,
-       OSD_OT_DESTROY          = 4,
-       OSD_OT_REF_ADD          = 5,
-       OSD_OT_REF_DEL          = 6,
-       OSD_OT_WRITE            = 7,
-       OSD_OT_INSERT           = 8,
-       OSD_OT_DELETE           = 9,
-       OSD_OT_QUOTA            = 10,
-       OSD_OT_MAX              = 11
+       OSD_OT_PUNCH,
+       OSD_OT_XATTR_SET,
+       OSD_OT_CREATE,
+       OSD_OT_DESTROY,
+       OSD_OT_REF_ADD,
+       OSD_OT_REF_DEL,
+       OSD_OT_WRITE,
+       OSD_OT_INSERT,
+       OSD_OT_DELETE,
+       OSD_OT_QUOTA,
+       OSD_OT_PREALLOC,
+       OSD_OT_MAX
 };
 
 struct osd_access_lock {
@@ -576,10 +578,8 @@ int osd_security_file_alloc(struct file *file);
 
 #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,
@@ -587,7 +587,7 @@ static inline struct osd_timespec osd_inode_time(struct inode *inode,
 {
        struct osd_timespec ts = { .tv_sec = seconds };
 
-       return osd_timespec_trunc(ts, inode->i_sb->s_time_gran);
+       return ts;
 }
 
 #define OSD_INS_CACHE_SIZE     8
@@ -1009,14 +1009,14 @@ static inline int lu_device_is_osd(const struct lu_device *d)
 
 static inline struct osd_device *osd_dt_dev(const struct dt_device *d)
 {
-        LASSERT(lu_device_is_osd(&d->dd_lu_dev));
-        return container_of0(d, struct osd_device, od_dt_dev);
+       LASSERT(lu_device_is_osd(&d->dd_lu_dev));
+       return container_of(d, struct osd_device, od_dt_dev);
 }
 
 static inline struct osd_device *osd_dev(const struct lu_device *d)
 {
-        LASSERT(lu_device_is_osd(d));
-        return osd_dt_dev(container_of0(d, struct dt_device, dd_lu_dev));
+       LASSERT(lu_device_is_osd(d));
+       return osd_dt_dev(container_of(d, struct dt_device, dd_lu_dev));
 }
 
 static inline struct osd_device *osd_obj2dev(const struct osd_object *o)
@@ -1057,8 +1057,8 @@ static inline int osd_object_is_root(const struct osd_object *obj)
 
 static inline struct osd_object *osd_obj(const struct lu_object *o)
 {
-        LASSERT(lu_device_is_osd(o->lo_dev));
-        return container_of0(o, struct osd_object, oo_dt.do_lu);
+       LASSERT(lu_device_is_osd(o->lo_dev));
+       return container_of(o, struct osd_object, oo_dt.do_lu);
 }
 
 static inline struct osd_object *osd_dt_obj(const struct dt_object *d)
@@ -1179,6 +1179,11 @@ static inline void osd_trans_declare_op(const struct lu_env *env,
        oh->ot_credits += credits;
 }
 
+/* linux: v5.4-rc3-21-g933f1c1e0b75 renamed h_buffer_credits */
+#ifdef HAVE_JOURNAL_TOTAL_CREDITS
+#define h_buffer_credits h_total_credits
+#endif
+
 static inline void osd_trans_exec_op(const struct lu_env *env,
                                     struct thandle *th,
                                     enum osd_op_type op)
@@ -1473,7 +1478,7 @@ osd_index_backup(const struct lu_env *env, struct osd_device *osd, bool backup)
 
 int osd_trunc_lock(struct osd_object *obj, struct osd_thandle *oh,
                   bool shared);
-void osd_trunc_unlock_all(struct list_head *list);
+void osd_trunc_unlock_all(const struct lu_env *env, struct list_head *list);
 void osd_process_truncates(struct list_head *list);
 void osd_execute_truncate(struct osd_object *obj);