Commit c67b85b0 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] clean up alloc_buffer_head()

alloc_bufer_head() does not need the additional argument - GFP_NOFS is
always correct.
parent 1704566f
...@@ -945,12 +945,12 @@ void invalidate_inode_buffers(struct inode *inode) ...@@ -945,12 +945,12 @@ void invalidate_inode_buffers(struct inode *inode)
* the size of each buffer.. Use the bh->b_this_page linked list to * the size of each buffer.. Use the bh->b_this_page linked list to
* follow the buffers created. Return NULL if unable to create more * follow the buffers created. Return NULL if unable to create more
* buffers. * buffers.
* The async flag is used to differentiate async IO (paging, swapping) *
* from ordinary buffer allocations, and only async requests are allowed * The retry flag is used to differentiate async IO (paging, swapping)
* to sleep waiting for buffer heads. * which may not fail from ordinary buffer allocations.
*/ */
static struct buffer_head * static struct buffer_head *
create_buffers(struct page * page, unsigned long size, int async) create_buffers(struct page * page, unsigned long size, int retry)
{ {
struct buffer_head *bh, *head; struct buffer_head *bh, *head;
long offset; long offset;
...@@ -959,7 +959,7 @@ create_buffers(struct page * page, unsigned long size, int async) ...@@ -959,7 +959,7 @@ create_buffers(struct page * page, unsigned long size, int async)
head = NULL; head = NULL;
offset = PAGE_SIZE; offset = PAGE_SIZE;
while ((offset -= size) >= 0) { while ((offset -= size) >= 0) {
bh = alloc_buffer_head(async); bh = alloc_buffer_head();
if (!bh) if (!bh)
goto no_grow; goto no_grow;
...@@ -996,7 +996,7 @@ create_buffers(struct page * page, unsigned long size, int async) ...@@ -996,7 +996,7 @@ create_buffers(struct page * page, unsigned long size, int async)
* become available. But we don't want tasks sleeping with * become available. But we don't want tasks sleeping with
* partially complete buffers, so all were released above. * partially complete buffers, so all were released above.
*/ */
if (!async) if (!retry)
return NULL; return NULL;
/* We're _really_ low on memory. Now we just /* We're _really_ low on memory. Now we just
...@@ -2392,7 +2392,7 @@ asmlinkage long sys_bdflush(int func, long data) ...@@ -2392,7 +2392,7 @@ asmlinkage long sys_bdflush(int func, long data)
static kmem_cache_t *bh_cachep; static kmem_cache_t *bh_cachep;
static mempool_t *bh_mempool; static mempool_t *bh_mempool;
struct buffer_head *alloc_buffer_head(int async) struct buffer_head *alloc_buffer_head(void)
{ {
return mempool_alloc(bh_mempool, GFP_NOFS); return mempool_alloc(bh_mempool, GFP_NOFS);
} }
......
...@@ -463,7 +463,7 @@ int journal_write_metadata_buffer(transaction_t *transaction, ...@@ -463,7 +463,7 @@ int journal_write_metadata_buffer(transaction_t *transaction,
* Right, time to make up the new buffer_head. * Right, time to make up the new buffer_head.
*/ */
do { do {
new_bh = alloc_buffer_head(0); new_bh = alloc_buffer_head();
if (!new_bh) { if (!new_bh) {
printk (KERN_NOTICE "%s: ENOMEM at alloc_buffer_head, " printk (KERN_NOTICE "%s: ENOMEM at alloc_buffer_head, "
"trying again.\n", __FUNCTION__); "trying again.\n", __FUNCTION__);
......
...@@ -181,7 +181,7 @@ void __brelse(struct buffer_head *); ...@@ -181,7 +181,7 @@ void __brelse(struct buffer_head *);
void __bforget(struct buffer_head *); void __bforget(struct buffer_head *);
struct buffer_head * __bread(struct block_device *, int, int); struct buffer_head * __bread(struct block_device *, int, int);
void wakeup_bdflush(void); void wakeup_bdflush(void);
struct buffer_head *alloc_buffer_head(int async); struct buffer_head *alloc_buffer_head(void);
void free_buffer_head(struct buffer_head * bh); void free_buffer_head(struct buffer_head * bh);
void FASTCALL(unlock_buffer(struct buffer_head *bh)); void FASTCALL(unlock_buffer(struct buffer_head *bh));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment