Whamcloud - gitweb
silence can_merge_pages() about OBD_BRW_SYNC
authornikita <nikita>
Tue, 17 Feb 2009 18:50:38 +0000 (18:50 +0000)
committernikita <nikita>
Tue, 17 Feb 2009 18:50:38 +0000 (18:50 +0000)
OBD_BRW_SYNC means that a page is a part of a synchronous transfer and hence does not consume
grant. It is fine to mix pages with and without OBD_BRW_SYNC in the same brw vector. Comment
OBD_BRW_SYNC and update can_merge_pages().

(Also add sanity checks to osc_page_transfer_add(), while we are here.)

b=18393
i=alexey.lyashkov@sun.com
i=adilger@sun.com

lustre/include/lustre/lustre_idl.h
lustre/osc/osc_page.c
lustre/osc/osc_request.c

index 5ea31cf..24091b5 100644 (file)
@@ -1067,7 +1067,9 @@ extern void lustre_swab_obd_statfs (struct obd_statfs *os);
 #define OBD_BRW_READ            0x01
 #define OBD_BRW_WRITE           0x02
 #define OBD_BRW_RWMASK          (OBD_BRW_READ | OBD_BRW_WRITE)
-#define OBD_BRW_SYNC            0x08
+#define OBD_BRW_SYNC            0x08 /* this page is a part of synchronous
+                                      * transfer and is not accounted in
+                                      * the grant. */
 #define OBD_BRW_CHECK           0x10
 #define OBD_BRW_FROM_GRANT      0x20 /* the osc manages this under llite */
 #define OBD_BRW_GRANTED         0x40 /* the ost manages this */
index a583eef..e72e6d2 100644 (file)
@@ -164,6 +164,8 @@ static void osc_page_transfer_add(const struct lu_env *env,
 {
         struct osc_object *obj;
 
+        LINVRNT(cl_page_is_vmlocked(env, opg->ops_cl.cpl_page));
+
         obj = cl2osc(opg->ops_cl.cpl_obj);
         spin_lock(&obj->oo_seatbelt);
         list_add(&opg->ops_inflight, &obj->oo_inflight[crt]);
@@ -395,6 +397,7 @@ static int osc_completion(const struct lu_env *env,
         enum cl_req_type crt;
 
         LINVRNT(osc_page_protected(env, opg, CLM_READ, 1));
+        LINVRNT(cl_page_is_vmlocked(env, page));
 
         ENTRY;
 
@@ -495,6 +498,10 @@ struct cl_page *osc_page_init(const struct lu_env *env,
         return ERR_PTR(result);
 }
 
+/**
+ * Helper function called by osc_io_submit() for every page in an immediate
+ * transfer (i.e., transferred synchronously).
+ */
 void osc_io_submit_page(const struct lu_env *env,
                         struct osc_io *oio, struct osc_page *opg,
                         enum cl_req_type crt)
index fa7d01f..3cbe9c0 100644 (file)
@@ -1002,7 +1002,8 @@ static int check_write_rcs(struct ptlrpc_request *req,
 static inline int can_merge_pages(struct brw_page *p1, struct brw_page *p2)
 {
         if (p1->flag != p2->flag) {
-                unsigned mask = ~(OBD_BRW_FROM_GRANT|OBD_BRW_NOCACHE);
+                unsigned mask = ~(OBD_BRW_FROM_GRANT|
+                                  OBD_BRW_NOCACHE|OBD_BRW_SYNC);
 
                 /* warn if we try to combine flags that we don't know to be
                  * safe to combine */