Whamcloud - gitweb
LU-2216 mdt: remove obsolete DNE code
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_internal.h
index ab5fc62..1bdd60e 100644 (file)
@@ -72,7 +72,7 @@
 #include <obd_class.h>
 #include <lustre_disk.h>
 #include <dt_object.h>
-#include <lquota.h>
+#include <lustre_quota.h>
 
 #include "osd_oi.h"
 #include "osd_iam.h"
@@ -89,14 +89,6 @@ struct inode;
 /** Enable thandle usage statistics */
 #define OSD_THANDLE_STATS (0)
 
-#ifdef HAVE_QUOTA_SUPPORT
-struct osd_ctxt {
-        __u32 oc_uid;
-        __u32 oc_gid;
-        cfs_kernel_cap_t oc_cap;
-};
-#endif
-
 struct osd_directory {
         struct iam_container od_container;
         struct iam_descr     od_descr;
@@ -279,11 +271,7 @@ struct osd_device {
         struct obd_statfs         od_statfs;
         cfs_spinlock_t            od_osfs_lock;
 
-        /**
-         * The following flag indicates, if it is interop mode or not.
-         * It will be initialized, using mount param.
-         */
-        __u32                     od_iop_mode;
+       unsigned int              od_noscrub:1;
 
         struct fsfilt_operations *od_fsops;
        int                       od_connects;
@@ -315,26 +303,28 @@ struct osd_device {
 
 #define OSD_TRACK_DECLARES
 #ifdef OSD_TRACK_DECLARES
-#define OSD_DECLARE_OP(oh, op)   {                               \
-        LASSERT(oh->ot_handle == NULL);                          \
-        ((oh)->ot_declare_ ##op)++; }
-#define OSD_EXEC_OP(handle,op)      {                            \
-        struct osd_thandle *oh;                                  \
-        oh = container_of0(handle, struct osd_thandle, ot_super);\
-        if (((oh)->ot_declare_ ##op) > 0) {                      \
-                ((oh)->ot_declare_ ##op)--;                      \
-        }                                                        \
-        }
+#define OSD_DECLARE_OP(oh, op, credits)                                        \
+do {                                                                   \
+       LASSERT((oh)->ot_handle == NULL);                               \
+       ((oh)->ot_declare_ ##op)++;                                     \
+       ((oh)->ot_declare_ ##op ##_cred) += (credits);                  \
+       (oh)->ot_credits += (credits);                                  \
+} while (0)
+#define OSD_EXEC_OP(handle, op)                                                \
+do {                                                                   \
+       struct osd_thandle *oh = container_of(handle, typeof(*oh), ot_super); \
+       LASSERT((oh)->ot_declare_ ##op > 0);                            \
+       ((oh)->ot_declare_ ##op)--;                                     \
+} while (0)
 #else
-#define OSD_DECLARE_OP(oh, op)
+#define OSD_DECLARE_OP(oh, op, credits) (oh)->ot_credits += (credits)
 #define OSD_EXEC_OP(oh, op)
 #endif
 
 /* There are at most 10 uid/gids are affected in a transaction, and
  * that's rename case:
  * - 2 for source parent uid & gid;
- * - 2 for source child uid & gid ('..' entry update when the child
- *   is directory);
+ * - 2 for source child uid & gid ('..' entry update when child is directory);
  * - 2 for target parent uid & gid;
  * - 2 for target child uid & gid (if the target child exists);
  * - 2 for root uid & gid (last_rcvd, llog, etc);
@@ -358,16 +348,32 @@ struct osd_thandle {
        struct lquota_trans    *ot_quota_trans;
 
 #ifdef OSD_TRACK_DECLARES
-        unsigned char           ot_declare_attr_set;
-        unsigned char           ot_declare_punch;
-        unsigned char           ot_declare_xattr_set;
-        unsigned char           ot_declare_create;
-        unsigned char           ot_declare_destroy;
-        unsigned char           ot_declare_ref_add;
-        unsigned char           ot_declare_ref_del;
-        unsigned char           ot_declare_write;
-        unsigned char           ot_declare_insert;
-        unsigned char           ot_declare_delete;
+       /* Tracking for transaction credits, to allow debugging and optimizing
+        * cases where a large number of credits are being allocated for
+        * single transaction. */
+       unsigned char           ot_declare_attr_set;
+       unsigned char           ot_declare_punch;
+       unsigned char           ot_declare_xattr_set;
+       unsigned char           ot_declare_create;
+       unsigned char           ot_declare_destroy;
+       unsigned char           ot_declare_ref_add;
+       unsigned char           ot_declare_ref_del;
+       unsigned char           ot_declare_write;
+       unsigned char           ot_declare_insert;
+       unsigned char           ot_declare_delete;
+       unsigned char           ot_declare_quota;
+
+       unsigned short          ot_declare_attr_set_cred;
+       unsigned short          ot_declare_punch_cred;
+       unsigned short          ot_declare_xattr_set_cred;
+       unsigned short          ot_declare_create_cred;
+       unsigned short          ot_declare_destroy_cred;
+       unsigned short          ot_declare_ref_add_cred;
+       unsigned short          ot_declare_ref_del_cred;
+       unsigned short          ot_declare_write_cred;
+       unsigned short          ot_declare_insert_cred;
+       unsigned short          ot_declare_delete_cred;
+       unsigned short          ot_declare_quota_cred;
 #endif
 
 #if OSD_THANDLE_STATS
@@ -515,6 +521,7 @@ struct osd_iobuf {
         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 */
 };
 
 struct osd_thread_info {
@@ -601,9 +608,6 @@ struct osd_thread_info {
         struct osd_iobuf       oti_iobuf;
         struct inode           oti_inode;
         int                    oti_created[PTLRPC_MAX_BRW_PAGES];
-#ifdef HAVE_QUOTA_SUPPORT
-        struct osd_ctxt        oti_ctxt;
-#endif
         struct lu_env          oti_obj_delete_tx_env;
 #define OSD_FID_REC_SZ 32
         char                   oti_ldp[OSD_FID_REC_SZ];
@@ -731,6 +735,8 @@ static inline int osd_invariant(const struct osd_object *obj)
 #define osd_invariant(obj) (1)
 #endif
 
+#define OSD_MAX_CACHE_SIZE OBD_OBJECT_EOF
+
 extern const struct dt_index_operations osd_otable_ops;
 
 static inline int osd_oi_fid2idx(struct osd_device *dev,