From: Mikulas Patocka Move this logic to a function, because it will be reused later. Signed-off-by: Mikulas Patocka Signed-off-by: Alasdair G Kergon --- drivers/md/dm-exception-store.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) Index: linux-2.6.27-rc7/drivers/md/dm-exception-store.c =================================================================== --- linux-2.6.27-rc7.orig/drivers/md/dm-exception-store.c 2008-09-23 15:10:21.000000000 +0100 +++ linux-2.6.27-rc7/drivers/md/dm-exception-store.c 2008-09-23 15:11:41.000000000 +0100 @@ -209,6 +209,14 @@ static int chunk_io(struct pstore *ps, u } /* + * Convert a metadata area index to a chunk index. + */ +static chunk_t area_location(struct pstore *ps, chunk_t area) +{ + return 1 + ((ps->exceptions_per_area + 1) * area); +} + +/* * Read or write a metadata area. Remembering to skip the first * chunk which holds the header. */ @@ -217,8 +225,7 @@ static int area_io(struct pstore *ps, ui int r; uint32_t chunk; - /* convert a metadata area index to a chunk index */ - chunk = 1 + ((ps->exceptions_per_area + 1) * area); + chunk = area_location(ps, area); r = chunk_io(ps, chunk, rw, 0); if (r)