mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-08-18 02:22:47 -07:00
apfs: use __set_bit_le() to set bitmap bits
In the spirit of the previous patch, use the __set_bit_le() provided by the kernel to simplify apfs_chunk_mark_used(). There is no endianness issue this time, but it's still better to use the common code. Also change the type of the bitmap from u8* to char*, for consistency with apfs_chunk_find_free(). Signed-off-by: Ernesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
This commit is contained in:
1 parent
ae88026d5f
commit
4e5bb38d6b
1 file changed
+4
-5
+4
-5
@@ -213,13 +213,12 @@ static u64 apfs_chunk_find_free(struct super_block *sb, char *bitmap, u64 addr)
|
||||
* @bitmap: allocation bitmap for the chunk
|
||||
* @bno: block number (must belong to the chunk)
|
||||
*/
|
||||
static void apfs_chunk_mark_used(struct super_block *sb, u8 *bitmap, u64 bno)
|
||||
static inline void apfs_chunk_mark_used(struct super_block *sb, char *bitmap,
|
||||
u64 bno)
|
||||
{
|
||||
int index = bno & ((sb->s_blocksize * 8) - 1);
|
||||
u8 *byte_p = bitmap + (index / 8);
|
||||
u8 bit = 1 << index % 8;
|
||||
int bitcount = sb->s_blocksize * 8;
|
||||
|
||||
*byte_p |= bit;
|
||||
__set_bit_le(bno & (bitcount - 1), bitmap);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user