Commit 97b6f0e7 authored by Mike Snitzer's avatar Mike Snitzer

dm vdo data-vio: rename is_trim flag to is_discard

Eliminate use of "trim" in favor of "discard" since it reflects the
top-level Linux discard primative rather than the ATA specific ditto.
Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
Signed-off-by: default avatarMatthew Sakai <msakai@redhat.com>
parent f7c1c2e0
......@@ -2194,8 +2194,8 @@ static void allocate_block_map_page(struct block_map_zone *zone,
{
int result;
if (!data_vio->write || data_vio->is_trim) {
/* This is a pure read or a trim, so there's nothing left to do here. */
if (!data_vio->write || data_vio->is_discard) {
/* This is a pure read or a discard, so there's nothing left to do here. */
finish_lookup(data_vio, VDO_SUCCESS);
return;
}
......
......@@ -553,7 +553,7 @@ static void launch_bio(struct vdo *vdo, struct data_vio *data_vio, struct bio *b
if (bio_op(bio) == REQ_OP_DISCARD) {
data_vio->remaining_discard = bio->bi_iter.bi_size;
data_vio->write = true;
data_vio->is_trim = true;
data_vio->is_discard = true;
if (data_vio->is_partial) {
vdo_count_bios(&vdo->stats.bios_in_partial, bio);
data_vio->read = true;
......@@ -1990,10 +1990,10 @@ static void handle_allocation_error(struct vdo_completion *completion)
handle_data_vio_error(completion);
}
static int assert_is_trim(struct data_vio *data_vio)
static int assert_is_discard(struct data_vio *data_vio)
{
int result = ASSERT(data_vio->is_trim,
"data_vio with no block map page is a trim");
int result = ASSERT(data_vio->is_discard,
"data_vio with no block map page is a discard");
return ((result == VDO_SUCCESS) ? result : VDO_READ_ONLY);
}
......@@ -2019,19 +2019,19 @@ void continue_data_vio_with_block_map_slot(struct vdo_completion *completion)
if (data_vio->tree_lock.tree_slots[0].block_map_slot.pbn == VDO_ZERO_BLOCK) {
/*
* This is a trim for a block on a block map page which has not been allocated, so
* This is a discard for a block on a block map page which has not been allocated, so
* there's nothing more we need to do.
*/
completion->callback = complete_data_vio;
continue_data_vio_with_error(data_vio, assert_is_trim(data_vio));
continue_data_vio_with_error(data_vio, assert_is_discard(data_vio));
return;
}
/*
* We need an allocation if this is neither a full-block trim nor a
* We need an allocation if this is neither a full-block discard nor a
* full-block zero write.
*/
if (!data_vio->is_zero && (!data_vio->is_trim || data_vio->is_partial)) {
if (!data_vio->is_zero && (!data_vio->is_discard || data_vio->is_partial)) {
data_vio_allocate_data_block(data_vio, VIO_WRITE_LOCK, allocate_block,
handle_allocation_error);
return;
......
......@@ -199,7 +199,7 @@ struct data_vio {
u16 write : 1;
u16 fua : 1;
u16 is_zero : 1;
u16 is_trim : 1;
u16 is_discard : 1;
u16 is_partial : 1;
u16 is_duplicate : 1;
u16 first_reference_operation_complete : 1;
......
......@@ -144,7 +144,7 @@ struct block_map_slot {
/*
* Four bits of each five-byte block map entry contain a mapping state value used to distinguish
* unmapped or trimmed logical blocks (which are treated as mapped to the zero block) from entries
* unmapped or discarded logical blocks (which are treated as mapped to the zero block) from entries
* that have been mapped to a physical block, including the zero block.
*
* FIXME: these should maybe be defines.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment