Whamcloud - gitweb
b=22755 more grant fixes
authorJohann Lombardi <johann@sun.com>
Wed, 23 Jun 2010 09:24:43 +0000 (11:24 +0200)
committerJohann Lombardi <johann@sun.com>
Wed, 23 Jun 2010 09:24:43 +0000 (11:24 +0200)
i=oleg
i=wangdi

- filter_preprw_write() should check for OBD_FL_SHRINK_GRANT in o_flags instead of
  o_valid;
- The grant shrink code should not use o_flags w/o setting OBD_MD_FLFLAGS since
  o_flags can be legitimately reset if OBD_MD_FLFLAGS (e.g. it is done in the
  checksum code);
- add OBD_FL_MMAP to wiretest & wirecheck

lustre/obdfilter/filter_io.c
lustre/osc/osc_request.c
lustre/ptlrpc/wiretest.c
lustre/utils/wirecheck.c
lustre/utils/wiretest.c

index 778caf2..a3965bd 100644 (file)
@@ -108,7 +108,7 @@ void filter_grant_incoming(struct obd_export *exp, struct obdo *oa)
         fed->fed_grant -= oa->o_dropped;
         fed->fed_dirty = oa->o_dirty;
 
-        if (oa->o_flags & OBD_FL_SHRINK_GRANT) {
+        if (oa->o_valid & OBD_MD_FLFLAGS && oa->o_flags & OBD_FL_SHRINK_GRANT) {
                 obd_size left_space = filter_grant_space_left(exp);
                 struct filter_obd *filter = &exp->exp_obd->u.filter;
 
@@ -395,7 +395,8 @@ static int filter_preprw_read(int cmd, struct obd_export *exp, struct obdo *oa,
                 spin_lock(&obd->obd_osfs_lock);
                 filter_grant_incoming(exp, oa);
 
-                if (!(oa->o_flags & OBD_FL_SHRINK_GRANT))
+                if (!(oa->o_valid & OBD_MD_FLFLAGS) ||
+                    !(oa->o_flags & OBD_FL_SHRINK_GRANT))
                         oa->o_grant = 0;
                 spin_unlock(&obd->obd_osfs_lock);
         }
@@ -749,7 +750,9 @@ static int filter_preprw_write(int cmd, struct obd_export *exp, struct obdo *oa,
          * so no sense in allocating it some more. We either return the grant
          * back to the client if we have plenty of space or we don't return
          * anything if we are short. This was decided in filter_grant_incoming*/
-        if (oa->o_valid & OBD_MD_FLGRANT &&!(oa->o_valid & OBD_FL_SHRINK_GRANT))
+        if ((oa->o_valid & OBD_MD_FLGRANT) &&
+            (!(oa->o_valid & OBD_MD_FLFLAGS) ||
+             !(oa->o_flags & OBD_FL_SHRINK_GRANT)))
                 oa->o_grant = filter_grant(exp, oa->o_grant, oa->o_undirty,
                                            left, 1);
 
index 1adf2d9..2742590 100644 (file)
@@ -890,6 +890,10 @@ static void osc_shrink_grant_local(struct client_obd *cli, struct obdo *oa)
         oa->o_grant = cli->cl_avail_grant / 4;
         cli->cl_avail_grant -= oa->o_grant;
         client_obd_list_unlock(&cli->cl_loi_list_lock);
+        if (!(oa->o_valid & OBD_MD_FLFLAGS)) {
+                oa->o_valid |= OBD_MD_FLFLAGS;
+                oa->o_flags = 0;
+        }
         oa->o_flags |= OBD_FL_SHRINK_GRANT;
         osc_update_next_shrink(cli);
 }
@@ -940,6 +944,10 @@ int osc_shrink_grant_to_target(struct client_obd *cli, long target)
         body->oa.o_grant = cli->cl_avail_grant - target;
         cli->cl_avail_grant = target;
         client_obd_list_unlock(&cli->cl_loi_list_lock);
+        if (!(body->oa.o_valid & OBD_MD_FLFLAGS)) {
+                body->oa.o_valid |= OBD_MD_FLFLAGS;
+                body->oa.o_flags = 0;
+        }
         body->oa.o_flags |= OBD_FL_SHRINK_GRANT;
         osc_update_next_shrink(cli);
 
index 20acff7..3039c11 100644 (file)
@@ -723,6 +723,7 @@ void lustre_assert_wire_constants(void)
         CLASSERT(OBD_FL_CKSUM_CRC32 == (0x00001000));
         CLASSERT(OBD_FL_CKSUM_ADLER == (0x00002000));
         CLASSERT(OBD_FL_SHRINK_GRANT == (0x00020000));
+        CLASSERT(OBD_FL_MMAP == (0x00040000));
         CLASSERT(OBD_CKSUM_CRC32 == 1);
         CLASSERT(OBD_CKSUM_ADLER == 2);
 
index 47bf94b..282c72b 100644 (file)
@@ -330,6 +330,7 @@ check_obdo(void)
         CHECK_CDEFINE(OBD_FL_CKSUM_CRC32);
         CHECK_CDEFINE(OBD_FL_CKSUM_ADLER);
         CHECK_CDEFINE(OBD_FL_SHRINK_GRANT);
+        CHECK_CDEFINE(OBD_FL_MMAP);
         CHECK_CVALUE(OBD_CKSUM_CRC32);
         CHECK_CVALUE(OBD_CKSUM_ADLER);
 }
index 1585b04..4655ca0 100644 (file)
@@ -721,6 +721,7 @@ void lustre_assert_wire_constants(void)
         CLASSERT(OBD_FL_CKSUM_CRC32 == (0x00001000));
         CLASSERT(OBD_FL_CKSUM_ADLER == (0x00002000));
         CLASSERT(OBD_FL_SHRINK_GRANT == (0x00020000));
+        CLASSERT(OBD_FL_MMAP == (0x00040000));
         CLASSERT(OBD_CKSUM_CRC32 == 1);
         CLASSERT(OBD_CKSUM_ADLER == 2);