1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

thin: lvcreate --discards

This commit is contained in:
Zdenek Kabelac 2012-08-09 12:20:47 +02:00
parent 80bf4eb035
commit 54c24193f5
5 changed files with 15 additions and 1 deletions

View File

@ -3,6 +3,7 @@ Version 2.02.98
Use 'ignore' discards for thin metadata created with older versions.
Use proper condition to check for unsupported discards settings.
Update lvs manpage with discards (2.02.97).
Add support for lvcreate --discards.
Version 2.02.97 - 7th August 2012
=================================

View File

@ -4423,6 +4423,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
if (seg_is_thin_pool(lp)) {
first_seg(lv)->zero_new_blocks = lp->zero ? 1 : 0;
first_seg(lv)->chunk_size = lp->chunk_size;
first_seg(lv)->discards = lp->discards;
/* FIXME: use lowwatermark via lvm.conf global for all thinpools ? */
first_seg(lv)->low_water_mark = 0;
} else if (seg_is_thin_volume(lp)) {

View File

@ -592,6 +592,7 @@ struct lvcreate_params {
int log_count; /* mirror */
int nosync; /* mirror */
activation_change_t activate; /* non-snapshot, non-mirror */
thin_discards_t discards; /* thin */
const char *origin; /* snap */
const char *pool; /* thin */

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
* Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
* Copyright (C) 2004-2012 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@ -180,6 +180,10 @@ xx(lvcreate,
"\t[-p|--permission {r|rw}]\n"
"\t[-r|--readahead ReadAheadSectors|auto|none]\n"
"\t[-R|--regionsize MirrorLogRegionSize]\n"
"\t[-T|--thin [-c|--chunksize ChunkSize]\n"
"\t [--discards {ignore|nopassdown|passdown}]\n"
"\t [--poolmetadatasize MetadataSize[bBsSkKmMgG]]]\n"
"\t[--thinpool ThinPoolLogicalVolume{Name|Path}]\n"
"\t[-t|--test]\n"
"\t[--type VolumeType]\n"
"\t[-v|--verbose]\n"

View File

@ -797,6 +797,13 @@ static int _lvcreate_params(struct lvcreate_params *lp,
!_read_raid_params(lp, cmd))
return_0;
if (lp->create_thin_pool) {
lp->discards = arg_uint_value(cmd, discards_ARG, THIN_DISCARDS_PASSDOWN);
} else if (arg_count(cmd, discards_ARG)) {
log_error("--discards is only available for thin pool creation.");
return 0;
}
if (lp->snapshot && lp->thin && arg_count(cmd, chunksize_ARG))
log_warn("WARNING: Ignoring --chunksize with thin snapshots.");
else if (lp->thin && !lp->create_thin_pool) {