提交 a481db78 编写于 作者: M Mikulas Patocka 提交者: Alasdair G Kergon

dm exception store: introduce area_location function

Move this logic to a function, because it will be reused later.
Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
上级 f7c83e2e
......@@ -208,6 +208,14 @@ static int chunk_io(struct pstore *ps, uint32_t chunk, int rw, int metadata)
return req.result;
}
/*
* 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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册