]> sourceware.org Git - lvm2.git/commitdiff
thin: lvcreate --discards
authorZdenek Kabelac <zkabelac@redhat.com>
Thu, 9 Aug 2012 10:20:47 +0000 (12:20 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Thu, 9 Aug 2012 14:25:52 +0000 (16:25 +0200)
WHATS_NEW
lib/metadata/lv_manip.c
lib/metadata/metadata-exported.h
tools/commands.h
tools/lvcreate.c

index a2a92855239cbf483148424a5681dc6f1d2949d0..dcd51ffa16fe05f09ecf59b0146517b09d96f5f9 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -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
 =================================
index daa90da97194f5e4ae804278f1cf54cd0496782c..70b984e8415ebfe0eac01ca2fda205dbcd3cd725 100644 (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)) {
index 74edb58b02dfad93c2589ab7cb49fd2f06a781be..f46fccc638473e55a5f3941c97dbff73adbecb6e 100644 (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 */
index 2a4404eaff06dabe3f2d490c6638fb7981b67533..602fe81ee2939b8f6c140774a0ca4468303f1c67 100644 (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"
index da2b925ed51dcf6c5d5ac4d35b5836abf1769188..6aecf1d09d969057859c7fb2a6971d266f2bab6f 100644 (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) {
This page took 0.062163 seconds and 5 git commands to generate.