Whamcloud - gitweb
LU-9019 osd: migrate osd-ldiskfs thandle stats to 64 bit time
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_internal.h
index 303fb70..90fa9a2 100644 (file)
@@ -23,7 +23,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2015, Intel Corporation.
+ * Copyright (c) 2011, 2016, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -360,10 +360,10 @@ struct osd_thandle {
        struct lquota_trans    *ot_quota_trans;
 #if OSD_THANDLE_STATS
         /** time when this handle was allocated */
-        cfs_time_t oth_alloced;
+       ktime_t oth_alloced;
 
         /** time when this thanle was started */
-        cfs_time_t oth_started;
+       ktime_t oth_started;
 #endif
 };
 
@@ -772,11 +772,26 @@ static inline void i_gid_write(struct inode *inode, gid_t gid)
 }
 #endif
 
+#ifdef HAVE_LDISKFS_INFO_JINODE
+# define osd_attach_jinode(inode) ldiskfs_inode_attach_jinode(inode)
+#else  /* HAVE_LDISKFS_INFO_JINODE */
+# define osd_attach_jinode(inode) 0
+#endif /* HAVE_LDISKFS_INFO_JINODE */
+
 #ifdef LDISKFS_HT_MISC
 # define osd_journal_start_sb(sb, type, nblock) \
                ldiskfs_journal_start_sb(sb, type, nblock)
-# define osd_ldiskfs_append(handle, inode, nblock) \
-               ldiskfs_append(handle, inode, nblock)
+static inline struct buffer_head *osd_ldiskfs_append(handle_t *handle,
+                                                    struct inode *inode,
+                                                    ldiskfs_lblk_t *nblock)
+{
+       int rc;
+
+       rc = osd_attach_jinode(inode);
+       if (rc)
+               return ERR_PTR(rc);
+       return ldiskfs_append(handle, inode, nblock);
+}
 # define osd_ldiskfs_find_entry(dir, name, de, inlined, lock) \
                (__ldiskfs_find_entry(dir, name, de, inlined, lock) ?: \
                 ERR_PTR(-ENOENT))
@@ -1213,18 +1228,23 @@ static inline struct buffer_head *__ldiskfs_bread(handle_t *handle,
                                                  ldiskfs_lblk_t block,
                                                  int create)
 {
-#ifdef HAVE_EXT4_BREAD_4ARGS
-       return ldiskfs_bread(handle, inode, block, create);
-#else
+       int rc = 0;
        struct buffer_head *bh;
-       int error = 0;
 
-       bh = ldiskfs_bread(handle, inode, block, create, &error);
-       if (bh == NULL && error != 0)
-               bh = ERR_PTR(error);
+       if (create) {
+               rc = osd_attach_jinode(inode);
+               if (rc)
+                       return ERR_PTR(rc);
+       }
+#ifdef HAVE_EXT4_BREAD_4ARGS
+       bh = ldiskfs_bread(handle, inode, block, create);
+#else
 
-       return bh;
+       bh = ldiskfs_bread(handle, inode, block, create, &rc);
+       if (bh == NULL && rc != 0)
+               bh = ERR_PTR(rc);
 #endif
+       return bh;
 }
 
 void ldiskfs_inc_count(handle_t *handle, struct inode *inode);
@@ -1232,4 +1252,5 @@ void ldiskfs_dec_count(handle_t *handle, struct inode *inode);
 
 void osd_fini_iobuf(struct osd_device *d, struct osd_iobuf *iobuf);
 
+
 #endif /* _OSD_INTERNAL_H */