{
struct snapshot_c *lc;
unsigned long chunk_size;
- unsigned long extent_size;
+ unsigned long extent_size = 0L;
int r = -EINVAL;
char *persistent;
char *origin_path;
char *value;
int blocksize;
- if (argc < 5) {
+ if (argc < 4) {
*context = "dm-snapshot: Not enough arguments";
return -EINVAL;
}
goto bad;
}
- extent_size = simple_strtoul(argv[4], &value, 10);
- if (extent_size == 0 || value == NULL) {
- *context = "Invalid extent size";
- goto bad;
+ /* Get the extent size for persistent snapshots */
+ if ((*persistent & 0x5f) == 'P') {
+ *context = "No extent size specified";
+ if (argc < 5)
+ goto bad;
+
+ extent_size = simple_strtoul(argv[4], &value, 10);
+ if (extent_size == 0 || value == NULL) {
+ *context = "Invalid extent size";
+ goto bad;
+ }
}
*context = "Cannot allocate snapshot context private structure";
to check the LV header */
if ((*persistent & 0x5f) == 'P') {
lc->persistent = 1;
- }
- else {
- lc->persistent = 0;
- }
- /* For a persistent snapshot allocate the COW iobuf and set associated variables */
- if (lc->persistent) {
+ /* Allocate the COW iobuf and set associated variables */
if (setup_persistent_snapshot(lc, blocksize, context))
goto bad_free1;
}
+ else {
+ lc->persistent = 0;
+ }
/* Flush IO to the origin device */
/* TODO: VFS lock sync too */