* [PATCH] fix hard-coded disk header chunk size for persistent snapshot
@ 2010-05-12 1:29 Tomohiro Kusumi
2010-05-12 1:39 ` Alasdair G Kergon
0 siblings, 1 reply; 4+ messages in thread
From: Tomohiro Kusumi @ 2010-05-12 1:29 UTC (permalink / raw)
To: dm-devel, agk; +Cc: linux-kernel, kusumi.tomohiro
Hi,
This patch fixes hard-coded value for the size of a chunk that includes
disk header for persistent snapshot. It should be changed to existing
macro NUM_SNAPSHOT_HDR_CHUNKS instead of using hard-coded value 1.
Thanks,
Tomohiro Kusumi
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@jp.fujitsu.com>
---
diff -aNur linux-2.6.34-rc7.org/drivers/md/dm-snap-persistent.c linux-2.6.34-rc7/drivers/md/dm-snap-persistent.c
--- linux-2.6.34-rc7.org/drivers/md/dm-snap-persistent.c 2010-05-10 10:36:28.000000000 +0900
+++ linux-2.6.34-rc7/drivers/md/dm-snap-persistent.c 2010-05-12 09:21:50.000000000 +0900
@@ -266,7 +266,7 @@
*/
static chunk_t area_location(struct pstore *ps, chunk_t area)
{
- return 1 + ((ps->exceptions_per_area + 1) * area);
+ return NUM_SNAPSHOT_HDR_CHUNKS + ((ps->exceptions_per_area + 1) * area);
}
/*
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fix hard-coded disk header chunk size for persistent snapshot
2010-05-12 1:29 [PATCH] fix hard-coded disk header chunk size for persistent snapshot Tomohiro Kusumi
@ 2010-05-12 1:39 ` Alasdair G Kergon
2010-05-12 4:58 ` Mikulas Patocka
0 siblings, 1 reply; 4+ messages in thread
From: Alasdair G Kergon @ 2010-05-12 1:39 UTC (permalink / raw)
To: Tomohiro Kusumi; +Cc: dm-devel, linux-kernel, Mikulas Patocka
On Wed, May 12, 2010 at 10:29:22AM +0900, Tomohiro Kusumi wrote:
> This patch fixes hard-coded value for the size of a chunk that includes
> disk header for persistent snapshot. It should be changed to existing
> macro NUM_SNAPSHOT_HDR_CHUNKS instead of using hard-coded value 1.
Any more places too? (E.g. persistent_commit_merge)
Alasdair
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fix hard-coded disk header chunk size for persistent snapshot
2010-05-12 1:39 ` Alasdair G Kergon
@ 2010-05-12 4:58 ` Mikulas Patocka
2010-05-12 5:57 ` Tomohiro Kusumi
0 siblings, 1 reply; 4+ messages in thread
From: Mikulas Patocka @ 2010-05-12 4:58 UTC (permalink / raw)
To: Alasdair G Kergon; +Cc: Tomohiro Kusumi, dm-devel, linux-kernel
On Wed, 12 May 2010, Alasdair G Kergon wrote:
> On Wed, May 12, 2010 at 10:29:22AM +0900, Tomohiro Kusumi wrote:
> > This patch fixes hard-coded value for the size of a chunk that includes
> > disk header for persistent snapshot. It should be changed to existing
> > macro NUM_SNAPSHOT_HDR_CHUNKS instead of using hard-coded value 1.
>
> Any more places too? (E.g. persistent_commit_merge)
>
> Alasdair
I think the expression in persistent_commit_merge should be changed to:
ps->next_free = area_location(ps, ps->current_area) +
ps->current_committed + 1;
It is numerically the same, but will avoid trouble if
NUM_SNAPSHOT_HDR_CHUNKS is increased.
Mikulas
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fix hard-coded disk header chunk size for persistent snapshot
2010-05-12 4:58 ` Mikulas Patocka
@ 2010-05-12 5:57 ` Tomohiro Kusumi
0 siblings, 0 replies; 4+ messages in thread
From: Tomohiro Kusumi @ 2010-05-12 5:57 UTC (permalink / raw)
To: Mikulas Patocka, Alasdair G Kergon, dm-devel
Cc: linux-kernel, kusumi.tomohiro
(2010/05/12 13:58), Mikulas Patocka wrote:
>
>
> On Wed, 12 May 2010, Alasdair G Kergon wrote:
>
>> On Wed, May 12, 2010 at 10:29:22AM +0900, Tomohiro Kusumi wrote:
>>> This patch fixes hard-coded value for the size of a chunk that includes
>>> disk header for persistent snapshot. It should be changed to existing
>>> macro NUM_SNAPSHOT_HDR_CHUNKS instead of using hard-coded value 1.
>>
>> Any more places too? (E.g. persistent_commit_merge)
>>
>> Alasdair
>
> I think the expression in persistent_commit_merge should be changed to:
> ps->next_free = area_location(ps, ps->current_area) +
> ps->current_committed + 1;
>
> It is numerically the same, but will avoid trouble if
> NUM_SNAPSHOT_HDR_CHUNKS is increased.
>
> Mikulas
>
>
agree,
a single chunk is large enough to contain 16byte disk header
which does not seem necessary to increase NUM_SNAPSHOT_HDR_CHUNKS in the future
(unless whole structure get totally changed),
but it should also get fixed to avoid trouble.
I merged it to the patch with your names signed off.
Thanks,
Tomohiro Kusumi
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@jp.fujitsu.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
---
diff -aNur linux-2.6.34-rc7.org/drivers/md/dm-snap-persistent.c linux-2.6.34-rc7/drivers/md/dm-snap-persistent.c
--- linux-2.6.34-rc7.org/drivers/md/dm-snap-persistent.c 2010-05-10 10:36:28.000000000 +0900
+++ linux-2.6.34-rc7/drivers/md/dm-snap-persistent.c 2010-05-12 14:49:13.000000000 +0900
@@ -266,7 +266,7 @@
*/
static chunk_t area_location(struct pstore *ps, chunk_t area)
{
- return 1 + ((ps->exceptions_per_area + 1) * area);
+ return NUM_SNAPSHOT_HDR_CHUNKS + ((ps->exceptions_per_area + 1) * area);
}
/*
@@ -780,8 +780,8 @@
* ps->current_area does not get reduced by prepare_merge() until
* after commit_merge() has removed the nr_merged previous exceptions.
*/
- ps->next_free = (area_location(ps, ps->current_area) - 1) +
- (ps->current_committed + 1) + NUM_SNAPSHOT_HDR_CHUNKS;
+ ps->next_free = area_location(ps, ps->current_area) +
+ ps->current_committed + 1;
return 0;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-05-12 5:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-12 1:29 [PATCH] fix hard-coded disk header chunk size for persistent snapshot Tomohiro Kusumi
2010-05-12 1:39 ` Alasdair G Kergon
2010-05-12 4:58 ` Mikulas Patocka
2010-05-12 5:57 ` Tomohiro Kusumi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox