Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753381AbdI1P0c (ORCPT ); Thu, 28 Sep 2017 11:26:32 -0400 Received: from mx2.suse.de ([195.135.220.15]:52571 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751579AbdI1P0a (ORCPT ); Thu, 28 Sep 2017 11:26:30 -0400 Subject: Re: [PATCH 02/12] buffer: grow_dev_page() should use __GFP_NOFAIL for all cases To: Jens Axboe , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: hannes@cmpxchg.org, jack@suse.cz, torvalds@linux-foundation.org References: <1506543239-31470-1-git-send-email-axboe@kernel.dk> <1506543239-31470-3-git-send-email-axboe@kernel.dk> From: Nikolay Borisov Message-ID: <3ddbf81d-7894-920d-cfa3-47ec17c87af8@suse.com> Date: Thu, 28 Sep 2017 17:11:04 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <1506543239-31470-3-git-send-email-axboe@kernel.dk> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1330 Lines: 47 On 27.09.2017 23:13, Jens Axboe wrote: > We currently it it for find_or_create_page(), which means that it nit: Perhaps you wanted to write "We currently use it for find_..." otherwise: Reviewed-by: Nikolay Borisov > cannot fail. Ensure we also pass in 'retry == true' to > alloc_page_buffers(), which also ensure that it cannot fail. > > After this, there are no failure cases in grow_dev_page() that > occur because of a failed memory allocation. > > Signed-off-by: Jens Axboe > --- > fs/buffer.c | 6 +----- > 1 file changed, 1 insertion(+), 5 deletions(-) > > diff --git a/fs/buffer.c b/fs/buffer.c > index 1234ae343aef..3b60cd8456db 100644 > --- a/fs/buffer.c > +++ b/fs/buffer.c > @@ -988,8 +988,6 @@ grow_dev_page(struct block_device *bdev, sector_t block, > gfp_mask |= __GFP_NOFAIL; > > page = find_or_create_page(inode->i_mapping, index, gfp_mask); > - if (!page) > - return ret; > > BUG_ON(!PageLocked(page)); > > @@ -1008,9 +1006,7 @@ grow_dev_page(struct block_device *bdev, sector_t block, > /* > * Allocate some buffers for this page > */ > - bh = alloc_page_buffers(page, size, false); > - if (!bh) > - goto failed; > + bh = alloc_page_buffers(page, size, true); > > /* > * Link the page to the buffers and initialise them. Take the >