Whamcloud - gitweb
LU-2087 ofd: refresh blocks in lvb from rpc
authorAlex Zhuravlev <alexey.zhuravlev@intel.com>
Thu, 4 Oct 2012 10:51:24 +0000 (14:51 +0400)
committerOleg Drokin <green@whamcloud.com>
Fri, 5 Oct 2012 15:19:56 +0000 (11:19 -0400)
like obdfilter does. let blocks only increase unless
specified with the flag. this should fix sanityn/4.

Signed-off-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Change-Id: I85bf45f091637faf39c65e0acf331f37dab7af7e
Reviewed-on: http://review.whamcloud.com/4180
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Hudson
Reviewed-by: wangdi <di.wang@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>
lustre/ofd/ofd_lvb.c

index ae80fdb..2e201cb 100644 (file)
@@ -186,6 +186,12 @@ static int ofd_lvbo_update(struct ldlm_resource *res,
                               lvb->lvb_ctime, rpc_lvb->lvb_ctime);
                        lvb->lvb_ctime = rpc_lvb->lvb_ctime;
                }
+               if (rpc_lvb->lvb_blocks > lvb->lvb_blocks || !increase_only) {
+                       CDEBUG(D_DLMTRACE, "res: "LPU64" updating lvb blocks: "
+                              LPU64" -> "LPU64"\n", res->lr_name.name[0],
+                              lvb->lvb_blocks, rpc_lvb->lvb_blocks);
+                       lvb->lvb_blocks = rpc_lvb->lvb_blocks;
+               }
                unlock_res(res);
        }
 
@@ -226,7 +232,7 @@ disk_update:
                       lvb->lvb_ctime, info->fti_attr.la_ctime);
                lvb->lvb_ctime = info->fti_attr.la_ctime;
        }
-       if (lvb->lvb_blocks != info->fti_attr.la_blocks) {
+       if (info->fti_attr.la_blocks > lvb->lvb_blocks || !increase_only) {
                CDEBUG(D_DLMTRACE,"res: "LPU64" updating lvb blocks from disk: "
                       LPU64" -> %llu\n", res->lr_name.name[0],
                       lvb->lvb_blocks,