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
=================================
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)) {
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 */
/*
* 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.
*
"\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"
!_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) {