aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2009-10-16 18:18:22 -0400
committerAlasdair G Kergon <agk@redhat.com>2009-10-16 18:18:22 -0400
commitc1cc65caa19bb8a1b2e371000ef2719581db1691 (patch)
tree8b38c2f4f046aa3525f50fb3bd51466c547f2a22 /drivers/md
parentdf96eee679ba28c98cf722fa7c9f4286ee1ed0bd (diff)
dm snapshot: allow chunk size to be less than page size
Allow the snapshot chunk size to be smaller than the page size The code is now capable of handling this due to some previous fixes and enhancements. As the page size varies between computers, prior to this patch, the chunk size of a snapshot dictated which machines could read it: Snapshots created on one machine might not be readable on another. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Reviewed-by: Mike Snitzer <snitzer@redhat.com> Reviewed-by: Jonathan Brassow <jbrassow@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-exception-store.c16
1 files changed, 0 insertions, 16 deletions
diff --git a/drivers/md/dm-exception-store.c b/drivers/md/dm-exception-store.c
index 932d1b123143..7dbe652efb5a 100644
--- a/drivers/md/dm-exception-store.c
+++ b/drivers/md/dm-exception-store.c
@@ -138,16 +138,6 @@ int dm_exception_store_type_unregister(struct dm_exception_store_type *type)
138} 138}
139EXPORT_SYMBOL(dm_exception_store_type_unregister); 139EXPORT_SYMBOL(dm_exception_store_type_unregister);
140 140
141/*
142 * Round a number up to the nearest 'size' boundary. size must
143 * be a power of 2.
144 */
145static ulong round_up(ulong n, ulong size)
146{
147 size--;
148 return (n + size) & ~size;
149}
150
151static int set_chunk_size(struct dm_exception_store *store, 141static int set_chunk_size(struct dm_exception_store *store,
152 const char *chunk_size_arg, char **error) 142 const char *chunk_size_arg, char **error)
153{ 143{
@@ -166,12 +156,6 @@ static int set_chunk_size(struct dm_exception_store *store,
166 return 0; 156 return 0;
167 } 157 }
168 158
169 /*
170 * Chunk size must be multiple of page size. Silently
171 * round up if it's not.
172 */
173 chunk_size_ulong = round_up(chunk_size_ulong, PAGE_SIZE >> 9);
174
175 return dm_exception_store_set_chunk_size(store, 159 return dm_exception_store_set_chunk_size(store,
176 (unsigned) chunk_size_ulong, 160 (unsigned) chunk_size_ulong,
177 error); 161 error);