--- ./source/private_module/ckg/ckg_format/ckg_format.c	2018-04-19 06:34:35.000000000 +0000
+++ ./source/private_module/ckg/ckg_format/ckg_format.c.hotpatch	2021-02-24 04:44:43.000000000 +0000
@@ -4283,25 +4283,24 @@
 {
     return (POOL_FORMAT_SERVICE_STOPPED == g_PoolFormatServiceStatus[v_uiPoolId]);
 }
-
+uint32_t g_formatLogWaterLevel = 3;
+uint32_t getFmtLogWaterLevel(poolid_t poolId);
 /**************************************************************************
      : ѯPOOL״̬Ƿ
  : poolid_t poolId
  :
  ֵ  :
-     :
 **************************************************************************/
 CKG_PRIVATE bool fmtIsPoolAvailable(poolid_t poolId)
 {
     int32_t ret;
     HEALTH_STATUS_E healthStatus;
     RUNNING_STATUS_E runningStatus;
-    
+    uint32_t tierRunningStatus;
     if (B_FALSE == IS_POOL_EXIST(poolId)) 
     {
         return B_FALSE;
-    }
-    
+    }    
     if (B_FALSE == isDiskPoolStartBGR(poolId)) 
     {
         return B_FALSE;
@@ -4311,25 +4310,26 @@
     {
         return B_FALSE;
     }
-
-    /* Ϊ˲Ӱعܣиʽ 
-    ȷжpool״̬ΪعԤأpoolfaultʽ */
+    tierRunningStatus = getDiskPoolTierRunningStatus(poolId, TIER_TYPE_SSD);
+    if (RUNNING_STATUS_LEVELING == runningStatus && HEALTH_STATUS_FAULT != healthStatus && tierRunningStatus == RUNNING_STATUS_LEVELING)
+    {
+        return B_TRUE;
+    }
+    if (getFmtLogWaterLevel(poolId) > g_formatLogWaterLevel)
+    {
+        DBG_LogDebug(0, "Disklog water leve > 50");
+        return B_TRUE;
+    }
     if ((HEALTH_STATUS_FAULT == healthStatus)
         || (RUNNING_STATUS_ONLINE != runningStatus))
     {
         return B_FALSE;
-    }
-    
+    }    
     return B_TRUE;
 }
 
 /**************************************************************************
      : жdisk domainǷҪʽ
- : poolid_t uiPoolId
- : 
- ֵ  : return B_FALSE;
-           return B_TRUE;
-     :
 **************************************************************************/
 CKG_PRIVATE uint32_t fmtPoolNeedFormatDiskNum(poolid_t uiPoolId)
 {
--- ./source/private_module/ckg/disklog/disk_log_action.c	2018-04-20 08:53:49.000000000 +0000
+++ ./source/private_module/ckg/disklog/disk_log_action.c.hotpatch	2021-02-24 04:44:43.000000000 +0000
@@ -4453,3 +4453,26 @@
     return;
 }                                                                                                                                                                                  
 
+uint32_t getFmtLogWaterLevel(poolid_t poolId)
+{
+    DISKLOG_TOKEN_BUCKET_S *fmtTokenBucket = NULL;
+    uint32_t res = 0;
+    int32_t i;
+    
+    if (!isDiskPoolWorkNode(poolId))
+    {
+        return 0;
+    }
+
+    for (i = 0; i < DISKLOG_MAX_OBJ_PER_TYPE; i++)
+    {
+        fmtTokenBucket = &g_fmtLogTokenBuckets[poolId][i];
+        if (fmtTokenBucket->ctrlLevel >= res)
+        {
+            res = fmtTokenBucket->ctrlLevel;
+        }
+    }
+
+    return res;
+}
+
--- ./source/private_module/ckg/disklog/disk_log_debug.c	2018-04-21 12:37:43.000000000 +0000
+++ ./source/private_module/ckg/disklog/disk_log_debug.c.hotpatch	2021-02-24 04:44:43.000000000 +0000
@@ -485,12 +485,12 @@
 
     return RETURN_OK;
 }
+extern uint32_t g_formatLogWaterLevel;
 /**************************************************************************
 *     : ȡDISK ID,CKG ID,LBA,LEN
 * : 
 * : 
 * ֵ  : 
-*     : 
 **************************************************************************/
 int32_t deldiskLogTestGetParam(int32_t argc, char *argv[], poolid_t *poolId,
                                uint64_t *ckgObjId, diskid_t *diskId, uint32_t *deltype,
@@ -498,8 +498,8 @@
 {
     int32_t result = RETURN_OK;
     DBG_OPT_S opt; 
-
-    while ((result = DBG_GetOpt(argc - 1, &argv[1], "p:c:d:i:b:l:t:",  &opt)) != -1)
+    uint32_t waterLevel = 0;
+    while ((result = DBG_GetOpt(argc - 1, &argv[1], "p:c:d:i:b:l:t:w:",  &opt)) != -1)
     {
         if ('p' == result)
         {
@@ -520,25 +520,20 @@
         else if ('b' == result)
         {
             *lba = LVOS_StrToU64(opt.szOptArg);
-            /* ·LBA4K,h00219486 ,2012.12.7 begin */
             if (0 != ((*lba)% 8))
             {
                 DBG_ShowUsageAndErrMsg("please input len : align by 4K");
                 return RETURN_ERROR;
-            }
-            /* ·LBA4K,h00219486 ,2012.12.7 end */
-            
+            }           
         }
         else if ('l' == result)
         {
             *len = LVOS_StrToU64(opt.szOptArg);
-            /* ·LBA4K,h00219486 ,2012.12.7 begin */
             if (0 != ((*len)% 8))
             {
                 DBG_ShowUsageAndErrMsg("please input len : align by 4K");
                 return RETURN_ERROR;
             }
-            /* ·LBA4K,h00219486 ,2012.12.7 end */
         }
         else if ('t' == result)
         {
@@ -547,16 +542,21 @@
                 return RETURN_ERROR;
             }
         }
+        else if ('w' == result)
+        {
+            waterLevel = (uint32_t)LVOS_StrToU64(opt.szOptArg);            
+            DBG_Print("Set format log water level(from %u, to %u) succeed.\n", g_formatLogWaterLevel, waterLevel);
+            g_formatLogWaterLevel = waterLevel ;
+            return RETURN_OK;
+        }
         else
         {
             DBG_ShowUsageAndErrMsg("%s", opt.szErrMsg);
             return RETURN_ERROR;
         }
     }
-
     return RETURN_OK;
 }
-
 /**************************************************************************
      :  ʾеDISK LOG
  :  
@@ -2722,11 +2722,11 @@
     countDisklogWaitQueryLock(&g_diskLogQueryReqLimitList, &commonIoNum);
  
     spin_unlock(&g_diskLogQueryLimitLock);
-
     DBG_Print("--------------------disklog state -------------------------------\n");
     DBG_Print("\tfly query lock num:\t%d\n", atomic_read(&g_diskLogFlyQReqNum));
     DBG_Print("\twait query lock num(limit: %d):\t%d\n", g_diskLogQueryCtrlLimit, commonIoNum);
     DBG_Print("------------------------------------------------------------\n");
+    diskLogDebugDel(argc, argv);
     return;
 }
 
