diff options
author | M. Mohan Kumar <mohan@in.ibm.com> | 2013-11-13 22:44:43 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-11-13 11:39:22 -0800 |
commit | 81a57679c20ac0ac9b48e313af75036132e3a5ad (patch) | |
tree | c99c3cf75096a2530b65a3bb5b3c19c2c463b7fa /xlators/storage/bd/src/bd.h | |
parent | b222ce817f5f324fe20d4d3614001ed2f177afb8 (diff) |
bd: Add support to create clone, snapshot and merge of LV images.
Special xattr names "clone" & "snapshot" can be used to create full and
linked clone of the LV images. GFID of destination posix file (to be
mapped) is passed as a value to the xattr. Destination posix file must
exist before running this operation.
These operations form a basis for offloading storage related operations
from QEMU to GlusterFS.
Syntax for full clone: xattr name: "clone" value: "gfid-of-dest-file"
Syntax for linked clone: xattr name: "snapshot" value: "gfid-of-dest-file"
Syntax for merging: xattr name: "merge" value: "path-to-snapshot-file"
Example:
setfattr -n clone -v <gfid-of-dest-file> /media/source
setfattr -n snapshot -v <gfid-of-dest-file> /media/source
setfattr -n merge -v "/media/sn" /media/sn
Change-Id: Id9f984a709d4c2e52a64ae75bb12a8ecb01f8776
BUG: 1028672
Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
Reviewed-on: http://review.gluster.org/5626
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/storage/bd/src/bd.h')
-rw-r--r-- | xlators/storage/bd/src/bd.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/xlators/storage/bd/src/bd.h b/xlators/storage/bd/src/bd.h index e3acdedc1..34b4c9e22 100644 --- a/xlators/storage/bd/src/bd.h +++ b/xlators/storage/bd/src/bd.h @@ -40,6 +40,7 @@ #define LVM_RESIZE "/sbin/lvresize" #define LVM_CREATE "/sbin/lvcreate" +#define LVM_CONVERT "/sbin/lvconvert" #define VOL_TYPE "volume.type" #define VOL_CAPS "volume.caps" @@ -48,6 +49,20 @@ #define BD_CAPS_BD 0x01 #define BD_CAPS_THIN 0x02 +#define BD_CAPS_OFFLOAD_COPY 0x04 +#define BD_CAPS_OFFLOAD_SNAPSHOT 0x08 + +#define BD_CLONE "clone" +#define BD_SNAPSHOT "snapshot" +#define BD_MERGE "merge" +#define BD_ORIGIN "list-origin" + +#define IOV_NR 4 +#define IOV_SIZE (64 * 1024) + +#define ALIGN_SIZE 4096 + +#define LINKTO "trusted.glusterfs.dht.linkto" #define BD_VALIDATE_MEM_ALLOC(buff, op_errno, label) \ if (!buff) { \ @@ -115,6 +130,13 @@ typedef struct { char *type; } bd_attr_t; +typedef enum { + BD_OF_NONE, + BD_OF_CLONE, + BD_OF_SNAPSHOT, + BD_OF_MERGE, +} bd_offload_t; + typedef struct { dict_t *dict; bd_attr_t *bdatt; @@ -122,6 +144,9 @@ typedef struct { loc_t loc; fd_t *fd; data_t *data; /* for setxattr */ + bd_offload_t offload; + uint64_t size; + loc_t *dloc; } bd_local_t; /* Prototypes */ @@ -145,4 +170,9 @@ int bd_clone (bd_local_t *local, bd_priv_t *priv); int bd_merge (bd_priv_t *priv, uuid_t gfid); int bd_get_origin (bd_priv_t *priv, loc_t *loc, fd_t *fd, dict_t *dict); inline void bd_update_amtime(struct iatt *iatt, int flag); +int bd_snapshot_create (bd_local_t *local, bd_priv_t *priv); +int bd_clone (bd_local_t *local, bd_priv_t *priv); +int bd_merge (bd_priv_t *priv, uuid_t gfid); +int bd_get_origin (bd_priv_t *priv, loc_t *loc, fd_t *fd, dict_t *dict); + #endif |