Skip to content

Commit 1f4e0ff

Browse files
committed
dm thin: commit before gathering status
Commit outstanding metadata before returning the status for a dm thin pool so that the numbers reported are as up-to-date as possible. The commit is not performed if the device is suspended or if the DM_NOFLUSH_FLAG is supplied by userspace and passed to the target through a new 'status_flags' parameter in the target's dm_status_fn. The userspace dmsetup tool will support the --noflush flag with the 'dmsetup status' and 'dmsetup wait' commands from version 1.02.76 onwards. Tested-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
1 parent e49e582 commit 1f4e0ff

15 files changed

Lines changed: 35 additions & 20 deletions

File tree

‎drivers/md/dm-crypt.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1733,7 +1733,7 @@ static int crypt_map(struct dm_target *ti, struct bio *bio,
17331733
}
17341734

17351735
static int crypt_status(struct dm_target *ti, status_type_t type,
1736-
char *result, unsigned int maxlen)
1736+
unsigned status_flags, char *result, unsigned maxlen)
17371737
{
17381738
struct crypt_config *cc = ti->private;
17391739
unsigned int sz = 0;

‎drivers/md/dm-delay.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ static int delay_map(struct dm_target *ti, struct bio *bio,
295295
}
296296

297297
static int delay_status(struct dm_target *ti, status_type_t type,
298-
char *result, unsigned maxlen)
298+
unsigned status_flags, char *result, unsigned maxlen)
299299
{
300300
struct delay_c *dc = ti->private;
301301
int sz = 0;

‎drivers/md/dm-flakey.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ static int flakey_end_io(struct dm_target *ti, struct bio *bio,
333333
}
334334

335335
static int flakey_status(struct dm_target *ti, status_type_t type,
336-
char *result, unsigned int maxlen)
336+
unsigned status_flags, char *result, unsigned maxlen)
337337
{
338338
unsigned sz = 0;
339339
struct flakey_c *fc = ti->private;

‎drivers/md/dm-ioctl.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1054,6 +1054,7 @@ static void retrieve_status(struct dm_table *table,
10541054
char *outbuf, *outptr;
10551055
status_type_t type;
10561056
size_t remaining, len, used = 0;
1057+
unsigned status_flags = 0;
10571058

10581059
outptr = outbuf = get_result_buffer(param, param_size, &len);
10591060

@@ -1090,7 +1091,9 @@ static void retrieve_status(struct dm_table *table,
10901091

10911092
/* Get the status/table string from the target driver */
10921093
if (ti->type->status) {
1093-
if (ti->type->status(ti, type, outptr, remaining)) {
1094+
if (param->flags & DM_NOFLUSH_FLAG)
1095+
status_flags |= DM_STATUS_NOFLUSH_FLAG;
1096+
if (ti->type->status(ti, type, status_flags, outptr, remaining)) {
10941097
param->flags |= DM_BUFFER_FULL_FLAG;
10951098
break;
10961099
}

‎drivers/md/dm-linear.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static int linear_map(struct dm_target *ti, struct bio *bio,
9696
}
9797

9898
static int linear_status(struct dm_target *ti, status_type_t type,
99-
char *result, unsigned int maxlen)
99+
unsigned status_flags, char *result, unsigned maxlen)
100100
{
101101
struct linear_c *lc = (struct linear_c *) ti->private;
102102

‎drivers/md/dm-mpath.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1378,7 +1378,7 @@ static void multipath_resume(struct dm_target *ti)
13781378
* num_paths num_selector_args [path_dev [selector_args]* ]+ ]+
13791379
*/
13801380
static int multipath_status(struct dm_target *ti, status_type_t type,
1381-
char *result, unsigned int maxlen)
1381+
unsigned status_flags, char *result, unsigned maxlen)
13821382
{
13831383
int sz = 0;
13841384
unsigned long flags;

‎drivers/md/dm-raid.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ static int raid_map(struct dm_target *ti, struct bio *bio, union map_info *map_c
10811081
}
10821082

10831083
static int raid_status(struct dm_target *ti, status_type_t type,
1084-
char *result, unsigned maxlen)
1084+
unsigned status_flags, char *result, unsigned maxlen)
10851085
{
10861086
struct raid_set *rs = ti->private;
10871087
unsigned raid_param_cnt = 1; /* at least 1 for chunksize */

‎drivers/md/dm-raid1.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1367,7 +1367,7 @@ static char device_status_char(struct mirror *m)
13671367

13681368

13691369
static int mirror_status(struct dm_target *ti, status_type_t type,
1370-
char *result, unsigned int maxlen)
1370+
unsigned status_flags, char *result, unsigned maxlen)
13711371
{
13721372
unsigned int m, sz = 0;
13731373
struct mirror_set *ms = (struct mirror_set *) ti->private;

‎drivers/md/dm-snap.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1849,7 +1849,7 @@ static void snapshot_merge_resume(struct dm_target *ti)
18491849
}
18501850

18511851
static int snapshot_status(struct dm_target *ti, status_type_t type,
1852-
char *result, unsigned int maxlen)
1852+
unsigned status_flags, char *result, unsigned maxlen)
18531853
{
18541854
unsigned sz = 0;
18551855
struct dm_snapshot *snap = ti->private;
@@ -2151,8 +2151,8 @@ static void origin_resume(struct dm_target *ti)
21512151
ti->max_io_len = get_origin_minimum_chunksize(dev->bdev);
21522152
}
21532153

2154-
static int origin_status(struct dm_target *ti, status_type_t type, char *result,
2155-
unsigned int maxlen)
2154+
static int origin_status(struct dm_target *ti, status_type_t type,
2155+
unsigned status_flags, char *result, unsigned maxlen)
21562156
{
21572157
struct dm_dev *dev = ti->private;
21582158

‎drivers/md/dm-stripe.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,8 @@ static int stripe_map(struct dm_target *ti, struct bio *bio,
311311
*
312312
*/
313313

314-
static int stripe_status(struct dm_target *ti,
315-
status_type_t type, char *result, unsigned int maxlen)
314+
static int stripe_status(struct dm_target *ti, status_type_t type,
315+
unsigned status_flags, char *result, unsigned maxlen)
316316
{
317317
struct stripe_c *sc = (struct stripe_c *) ti->private;
318318
char buffer[sc->stripes + 1];

0 commit comments

Comments
 (0)