Browse Source

dm cache: 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 cache status if it is set
in the cache metadata.

Also, update cache documentation.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Mike Snitzer 10 years ago
parent
commit
255eac2005
2 changed files with 13 additions and 2 deletions
  1. 6 0
      Documentation/device-mapper/cache.txt
  2. 7 2
      drivers/md/dm-cache-target.c

+ 6 - 0
Documentation/device-mapper/cache.txt

@@ -258,6 +258,12 @@ cache metadata mode      : ro if read-only, rw if read-write
 	no further I/O will be permitted and the status will just
 	no further I/O will be permitted and the status will just
 	contain the string 'Fail'.  The userspace recovery tools
 	contain the string 'Fail'.  The userspace recovery tools
 	should then be used.
 	should then be used.
+needs_check		 : 'needs_check' if set, '-' if not set
+	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
+	cache can be made fully operational again.  '-' indicates
+	needs_check is not set.
 
 
 Messages
 Messages
 --------
 --------

+ 7 - 2
drivers/md/dm-cache-target.c

@@ -3496,7 +3496,7 @@ static void cache_resume(struct dm_target *ti)
  * <#demotions> <#promotions> <#dirty>
  * <#demotions> <#promotions> <#dirty>
  * <#features> <features>*
  * <#features> <features>*
  * <#core args> <core args>
  * <#core args> <core args>
- * <policy name> <#policy args> <policy args>* <cache metadata mode>
+ * <policy name> <#policy args> <policy args>* <cache metadata mode> <needs_check>
  */
  */
 static void cache_status(struct dm_target *ti, status_type_t type,
 static void cache_status(struct dm_target *ti, status_type_t type,
 			 unsigned status_flags, char *result, unsigned maxlen)
 			 unsigned status_flags, char *result, unsigned maxlen)
@@ -3582,6 +3582,11 @@ static void cache_status(struct dm_target *ti, status_type_t type,
 		else
 		else
 			DMEMIT("rw ");
 			DMEMIT("rw ");
 
 
+		if (dm_cache_metadata_needs_check(cache->cmd))
+			DMEMIT("needs_check ");
+		else
+			DMEMIT("- ");
+
 		break;
 		break;
 
 
 	case STATUSTYPE_TABLE:
 	case STATUSTYPE_TABLE:
@@ -3820,7 +3825,7 @@ static void cache_io_hints(struct dm_target *ti, struct queue_limits *limits)
 
 
 static struct target_type cache_target = {
 static struct target_type cache_target = {
 	.name = "cache",
 	.name = "cache",
-	.version = {1, 7, 0},
+	.version = {1, 8, 0},
 	.module = THIS_MODULE,
 	.module = THIS_MODULE,
 	.ctr = cache_ctr,
 	.ctr = cache_ctr,
 	.dtr = cache_dtr,
 	.dtr = cache_dtr,