From patchwork Wed May 16 05:43:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10402633 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0506B601F9 for ; Wed, 16 May 2018 05:44:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E979528733 for ; Wed, 16 May 2018 05:44:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DDA6428761; Wed, 16 May 2018 05:44:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 55DF228733 for ; Wed, 16 May 2018 05:44:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D511A6B02F1; Wed, 16 May 2018 01:44:48 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id CD94F6B02F2; Wed, 16 May 2018 01:44:48 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B7BC86B02F3; Wed, 16 May 2018 01:44:48 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f72.google.com (mail-pl0-f72.google.com [209.85.160.72]) by kanga.kvack.org (Postfix) with ESMTP id 6E6886B02F1 for ; Wed, 16 May 2018 01:44:48 -0400 (EDT) Received: by mail-pl0-f72.google.com with SMTP id f11-v6so1953266plj.23 for ; Tue, 15 May 2018 22:44:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=L23eaBlfE/D5Ghn3Hbf+SOMmAkN/buFHegZOuKo4sms=; b=QAJlIF+qzrf+/vgeLFqGelb2IGsvmsOATProLsfEgyh0JPqobKJbCFogingd1okXxR mN5IlrWkm9m2viQQqkpIV9QbufqOlfSO84eXiNAjhK4Pznbb+KBJwc5nNXPU78cu3zY0 Xmy0y3S9zy6hiYf1S9F5T0vM9mw7RBJcUgiCD40TXuUct5z0BmsmQUgeyt+olcERp0ex NFTVa6Xhp/mnknnUn89DQNQJ1PiLfOXdw1mtTLudkG/os6oUmcdw8CTrbpbcuWsVmp81 sr6CECujmpNuQBZgs1Bf2vcokdU3knqDmDlZvC4xecRWqf1imLOWPyLb6WKKFnaHJMb+ FCSQ== X-Gm-Message-State: ALKqPwcWTMdBzp/+wjyWSIYbhuBVKiVELQkJx5Sw7UH16khNZTs10E5E j36rZkmGFXVHVZ9+eqfs6owl92teOCosD+8o/KccquGfasi56KZSBSuTlP8o/stOEVH1OLNQP14 aGq1iymYme+3xllUbEvUtwycbSJ0LefwKb1JK54at1EKq7//5uxyphrub6ue5a08= X-Received: by 2002:a17:902:3001:: with SMTP id u1-v6mr17537814plb.376.1526449488129; Tue, 15 May 2018 22:44:48 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpRVYwh2iCaqvveTf6wllvISPz+xnPZ9olgohDWX1ayLvUNVCEEf0ON+iwWqE7/A8r6c3AY X-Received: by 2002:a17:902:3001:: with SMTP id u1-v6mr17537773plb.376.1526449487447; Tue, 15 May 2018 22:44:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526449487; cv=none; d=google.com; s=arc-20160816; b=qCjpWIhffpzFP1a2OTHaoXqmolFm8P0SmC7rleo4fgQhS6afFBXCBxxN7ZJV9H3WWf D4NEFVoGF7wOkdvz4bo9Q/5AnLqECOBhD78poEIaf8Psxlutyth+KDyKqF496334KQa2 dGfcele0jA8v4gbIZbs3HPPVQTuOWOBNbzlcJfvM2QtWROZ6ltsTkr5fiFTS3LXAK3o4 TO6kgc4mwIlf0Lkm/qGm2y8lPSyK0iEJQVPR7ri2tMfR4I56NQLScTrt3IYOheF/8XSy RsSUWCi6N9ziE65DEuNkdW3K1z8/hGFb4Qtr3GN9xboKFfBELRKdD1ShL2MpOOQnz/1K o8wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=L23eaBlfE/D5Ghn3Hbf+SOMmAkN/buFHegZOuKo4sms=; b=LFRTzmWLRAJQWshqlrWZoeMZlFbTg0IzQOdpod8qrgL2cvAjQz5VpWWl8EkUHzAX/j 3GACahuv37gpiBgbYI3t+ewG7f+nyQdA98xQRGDcZaZ13zilYiZkpn817xoe0ynhin8M FrJowp/lfUTX30IXEgYo6Exylw/wcIl/Ajr1fvzFeQBoSvA8k6kxXKdIFjyrKyVGjzmv FpP2zLmZZC3jHrxTvOpJB85mW+u5+0u5Y5+oqY3paWDUZtJK7GOgczc8ZV9O1AeF0haR KPYA/C8rQdEqLXsiAP/EhFInPoPAO4oBmth2SrQvBVR7CHBTTITHkpMEDEEXqrVqWOtU WeKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=qCyC072o; spf=pass (google.com: best guess record for domain of batv+8c5add14d4fec8f33fc9+5379+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+8c5add14d4fec8f33fc9+5379+infradead.org+hch@bombadil.srs.infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id q4-v6si1546133pgr.549.2018.05.15.22.44.47 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 May 2018 22:44:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+8c5add14d4fec8f33fc9+5379+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=qCyC072o; spf=pass (google.com: best guess record for domain of batv+8c5add14d4fec8f33fc9+5379+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+8c5add14d4fec8f33fc9+5379+infradead.org+hch@bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=L23eaBlfE/D5Ghn3Hbf+SOMmAkN/buFHegZOuKo4sms=; b=qCyC072oJWmV7BpwKPSss/G29 Y0zR1N1gfa3uKGzjU38PJgxv0Qv9MIXHx4NJo5FsGvSjASnxUazrmaPYuNX248724r+pRMNQLKh/8 FEY2kqMkATnniSzx7QlS/3KBmm+IdgsBD6dNofV9Md7omQbg/e9V7lRU/o4WeRrHfDJK9p68V4m+O Wvt89FYt2RVQ254H8oo1HFGeC12uiSdqmIMmR5U9wwqGM06Z1LiD2FGb1w7YVI8Bv73m0Lp29Xpsy KQ7bbkXgasAg/e2JFIiai1z5BxrApgclhSvnqPyawWigFwo2JRtgujyWhtjmXtbR4ho/6Scz5dBnY edFvnyGmA==; Received: from [93.83.86.253] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fIpEV-00086g-8n; Wed, 16 May 2018 05:44:15 +0000 From: Christoph Hellwig To: Souptick Joarder , Matthew Wilcox Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, devel@lists.orangefs.org, ceph-devel@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, ocfs2-devel@oss.oracle.com, linux-mtd@lists.infradead.org, dri-devel@lists.freedesktop.org, lustre-devel@lists.lustre.org, linux-arm-kernel@lists.infradead.org, linux-s390@vger.kernel.org Subject: [PATCH 07/14] ext4: separate errno from VM_FAULT_* values Date: Wed, 16 May 2018 07:43:41 +0200 Message-Id: <20180516054348.15950-8-hch@lst.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180516054348.15950-1-hch@lst.de> References: <20180516054348.15950-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Christoph Hellwig --- fs/ext4/ext4.h | 4 ++-- fs/ext4/inode.c | 30 +++++++++++++++--------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index fa52b7dd4542..48592d0edf3e 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -2463,8 +2463,8 @@ extern int ext4_writepage_trans_blocks(struct inode *); extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks); extern int ext4_zero_partial_blocks(handle_t *handle, struct inode *inode, loff_t lstart, loff_t lend); -extern int ext4_page_mkwrite(struct vm_fault *vmf); -extern int ext4_filemap_fault(struct vm_fault *vmf); +extern vm_fault_t ext4_page_mkwrite(struct vm_fault *vmf); +extern vm_fault_t ext4_filemap_fault(struct vm_fault *vmf); extern qsize_t *ext4_get_reserved_space(struct inode *inode); extern int ext4_get_projid(struct inode *inode, kprojid_t *projid); extern void ext4_da_update_reserve_space(struct inode *inode, diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 95bc48f5c88b..fe49045a2832 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -6106,27 +6106,27 @@ static int ext4_bh_unmapped(handle_t *handle, struct buffer_head *bh) return !buffer_mapped(bh); } -int ext4_page_mkwrite(struct vm_fault *vmf) +vm_fault_t ext4_page_mkwrite(struct vm_fault *vmf) { struct vm_area_struct *vma = vmf->vma; struct page *page = vmf->page; loff_t size; unsigned long len; - int ret; + vm_fault_t ret; struct file *file = vma->vm_file; struct inode *inode = file_inode(file); struct address_space *mapping = inode->i_mapping; handle_t *handle; get_block_t *get_block; - int retries = 0; + int retries = 0, err; sb_start_pagefault(inode->i_sb); file_update_time(vma->vm_file); down_read(&EXT4_I(inode)->i_mmap_sem); - ret = ext4_convert_inline_data(inode); - if (ret) + err = ext4_convert_inline_data(inode); + if (err) goto out_ret; /* Delalloc case is easy... */ @@ -6134,9 +6134,9 @@ int ext4_page_mkwrite(struct vm_fault *vmf) !ext4_should_journal_data(inode) && !ext4_nonda_switch(inode->i_sb)) { do { - ret = block_page_mkwrite(vma, vmf, + err = block_page_mkwrite(vma, vmf, ext4_da_get_block_prep); - } while (ret == -ENOSPC && + } while (err == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)); goto out_ret; } @@ -6181,8 +6181,8 @@ int ext4_page_mkwrite(struct vm_fault *vmf) ret = VM_FAULT_SIGBUS; goto out; } - ret = block_page_mkwrite(vma, vmf, get_block); - if (!ret && ext4_should_journal_data(inode)) { + err = block_page_mkwrite(vma, vmf, get_block); + if (!err && ext4_should_journal_data(inode)) { if (ext4_walk_page_buffers(handle, page_buffers(page), 0, PAGE_SIZE, NULL, do_journal_get_write_access)) { unlock_page(page); @@ -6193,24 +6193,24 @@ int ext4_page_mkwrite(struct vm_fault *vmf) ext4_set_inode_state(inode, EXT4_STATE_JDATA); } ext4_journal_stop(handle); - if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) + if (err == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) goto retry_alloc; out_ret: - ret = block_page_mkwrite_return(ret); + ret = block_page_mkwrite_return(err); out: up_read(&EXT4_I(inode)->i_mmap_sem); sb_end_pagefault(inode->i_sb); return ret; } -int ext4_filemap_fault(struct vm_fault *vmf) +vm_fault_t ext4_filemap_fault(struct vm_fault *vmf) { struct inode *inode = file_inode(vmf->vma->vm_file); - int err; + vm_fault_t ret; down_read(&EXT4_I(inode)->i_mmap_sem); - err = filemap_fault(vmf); + ret = filemap_fault(vmf); up_read(&EXT4_I(inode)->i_mmap_sem); - return err; + return ret; }