From patchwork Wed Oct 10 00:13:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10633575 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 076AE16B1 for ; Wed, 10 Oct 2018 00:13:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8EAD284C9 for ; Wed, 10 Oct 2018 00:13:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD11C28C31; Wed, 10 Oct 2018 00:13:32 +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=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY 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 738FB284C9 for ; Wed, 10 Oct 2018 00:13:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 676B06B027B; Tue, 9 Oct 2018 20:13:31 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5FC876B027C; Tue, 9 Oct 2018 20:13:31 -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 49EA86B027D; Tue, 9 Oct 2018 20:13:31 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by kanga.kvack.org (Postfix) with ESMTP id 1D5186B027B for ; Tue, 9 Oct 2018 20:13:31 -0400 (EDT) Received: by mail-pl1-f199.google.com with SMTP id f5-v6so2633668plf.11 for ; Tue, 09 Oct 2018 17:13:31 -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:subject:from:to:cc:date :message-id:in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=siIUmV5fQSYq9VGDzNEOdlZpC7I3EvWwNg8/jXArbuQ=; b=XmarlmSm+W+jW57FnceqXy8lMKIxwk/W2G2tbhJXfqFs04nhloNJjhtpp9Pv/S8Qva R5re36zV4VyBvmBfkW5ErTRZxAMtMJGITj39Gln/w1l0GdOzJ9r0izo8cYPB3U5JLg/c lYW/zkgGdcL+M19gRtms1UEzBZIMqj3qiMjcrDDmraK5g2PFTviGyfRuuaj3aWAgV9Xv kyKqb7CbmOQosNKBhYuCMFBvkrwvB99FFBwIXpVLF6XVYTljgR9Q1eTOoH5zu1/UzSEI xdQpXtbFWzZHql6O65G0f09DkFWxNLCzehvwoRhKo8893rcCgsjI0uy+UZAlSQAy4p9Z nRtQ== X-Gm-Message-State: ABuFfog5auc6CoIyL0G62USrz7B/RsysHyy0AasixrxPdaV4udDLUtvJ J7D8R8dPxpv15dFsKqxw6c8xpVJGfBeYvCEXbtvz2ZXqWYtLtWsA5BPKewPq2URgdmXv2rjFXvK IzVWD0NXBU+jujobAouwITubMXEYR908K+AYkaxEtRDDALqJWAAFsyMnP1+SrmdM4YA== X-Received: by 2002:a63:4a64:: with SMTP id j36-v6mr27641415pgl.168.1539130410790; Tue, 09 Oct 2018 17:13:30 -0700 (PDT) X-Google-Smtp-Source: ACcGV62VfMTfJMR9SBtAqb7aokYNxpoK2Wsdm+XpjtDXVk9Sg3Kr4CPS1V7pYu5F4AlwrYuRRd9K X-Received: by 2002:a63:4a64:: with SMTP id j36-v6mr27641376pgl.168.1539130409997; Tue, 09 Oct 2018 17:13:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539130409; cv=none; d=google.com; s=arc-20160816; b=a82OzfqG/gDxYv5+Uj19qo4XpW/W2f2Qf39gCncxI5/oEFR8nndPm/u/9/hnXiPRDT yjlhIJH5dkiNh3gE/rAQ+5j5KFbsxtOjS7bMP2vR6NzsClgnwqwtALolChXgmpWqaiHO UEiHUs66N8kn6+0qMJ0qSdyot6//WGBMcbvOznFvfVVt0nQ0hwlvTZmN9BRgQ5mRBdZy 81xZokPBs4tII0gId+cyHxrsPU8LetGt6wQcngO0YiziqH+kqArxVmY9nudvrgejk2QJ dU1Ok+o1AfCHm+beY0sIMa8pu9F+wWg3VVXW1m220a+A0HK1hwJ4lvliijX+x+ueJO/x lrLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:message-id:date:cc:to:from:subject:dkim-signature; bh=siIUmV5fQSYq9VGDzNEOdlZpC7I3EvWwNg8/jXArbuQ=; b=VaE+iske8ZlZsVZquBVrLhwqaFR8uJGrpmb7m8fzKOuuQdOGRPQr2LC2fPfGUrQNv3 WlxJmipQuKVw7f6jr4sInDv1l8gnpi/OkyYUk/gS9RUuQJ0WVmpCIaYsYb1ldjt92Ufr ojtNpkxwnymXC7WTbRWWmSkCWEH20EUqKG+ZEeeKCvtpig4pqPFaYt0HUzgsFjoixkQa VrZxFURscEIWhih53NdMTRrW7cwaxmsz634T6aw7Q70sy7juBYlcNoM5+TnBUEbGZd1N hOlljLImwhvwp8fgTHX/kDiojKQCODUMprP7d+gK7bVzyiN+71hmCjYXLnaPxUS1OAJY nC2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=dRBvfBl1; spf=pass (google.com: domain of darrick.wong@oracle.com designates 141.146.126.78 as permitted sender) smtp.mailfrom=darrick.wong@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from aserp2120.oracle.com (aserp2120.oracle.com. [141.146.126.78]) by mx.google.com with ESMTPS id u3-v6si22169284plz.353.2018.10.09.17.13.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Oct 2018 17:13:29 -0700 (PDT) Received-SPF: pass (google.com: domain of darrick.wong@oracle.com designates 141.146.126.78 as permitted sender) client-ip=141.146.126.78; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=dRBvfBl1; spf=pass (google.com: domain of darrick.wong@oracle.com designates 141.146.126.78 as permitted sender) smtp.mailfrom=darrick.wong@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w9A08vFt138883; Wed, 10 Oct 2018 00:13:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=siIUmV5fQSYq9VGDzNEOdlZpC7I3EvWwNg8/jXArbuQ=; b=dRBvfBl1duBd6ke/4HZcKCI0CAd8OrFE5vllDJGRh+zxmVeSjhZx/RcBBwTgbNKO+7sQ s1cdllzAyQWME/ChQe4xPnl1+jgJWB1Q8RlXJU8TgNcXYI8LgJPzZKMcYIgEN/TESzxi uDrdaAFO1LAVNMWeeu4mdznlvhv65Tfih6ATVmoKwimKSI7yVsro8NUVStfzjdwDhqI9 u6GS/xnXStYAxK4Md6qYAQZYjQvs3YVXYUNyoAy9jYi9OhsI4cm3z/9EXF8LXXXuW6+W 72J5sC2W5t6aTi7vk0oGu+8HJtHaGtRyQYdTKs940BCneaBFMwo3ljkeW8uJKeWuC6HF CQ== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2120.oracle.com with ESMTP id 2mxn0q0tqe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Oct 2018 00:13:29 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w9A0DN7u028744 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Oct 2018 00:13:23 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w9A0DNN8017378; Wed, 10 Oct 2018 00:13:23 GMT Received: from localhost (/10.159.249.114) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 10 Oct 2018 00:13:23 +0000 Subject: [PATCH 13/25] vfs: pass remap flags to generic_remap_checks From: "Darrick J. Wong" To: david@fromorbit.com, darrick.wong@oracle.com Cc: sandeen@redhat.com, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org, linux-unionfs@vger.kernel.org, linux-xfs@vger.kernel.org, linux-mm@kvack.org, linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, ocfs2-devel@oss.oracle.com Date: Tue, 09 Oct 2018 17:13:21 -0700 Message-ID: <153913040183.32295.16281682485157170773.stgit@magnolia> In-Reply-To: <153913023835.32295.13962696655740190941.stgit@magnolia> References: <153913023835.32295.13962696655740190941.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9041 signatures=668706 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=416 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810100000 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 From: Darrick J. Wong Pass the same remap flags to generic_remap_checks for consistency. Signed-off-by: Darrick J. Wong --- fs/read_write.c | 2 +- include/linux/fs.h | 2 +- mm/filemap.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/read_write.c b/fs/read_write.c index 47174785a94f..917934770b08 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -1755,7 +1755,7 @@ int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in, /* Check that we don't violate system file offset limits. */ ret = generic_remap_checks(file_in, pos_in, file_out, pos_out, len, - is_dedupe); + remap_flags); if (ret) return ret; diff --git a/include/linux/fs.h b/include/linux/fs.h index 0d9bdef0b4ea..56167b10cbad 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2976,7 +2976,7 @@ extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); extern ssize_t generic_write_checks(struct kiocb *, struct iov_iter *); extern int generic_remap_checks(struct file *file_in, loff_t pos_in, struct file *file_out, loff_t pos_out, - uint64_t *count, bool is_dedupe); + uint64_t *count, unsigned int remap_flags); extern ssize_t generic_file_read_iter(struct kiocb *, struct iov_iter *); extern ssize_t __generic_file_write_iter(struct kiocb *, struct iov_iter *); extern ssize_t generic_file_write_iter(struct kiocb *, struct iov_iter *); diff --git a/mm/filemap.c b/mm/filemap.c index 59056bd9c58a..e099c8880863 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -3004,7 +3004,7 @@ generic_remap_check_limits(struct file *file, loff_t pos, uint64_t *count) */ int generic_remap_checks(struct file *file_in, loff_t pos_in, struct file *file_out, loff_t pos_out, - uint64_t *req_count, bool is_dedupe) + uint64_t *req_count, unsigned int remap_flags) { struct inode *inode_in = file_in->f_mapping->host; struct inode *inode_out = file_out->f_mapping->host; @@ -3027,7 +3027,7 @@ int generic_remap_checks(struct file *file_in, loff_t pos_in, size_out = i_size_read(inode_out); /* Dedupe requires both ranges to be within EOF. */ - if (is_dedupe && + if ((remap_flags & RFR_IDENTICAL_DATA) && (pos_in >= size_in || pos_in + count > size_in || pos_out >= size_out || pos_out + count > size_out)) return -EINVAL;