1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-22 06:50:52 +03:00

Impose chunk size limitation.

This commit is contained in:
Alasdair Kergon 2005-09-30 22:20:14 +00:00
parent d7b6fa9cd0
commit 5471a80a96

View File

@ -303,7 +303,12 @@ static int _read_params(struct lvcreate_params *lp, struct cmd_context *cmd,
return 0;
}
lp->chunk_size = 2 * arg_uint_value(cmd, chunksize_ARG, 8);
// FIXME Restrict chunk_size to power of 2 in range PAGE_SIZE up to 512k (=1024)
if (lp->chunk_size < 8 || lp->chunk_size > 1024 ||
(lp->chunk_size & (lp->chunk_size - 1))) {
log_error("Chunk size must be a power of 2 in the "
"range 4K to 512K");
return 0;
}
log_verbose("Setting chunksize to %d sectors.", lp->chunk_size);
if (!(lp->segtype = get_segtype_from_string(cmd, "snapshot"))) {