@ -871,16 +871,19 @@ int remove_inode_buffers(struct inode *inode)
* which may not fail from ordinary buffer allocations .
*/
struct buffer_head * alloc_page_buffers ( struct page * page , unsigned long size ,
int retry )
bool retry )
{
struct buffer_head * bh , * head ;
gfp_t gfp = GFP_NOFS ;
long offset ;
try_again :
if ( retry )
gfp | = __GFP_NOFAIL ;
head = NULL ;
offset = PAGE_SIZE ;
while ( ( offset - = size ) > = 0 ) {
bh = alloc_buffer_head ( GFP_NOFS ) ;
bh = alloc_buffer_head ( gfp ) ;
if ( ! bh )
goto no_grow ;
@ -906,23 +909,7 @@ no_grow:
} while ( head ) ;
}
/*
* Return failure for non - async IO requests . Async IO requests
* are not allowed to fail , so we have to wait until buffer heads
* become available . But we don ' t want tasks sleeping with
* partially complete buffers , so all were released above .
*/
if ( ! retry )
return NULL ;
/* We're _really_ low on memory. Now we just
* wait for old buffer heads to become free due to
* finishing IO . Since this is an async request and
* the reserve list is empty , we ' re sure there are
* async buffer heads in use .
*/
free_more_memory ( ) ;
goto try_again ;
return NULL ;
}
EXPORT_SYMBOL_GPL ( alloc_page_buffers ) ;
@ -1031,7 +1018,7 @@ grow_dev_page(struct block_device *bdev, sector_t block,
/*
* Allocate some buffers for this page
*/
bh = alloc_page_buffers ( page , size , 0 ) ;
bh = alloc_page_buffers ( page , size , false ) ;
if ( ! bh )
goto failed ;
@ -1668,7 +1655,7 @@ void create_empty_buffers(struct page *page,
{
struct buffer_head * bh , * head , * tail ;
head = alloc_page_buffers ( page , blocksize , 1 ) ;
head = alloc_page_buffers ( page , blocksize , true ) ;
bh = head ;
do {
bh - > b_state | = b_state ;
@ -2731,7 +2718,7 @@ int nobh_write_begin(struct address_space *mapping,
* Be careful : the buffer linked list is a NULL terminated one , rather
* than the circular one we ' re used to .
*/
head = alloc_page_buffers ( page , blocksize , 0 ) ;
head = alloc_page_buffers ( page , blocksize , false ) ;
if ( ! head ) {
ret = - ENOMEM ;
goto out_release ;