From: Mike Snitzer <snitzer@redhat.com>
To: device-mapper development <dm-devel@redhat.com>
Cc: Alasdair G Kergon <agk@redhat.com>
Subject: Re: [PATCH 4/4] Test chunk size against both origin and snapshot sector size
Date: Mon, 15 Mar 2010 10:52:24 -0400 [thread overview]
Message-ID: <20100315145224.GE6853@redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1003150201270.12526@hs20-bc2-1.build.redhat.com>
On Mon, Mar 15 2010 at 2:04am -0400,
Mikulas Patocka <mpatocka@redhat.com> wrote:
> Test chunk size against both origin and snapshot sector size
>
> Don't allow chunk size smaller than either origin or snapshot logical
> sector size. Reading or writing data unaligned to sector size is not allowed
> and causes immediate errors.
>
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
>
> ---
> drivers/md/dm-exception-store.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> Index: linux-2.6.34-rc1-devel/drivers/md/dm-exception-store.c
> ===================================================================
> --- linux-2.6.34-rc1-devel.orig/drivers/md/dm-exception-store.c 2010-03-12 14:38:31.000000000 +0100
> +++ linux-2.6.34-rc1-devel/drivers/md/dm-exception-store.c 2010-03-12 14:39:56.000000000 +0100
> @@ -173,7 +173,9 @@ int dm_exception_store_set_chunk_size(st
>
> /* Validate the chunk size against the device block size */
> if (chunk_size %
> - (bdev_logical_block_size(dm_snap_cow(store->snap)->bdev) >> 9)) {
> + (bdev_logical_block_size(dm_snap_cow(store->snap)->bdev) >> 9) ||
> + chunk_size %
> + (bdev_logical_block_size(dm_snap_origin(store->snap)->bdev) >> 9)) {
> *error = "Chunk size is not a multiple of device blocksize";
> return -EINVAL;
> }
Shouldn't we split these checks out so that we can have more precise
error reporting? Ideally we'd share that chunk_size was not a multiple
of the "origin" or "snapshot" device's blocksize.
I was also thinking that we should avoid using %, e.g.:
(chunk_size & (bdev_logical_block_size(...) - 1))
but AFAIK bdev_logical_block_size() may not be a power of 2 (MD allows
for obscure non-power of 2 blocksizes doesn't it? Or is that just for
MD chunk and stripe size?).
Mike
next prev parent reply other threads:[~2010-03-15 14:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-15 6:04 [PATCH 4/4] Test chunk size against both origin and snapshot sector size Mikulas Patocka
2010-03-15 14:52 ` Mike Snitzer [this message]
2010-03-15 15:10 ` Mikulas Patocka
2010-03-15 15:30 ` Mike Snitzer
2010-03-15 15:52 ` Mikulas Patocka
2010-03-15 16:53 ` Martin K. Petersen
2010-03-15 15:54 ` Mikulas Patocka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100315145224.GE6853@redhat.com \
--to=snitzer@redhat.com \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.