summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2021-03-22 10:05:05 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2021-03-22 11:30:03 -0400
commit90432e600619cbd3f38ec817374a5db0caf1d600 (patch)
tree7f9057c56f719b3ecda444775e3594196452455c
parent2be7828c9fefc8cd205d1948faac48da8ce6c2ef (diff)
buffer: a small optimization in grow_buffers
This patch replaces a loop with a "tzcnt" instruction. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/buffer.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/fs/buffer.c b/fs/buffer.c
index 0cb7ffd4977c..c2e052c0fc5d 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1020,11 +1020,7 @@ grow_buffers(struct block_device *bdev, sector_t block, int size, gfp_t gfp)
pgoff_t index;
int sizebits;
- sizebits = -1;
- do {
- sizebits++;
- } while ((size << sizebits) < PAGE_SIZE);
-
+ sizebits = PAGE_SHIFT - __ffs(size);
index = block >> sizebits;
/*