master - cache: Add functions that create/remove cache LVs
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b94a3ee9f644e6be6f2f70dacefef0f606e2eaa5 Commit: b94a3ee9f644e6be6f2f70dacefef0f606e2eaa5 Parent: ef6c5795a0b0502b5ef984233fbeb73a9d81f2d0 Author: Jonathan Brassow <[email protected]> AuthorDate: Tue Feb 4 07:59:58 2014 -0600 Committer: Jonathan Brassow <[email protected]> CommitterDate: Tue Feb 4 07:59:58 2014 -0600
cache: Add functions that create/remove cache LVs
A cache LV - from LVM's perpective - is a user accessible device that links the cachepool LV and the origin LV. The following functions were added to facilitate the creation and removal of this top-level LV:
1) 'lv_cache_create' - takes a cachepool and an origin device and links them into a new top-level LV of 'cache' segment type. No allocation is necessary in this function, as the sub-LVs contain all of the necessary allocated space. Only the top-level layer needs to be created.
2) 'lv_cache_remove' - this function removes the top-level LV of a cache LV - promoting the cachepool and origin sub-LVs to top-level devices and leaving them exposed to the user. That is, the cachepool is unlinked and free to be used with another origin to form a new cache LV; and the origin is no longer cached. (Currently, if the cache needs to be flushed, it is done in this function and the function waits for it to complete before proceeding. This will be taken out in a future patch in favor of polling.)
--- lib/Makefile.in | 1 + lib/metadata/cache_manip.c | 219 ++++++++++++++++++++++++++++++++++++++ lib/metadata/metadata-exported.h | 9 ++- 3 files changed, 227 insertions(+), 2 deletions(-)
lib/Makefile.in +1 -0
@@ -87,6 +87,7 @@ SOURCES =\ locking/locking.c \ locking/no_locking.c \ log/log.c \ + metadata/cache_manip.c \ metadata/lv.c \ metadata/lv_manip.c \ metadata/merge.c \
lib/metadata/cache_manip.c new file +219 -0
219 lines not on this page · raw message
lib/metadata/metadata-exported.h +7 -2
@@ -1,6 +1,6 @@/* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. -* Copyright (C) 2004-2013 Red Hat, Inc. All rights reserved. +* Copyright (C) 2004-2014 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. *
@@ -1016,9 +1016,14 @@ int lv_raid_reshape(struct logical_volume *lv,int lv_raid_replace (struct logical_volume *lv,struct dm_list *remove_pvs,struct dm_list *allocate_pvs);int lv_raid_remove_missing (struct logical_volume *lv); -/* -- metadata/raid_manip.c */ +/* ++ metadata/cache_manip.c */ +struct logical_volume *lv_cache_create (struct logical_volume *pool, +struct logical_volume *origin); +int lv_cache_remove (struct logical_volume *cache_lv); +/* -- metadata/cache_manip.c */ +struct cmd_vg *cmd_vg_add (struct dm_pool *mem,struct dm_list *cmd_vgs,const char *vg_name,const char *vgid,uint32_t flags);