Whamcloud - gitweb
LU-5061 obd: add lnb_ prefix to members of struct niobuf_local
[fs/lustre-release.git] / lustre / include / obd.h
index f8255d0..2046f69 100644 (file)
@@ -199,21 +199,6 @@ struct brw_page {
        obd_flag flag;
 };
 
-/* llog contexts */
-enum llog_ctxt_id {
-       LLOG_CONFIG_ORIG_CTXT  =  0,
-       LLOG_CONFIG_REPL_CTXT,
-       LLOG_MDS_OST_ORIG_CTXT,
-       LLOG_SIZE_ORIG_CTXT,
-       LLOG_SIZE_REPL_CTXT,
-       LLOG_TEST_ORIG_CTXT,
-       LLOG_CHANGELOG_ORIG_CTXT,       /**< changelog generation on mdd */
-       LLOG_CHANGELOG_REPL_CTXT,       /**< changelog access on clients */
-       LLOG_CHANGELOG_USER_ORIG_CTXT,  /**< for multiple changelog consumers */
-       LLOG_AGENT_ORIG_CTXT,           /**< agent requests generation on cdt */
-       LLOG_MAX_CTXTS
-};
-
 struct timeout_item {
         enum timeout_event ti_event;
         cfs_time_t         ti_timeout;
@@ -256,12 +241,12 @@ struct client_obd {
         enum lustre_sec_part     cl_sp_to;
         struct sptlrpc_flavor    cl_flvr_mgc;   /* fixed flavor of mgc->mgs */
 
-        /* the grant values are protected by loi_list_lock below */
-        long                     cl_dirty;         /* all _dirty_ in bytes */
-        long                     cl_dirty_max;     /* allowed w/o rpc */
-        long                     cl_dirty_transit; /* dirty synchronous */
-        long                     cl_avail_grant;   /* bytes of credit for ost */
-        long                     cl_lost_grant;    /* lost credits (trunc) */
+       /* the grant values are protected by loi_list_lock below */
+       long                     cl_dirty_pages;      /* all _dirty_ in pages */
+       long                     cl_dirty_max_pages;  /* allowed w/o rpc */
+       long                     cl_dirty_transit;    /* dirty synchronous */
+       long                     cl_avail_grant;   /* bytes of credit for ost */
+       long                     cl_lost_grant;    /* lost credits (trunc) */
 
        /* since we allocate grant by blocks, we don't know how many grant will
         * be used to add a page into cache. As a solution, we reserve maximum
@@ -479,11 +464,11 @@ struct lmv_obd {
 struct niobuf_local {
        __u64           lnb_file_offset;
        __u32           lnb_page_offset;
-       __u32           len;
-       __u32           flags;
-       struct page     *page;
-       struct dentry   *dentry;
-       int             rc;
+       __u32           lnb_len;
+       __u32           lnb_flags;
+       struct page     *lnb_page;
+       void            *lnb_data;
+       int             lnb_rc;
 };
 
 #define LUSTRE_FLD_NAME         "fld"
@@ -1300,4 +1285,27 @@ static inline int cli_brw_size(struct obd_device *obd)
        return obd->u.cli.cl_max_pages_per_rpc << PAGE_CACHE_SHIFT;
 }
 
+/* when RPC size or the max RPCs in flight is increased, the max dirty pages
+ * of the client should be increased accordingly to avoid sending fragmented
+ * RPCs over the network when the client runs out of the maximum dirty space
+ * when so many RPCs are being generated.
+ */
+static inline void client_adjust_max_dirty(struct client_obd *cli)
+{
+        /* initializing */
+       if (cli->cl_dirty_max_pages <= 0)
+               cli->cl_dirty_max_pages = (OSC_MAX_DIRTY_DEFAULT * 1024 * 1024)
+                                                       >> PAGE_CACHE_SHIFT;
+       else {
+               long dirty_max = cli->cl_max_rpcs_in_flight *
+                                               cli->cl_max_pages_per_rpc;
+
+               if (dirty_max > cli->cl_dirty_max_pages)
+                       cli->cl_dirty_max_pages = dirty_max;
+       }
+
+       if (cli->cl_dirty_max_pages > totalram_pages / 8)
+               cli->cl_dirty_max_pages = totalram_pages / 8;
+}
+
 #endif /* __OBD_H */