Whamcloud - gitweb
b=22755 more shrink grant fixes
authorCliff White <cliff.white@oracle.com>
Tue, 5 Oct 2010 18:08:32 +0000 (11:08 -0700)
committerVitaly Fertman <vitaly.fertman@sun.com>
Thu, 7 Oct 2010 22:26:16 +0000 (02:26 +0400)
i=di.wang
i=oleg.drokin

- 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);
- OBD_FL_MMAP is added 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 45bf870..268dec1 100644 (file)
@@ -109,7 +109,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;
 
@@ -401,7 +401,8 @@ static int filter_preprw_read(int cmd, struct obd_export *exp, struct obdo *oa,
                 cfs_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;
                 cfs_spin_unlock(&obd->obd_osfs_lock);
         }
@@ -767,7 +768,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 f4c5dd0..17f088c 100644 (file)
@@ -966,6 +966,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);
 }
@@ -1016,6 +1020,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 9898ae9..e819c88 100644 (file)
@@ -661,6 +661,7 @@ void lustre_assert_wire_constants(void)
         CLASSERT(OBD_FL_CKSUM_CRC32 == 4096);
         CLASSERT(OBD_FL_CKSUM_ADLER == 8192);
         CLASSERT(OBD_FL_SHRINK_GRANT == 131072);
+        CLASSERT(OBD_FL_MMAP == (0x00040000));
         CLASSERT(OBD_CKSUM_CRC32 == 1);
         CLASSERT(OBD_CKSUM_ADLER == 2);
 
index 09da35d..d574047 100644 (file)
@@ -308,6 +308,7 @@ check_obdo(void)
         CHECK_CVALUE(OBD_FL_CKSUM_CRC32);
         CHECK_CVALUE(OBD_FL_CKSUM_ADLER);
         CHECK_CVALUE(OBD_FL_SHRINK_GRANT);
+        CHECK_CDEFINE(OBD_FL_MMAP);
         CHECK_CVALUE(OBD_CKSUM_CRC32);
         CHECK_CVALUE(OBD_CKSUM_ADLER);
 }
index 2a4a52a..7da51fd 100644 (file)
@@ -658,6 +658,7 @@ void lustre_assert_wire_constants(void)
         CLASSERT(OBD_FL_CKSUM_CRC32 == 4096);
         CLASSERT(OBD_FL_CKSUM_ADLER == 8192);
         CLASSERT(OBD_FL_SHRINK_GRANT == 131072);
+        CLASSERT(OBD_FL_MMAP == (0x00040000));
         CLASSERT(OBD_CKSUM_CRC32 == 1);
         CLASSERT(OBD_CKSUM_ADLER == 2);