@@ -171,6 +171,7 @@ struct dm_writecache {
171
171
bool flush_on_suspend :1 ;
172
172
bool cleaner :1 ;
173
173
bool cleaner_set :1 ;
174
+ bool metadata_only :1 ;
174
175
175
176
unsigned high_wm_percent_value ;
176
177
unsigned low_wm_percent_value ;
@@ -1301,7 +1302,7 @@ static int writecache_map(struct dm_target *ti, struct bio *bio)
1301
1302
writecache_flush (wc );
1302
1303
if (writecache_has_error (wc ))
1303
1304
goto unlock_error ;
1304
- if (unlikely (wc -> cleaner ))
1305
+ if (unlikely (wc -> cleaner ) || unlikely ( wc -> metadata_only ) )
1305
1306
goto unlock_remap_origin ;
1306
1307
goto unlock_submit ;
1307
1308
} else {
@@ -1380,7 +1381,8 @@ static int writecache_map(struct dm_target *ti, struct bio *bio)
1380
1381
}
1381
1382
found_entry = true;
1382
1383
} else {
1383
- if (unlikely (wc -> cleaner ))
1384
+ if (unlikely (wc -> cleaner ) ||
1385
+ (wc -> metadata_only && !(bio -> bi_opf & REQ_META )))
1384
1386
goto direct_write ;
1385
1387
}
1386
1388
e = writecache_pop_from_freelist (wc , (sector_t )- 1 );
@@ -2094,7 +2096,7 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)
2094
2096
struct wc_memory_superblock s ;
2095
2097
2096
2098
static struct dm_arg _args [] = {
2097
- {0 , 16 , "Invalid number of feature args" },
2099
+ {0 , 17 , "Invalid number of feature args" },
2098
2100
};
2099
2101
2100
2102
as .argc = argc ;
@@ -2321,6 +2323,8 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)
2321
2323
wc -> writeback_fua = false;
2322
2324
wc -> writeback_fua_set = true;
2323
2325
} else goto invalid_optional ;
2326
+ } else if (!strcasecmp (string , "metadata_only" )) {
2327
+ wc -> metadata_only = true;
2324
2328
} else {
2325
2329
invalid_optional :
2326
2330
r = - EINVAL ;
@@ -2544,6 +2548,8 @@ static void writecache_status(struct dm_target *ti, status_type_t type,
2544
2548
extra_args ++ ;
2545
2549
if (wc -> writeback_fua_set )
2546
2550
extra_args ++ ;
2551
+ if (wc -> metadata_only )
2552
+ extra_args ++ ;
2547
2553
2548
2554
DMEMIT ("%u" , extra_args );
2549
2555
if (wc -> start_sector_set )
@@ -2564,13 +2570,15 @@ static void writecache_status(struct dm_target *ti, status_type_t type,
2564
2570
DMEMIT (" cleaner" );
2565
2571
if (wc -> writeback_fua_set )
2566
2572
DMEMIT (" %sfua" , wc -> writeback_fua ? "" : "no" );
2573
+ if (wc -> metadata_only )
2574
+ DMEMIT (" metadata_only" );
2567
2575
break ;
2568
2576
}
2569
2577
}
2570
2578
2571
2579
static struct target_type writecache_target = {
2572
2580
.name = "writecache" ,
2573
- .version = {1 , 4 , 0 },
2581
+ .version = {1 , 5 , 0 },
2574
2582
.module = THIS_MODULE ,
2575
2583
.ctr = writecache_ctr ,
2576
2584
.dtr = writecache_dtr ,
0 commit comments