summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2008-10-10 13:37:00 +0100
committerAlasdair G Kergon <agk@redhat.com>2008-10-10 13:37:00 +0100
commita481db784682b33d078c7bf8a1d0581dc09946c1 (patch)
tree380b08162df8b49e23c846112fb9d376d3b6fe65
parentf7c83e2e4783c4f7abe6f3a85a8c5e210f98bc7b (diff)
downloadop-kernel-dev-a481db784682b33d078c7bf8a1d0581dc09946c1.zip
op-kernel-dev-a481db784682b33d078c7bf8a1d0581dc09946c1.tar.gz
dm exception store: introduce area_location function
Move this logic to a function, because it will be reused later. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
-rw-r--r--drivers/md/dm-exception-store.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/md/dm-exception-store.c b/drivers/md/dm-exception-store.c
index 41f4080..824cf31 100644
--- a/drivers/md/dm-exception-store.c
+++ b/drivers/md/dm-exception-store.c
@@ -209,6 +209,14 @@ static int chunk_io(struct pstore *ps, uint32_t chunk, int rw, int metadata)
}
/*
+ * 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, uint32_t area, int rw)
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)
OpenPOWER on IntegriCloud