Skip to contentSkip to conversation

fs/buffer.c: do not inline exported function

PATCH New Yan Hong 1 participant 2 messages Nov 22, 2012 VFS

lore
Share & tools
lore

Yan Hong

author
#0 lore raw

PATCH 1/2 fs/buffer.c: do not inline exported function

It makes no sense to inlines exported function.

---

init_buffer() is trivial and only get two module users. Maybe we can move it to buffer_head.h.

Remove inline is much more simple to make it clean though.

 fs/buffer.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/buffer.c +1 -2
index b5f0442..69e83ee 100644
@@ -46,8 +46,7 @@ static int fsync_buffers_list(spinlock_t *lock, struct list_head *list);
 
 #define BH_ENTRY(list) list_entry((list), struct buffer_head, b_assoc_buffers)
 
-inline void
-init_buffer(struct buffer_head *bh, bh_end_io_t *handler, void *private)
+void init_buffer(struct buffer_head *bh, bh_end_io_t *handler, void *private)
 {
 	bh->b_end_io = handler;
 	bh->b_private = private;
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 2/2 fs/buffer.c: remove redundant initialization in alloc_page_buffers()

buffer_head comes from kmem_cache_zalloc(), no need to zero its field.

---

init_buffer() can be actually removed too, but I'm afraid someday its semantic will beyond initializing ->b_end_io and ->b_private.

 fs/buffer.c |    3 ---
 1 file changed, 3 deletions(-)
fs/buffer.c +0 -3
index 69e83ee..ad87aa6 100644
@@ -849,13 +849,10 @@ try_again:
 		if (!bh)
 			goto no_grow;
 
-		bh->b_bdev = NULL;
 		bh->b_this_page = head;
 		bh->b_blocknr = -1;
 		head = bh;
 
-		bh->b_state = 0;
-		atomic_set(&bh->b_count, 0);
 		bh->b_size = size;
 
 		/* Link the buffer to its page */
Signature · 1 line
1.7.9.5