瀏覽代碼

dm thin: display 'needs_check' in status if it is set

There is currently no way to see that the needs_check flag has been set
in the metadata.  Display 'needs_check' in the thin-pool status if it is
set in the thinp metadata.

Also, update thinp documentation.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Mike Snitzer 10 年之前
父節點
當前提交
e4c78e210d
共有 2 個文件被更改,包括 16 次插入3 次删除
  1. 8 1
      Documentation/device-mapper/thin-provisioning.txt
  2. 8 2
      drivers/md/dm-thin.c

+ 8 - 1
Documentation/device-mapper/thin-provisioning.txt

@@ -296,7 +296,7 @@ ii) Status
 	underlying device.  When this is enabled when loading the table,
 	underlying device.  When this is enabled when loading the table,
 	it can get disabled if the underlying device doesn't support it.
 	it can get disabled if the underlying device doesn't support it.
 
 
-    ro|rw
+    ro|rw|out_of_data_space
 	If the pool encounters certain types of device failures it will
 	If the pool encounters certain types of device failures it will
 	drop into a read-only metadata mode in which no changes to
 	drop into a read-only metadata mode in which no changes to
 	the pool metadata (like allocating new blocks) are permitted.
 	the pool metadata (like allocating new blocks) are permitted.
@@ -314,6 +314,13 @@ ii) Status
 	module parameter can be used to change this timeout -- it
 	module parameter can be used to change this timeout -- it
 	defaults to 60 seconds but may be disabled using a value of 0.
 	defaults to 60 seconds but may be disabled using a value of 0.
 
 
+    needs_check
+	A metadata operation has failed, resulting in the needs_check
+	flag being set in the metadata's superblock.  The metadata
+	device must be deactivated and checked/repaired before the
+	thin-pool can be made fully operational again.  '-' indicates
+	needs_check is not set.
+
 iii) Messages
 iii) Messages
 
 
     create_thin <dev id>
     create_thin <dev id>

+ 8 - 2
drivers/md/dm-thin.c

@@ -3738,6 +3738,7 @@ static void emit_flags(struct pool_features *pf, char *result,
  * Status line is:
  * Status line is:
  *    <transaction id> <used metadata sectors>/<total metadata sectors>
  *    <transaction id> <used metadata sectors>/<total metadata sectors>
  *    <used data sectors>/<total data sectors> <held metadata root>
  *    <used data sectors>/<total data sectors> <held metadata root>
+ *    <pool mode> <discard config> <no space config> <needs_check>
  */
  */
 static void pool_status(struct dm_target *ti, status_type_t type,
 static void pool_status(struct dm_target *ti, status_type_t type,
 			unsigned status_flags, char *result, unsigned maxlen)
 			unsigned status_flags, char *result, unsigned maxlen)
@@ -3839,6 +3840,11 @@ static void pool_status(struct dm_target *ti, status_type_t type,
 		else
 		else
 			DMEMIT("queue_if_no_space ");
 			DMEMIT("queue_if_no_space ");
 
 
+		if (dm_pool_metadata_needs_check(pool->pmd))
+			DMEMIT("needs_check ");
+		else
+			DMEMIT("- ");
+
 		break;
 		break;
 
 
 	case STATUSTYPE_TABLE:
 	case STATUSTYPE_TABLE:
@@ -3942,7 +3948,7 @@ static struct target_type pool_target = {
 	.name = "thin-pool",
 	.name = "thin-pool",
 	.features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE |
 	.features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE |
 		    DM_TARGET_IMMUTABLE,
 		    DM_TARGET_IMMUTABLE,
-	.version = {1, 15, 0},
+	.version = {1, 16, 0},
 	.module = THIS_MODULE,
 	.module = THIS_MODULE,
 	.ctr = pool_ctr,
 	.ctr = pool_ctr,
 	.dtr = pool_dtr,
 	.dtr = pool_dtr,
@@ -4329,7 +4335,7 @@ static void thin_io_hints(struct dm_target *ti, struct queue_limits *limits)
 
 
 static struct target_type thin_target = {
 static struct target_type thin_target = {
 	.name = "thin",
 	.name = "thin",
-	.version = {1, 15, 0},
+	.version = {1, 16, 0},
 	.module	= THIS_MODULE,
 	.module	= THIS_MODULE,
 	.ctr = thin_ctr,
 	.ctr = thin_ctr,
 	.dtr = thin_dtr,
 	.dtr = thin_dtr,