Skip to contentSkip to conversation

fs: remove the block_size_bits helper

PATCH New Christoph Hellwig 1 participant 1 message Jun 26, 2020 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs: remove the block_size_bits helper

This is a trivial wrapper around ilog2, with a totally confusing comment.

---
 fs/buffer.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)
fs/buffer.c +3 -16
index 64fe82ec65ff1f..c89eb509d6049c 100644
@@ -1658,19 +1658,6 @@ void clean_bdev_aliases(struct block_device *bdev, sector_t block, sector_t len)
 }
 EXPORT_SYMBOL(clean_bdev_aliases);
 
-/*
- * Size is a power-of-two in the range 512..PAGE_SIZE,
- * and the case we care about most is PAGE_SIZE.
- *
- * So this *could* possibly be written with those
- * constraints in mind (relevant mostly if some
- * architecture has a slow bit-scan instruction)
- */
-static inline int block_size_bits(unsigned int blocksize)
-{
-	return ilog2(blocksize);
-}
-
 static struct buffer_head *create_page_buffers(struct page *page, struct inode *inode, unsigned int b_state)
 {
 	BUG_ON(!PageLocked(page));
@@ -1737,7 +1724,7 @@ int __block_write_full_page(struct inode *inode, struct page *page,
 
 	bh = head;
 	blocksize = bh->b_size;
-	bbits = block_size_bits(blocksize);
+	bbits = ilog2(blocksize);
 
 	block = (sector_t)page->index << (PAGE_SHIFT - bbits);
 	last_block = (i_size_read(inode) - 1) >> bbits;
@@ -1990,7 +1977,7 @@ int __block_write_begin_int(struct page *page, loff_t pos, unsigned len,
 
 	head = create_page_buffers(page, inode, 0);
 	blocksize = head->b_size;
-	bbits = block_size_bits(blocksize);
+	bbits = ilog2(blocksize);
 
 	block = (sector_t)page->index << (PAGE_SHIFT - bbits);
 
@@ -2268,7 +2255,7 @@ int block_read_full_page(struct page *page, get_block_t *get_block)
 
 	head = create_page_buffers(page, inode, 0);
 	blocksize = head->b_size;
-	bbits = block_size_bits(blocksize);
+	bbits = ilog2(blocksize);
 
 	iblock = (sector_t)page->index << (PAGE_SHIFT - bbits);
 	lblock = (i_size_read(inode)+blocksize-1) >> bbits;
Signature · 1 line
2.26.2