[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170424152708.GK9112@infradead.org>
Date: Mon, 24 Apr 2017 08:27:08 -0700
From: Christoph Hellwig <hch@...radead.org>
To: Jeff Layton <jlayton@...hat.com>
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-btrfs@...r.kernel.org, linux-ext4@...r.kernel.org,
linux-cifs@...r.kernel.org, linux-mm@...ck.org,
jfs-discussion@...ts.sourceforge.net, linux-xfs@...r.kernel.org,
cluster-devel@...hat.com, linux-f2fs-devel@...ts.sourceforge.net,
v9fs-developer@...ts.sourceforge.net, osd-dev@...n-osd.org,
linux-nilfs@...r.kernel.org, linux-block@...r.kernel.org,
dhowells@...hat.com, akpm@...ux-foundation.org, hch@...radead.org,
ross.zwisler@...ux.intel.com, mawilcox@...rosoft.com,
jack@...e.com, viro@...iv.linux.org.uk, corbet@....net,
neilb@...e.de, clm@...com, tytso@....edu, axboe@...nel.dk
Subject: Re: [PATCH v3 11/20] cifs: set mapping error when page writeback
fails in writepage or launder_pages
On Mon, Apr 24, 2017 at 09:22:50AM -0400, Jeff Layton wrote:
> Signed-off-by: Jeff Layton <jlayton@...hat.com>
> ---
> fs/cifs/file.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/fs/cifs/file.c b/fs/cifs/file.c
> index 21d404535739..4b696a23b0b1 100644
> --- a/fs/cifs/file.c
> +++ b/fs/cifs/file.c
> @@ -2234,14 +2234,16 @@ cifs_writepage_locked(struct page *page, struct writeback_control *wbc)
> set_page_writeback(page);
> retry_write:
> rc = cifs_partialpagewrite(page, 0, PAGE_SIZE);
> + if (rc == -EAGAIN && wbc->sync_mode == WB_SYNC_ALL) {
> goto retry_write;
> + } else if (rc == -EAGAIN) {
> redirty_page_for_writepage(wbc, page);
> + } else if (rc != 0) {
> SetPageError(page);
> + mapping_set_error(page->mapping, rc);
> + } else {
> SetPageUptodate(page);
> + }
Hmmm. I might be a little too nitpicky, but I hate having the same
partial condition duplicated if possible. Why not:
if (rc == -EAGAIN) {
if (wbc->sync_mode == WB_SYNC_ALL)
goto retry_write;
redirty_page_for_writepage(wbc, page);
} else if (rc) {
SetPageError(page);
mapping_set_error(page->mapping, rc);
} else {
SetPageUptodate(page);
}
Otherwise this looks fine to me:
Reviewed-by: Christoph Hellwig <hch@....de>
Powered by blists - more mailing lists