mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
dm cache: pull out some bitset utility functions for reuse
Signed-off-by: Joe Thornber <ejt@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
This commit is contained in:
parent
20f6814b94
commit
451b9e0071
2 changed files with 28 additions and 24 deletions
|
@ -111,30 +111,6 @@ static void iot_io_end(struct io_tracker *iot, sector_t len)
|
|||
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
static size_t bitset_size_in_bytes(unsigned nr_entries)
|
||||
{
|
||||
return sizeof(unsigned long) * dm_div_up(nr_entries, BITS_PER_LONG);
|
||||
}
|
||||
|
||||
static unsigned long *alloc_bitset(unsigned nr_entries)
|
||||
{
|
||||
size_t s = bitset_size_in_bytes(nr_entries);
|
||||
return vzalloc(s);
|
||||
}
|
||||
|
||||
static void clear_bitset(void *bitset, unsigned nr_entries)
|
||||
{
|
||||
size_t s = bitset_size_in_bytes(nr_entries);
|
||||
memset(bitset, 0, s);
|
||||
}
|
||||
|
||||
static void free_bitset(unsigned long *bits)
|
||||
{
|
||||
vfree(bits);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* There are a couple of places where we let a bio run, but want to do some
|
||||
* work before calling its endio function. We do this by temporarily
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue