Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2306150ybh; Fri, 24 Jul 2020 09:26:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz39ic0zCRFeHnlE0ZI0WiMLZDWaTbnPWhZh79Gg1+uTS8dvnLChcVrDvWOJFDs+ZAM45E1 X-Received: by 2002:a05:6402:22f0:: with SMTP id dn16mr9707716edb.83.1595607992594; Fri, 24 Jul 2020 09:26:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595607992; cv=none; d=google.com; s=arc-20160816; b=kJbjjJ9fISkIaZ1rbvdV7Ms8PGyBojjpjCBc9GCTCVhhi+PWmBRR48qzxMR5M79mX4 +d9W9zOjkdJQr1mwkGV2/rR9ySrI09ALWVbng0YHLwZ81xS4dAEHqBF0kVTNS9H/4yQM 0z2ApYx7gryU8qxS5dQSGnVNvYv2wcT+rz1d5MHMgEgN8BTJFSTHPgAJqzvdHrFLxutI p2ZTW81mDKSsmdvQpYBkdS808CqlzaU/raKTvusreFUgeK0A0xbw5lD7vv8vxI/yc0cB pbT5427pD8FxYIsM6ZYFyKdplHpcyMnqeFNzf3rswrd+uIGsDsiONj6VUWlJ5BXd2BVX oFhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=xc9JvOoe3FCec3K3v2rO1C6IyF+36UYIKKZhwsGDQp0=; b=LuanxpuzaeJXsgywAjx4sVcy+9EMB5bEjNTDN8Ziv8wm+kCNxmiE4MCpYhsCSq1BnX 93Awuz/T96b/sv39t2YIZ2BPySdIMwIkY85CEPlM1oFLHEVnt5rxlu43WBEr5+3VdVlK CD9C9tHA7BPOmfgyGNjz/NbyOJZLoGIK4yoIdhLsYyKMo4ijvMfHDgidj/fp7ZlWJjW5 RQrd7LeCekmf+a3awAsksWTxFABtaO9KKjyMayUWVIWY+ExZPftLYdKrQM1wCScsZbnn 3HWkPxesPoXJoZFzPjCUghnRCk3q5su/lXgETak2o6ZBbaI0bUHZ6Le2uiu97yMVkGxw pcsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=RBaQ8Jv7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f13si832708edy.138.2020.07.24.09.26.08; Fri, 24 Jul 2020 09:26:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=RBaQ8Jv7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726899AbgGXQXa (ORCPT + 99 others); Fri, 24 Jul 2020 12:23:30 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:59735 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726607AbgGXQX3 (ORCPT ); Fri, 24 Jul 2020 12:23:29 -0400 Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20200724162326epoutp029b6cbe4aa2fc6c94800de99762acc08f~kvNi4XWzp1101711017epoutp02E for ; Fri, 24 Jul 2020 16:23:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20200724162326epoutp029b6cbe4aa2fc6c94800de99762acc08f~kvNi4XWzp1101711017epoutp02E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1595607807; bh=xc9JvOoe3FCec3K3v2rO1C6IyF+36UYIKKZhwsGDQp0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RBaQ8Jv7PYoipwAbpdSUV9hxaxSXI77ickTNAEtwsfFeB8jY6Y6kC2KSrsdKp0xUt igKQQdVj7GTj/xQqqmm4QM70WzofNXc49+gJreE181cz3wHU93coyNXcbQkg3Nwr7F 4e7Yc7ODESQq8oOCYmcDInh3sLL1qbq3E7rACuN8= Received: from epsmges5p3new.samsung.com (unknown [182.195.42.75]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20200724162326epcas5p20a8f7970a6a546d0acce3eabd72f4cdf~kvNiU3JHw2787827878epcas5p2z; Fri, 24 Jul 2020 16:23:26 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id 7E.7B.09475.EFA0B1F5; Sat, 25 Jul 2020 01:23:26 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20200724155329epcas5p345ba6bad0b8fe18056bb4bcd26c10019~kuzYsjVlr1405014050epcas5p3t; Fri, 24 Jul 2020 15:53:29 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200724155329epsmtrp218904c25aa29bb8887fb44f9bbf1ec15~kuzYo8gB92867528675epsmtrp2V; Fri, 24 Jul 2020 15:53:29 +0000 (GMT) X-AuditID: b6c32a4b-39fff70000002503-a1-5f1b0afefb39 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 2A.02.08382.9F30B1F5; Sat, 25 Jul 2020 00:53:29 +0900 (KST) Received: from localhost.localdomain (unknown [107.110.206.5]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200724155326epsmtip1a5c04dab3e98b550817addc8dc8141c6~kuzWCzzyY0434704347epsmtip17; Fri, 24 Jul 2020 15:53:26 +0000 (GMT) From: Kanchan Joshi To: axboe@kernel.dk, viro@zeniv.linux.org.uk, bcrl@kvack.org Cc: willy@infradead.org, hch@infradead.org, Damien.LeMoal@wdc.com, asml.silence@gmail.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-aio@kvack.org, io-uring@vger.kernel.org, linux-block@vger.kernel.org, linux-api@vger.kernel.org, SelvaKumar S , Kanchan Joshi , Nitesh Shetty , Javier Gonzalez Subject: [PATCH v4 3/6] uio: return status with iov truncation Date: Fri, 24 Jul 2020 21:19:19 +0530 Message-Id: <1595605762-17010-4-git-send-email-joshi.k@samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1595605762-17010-1-git-send-email-joshi.k@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrLKsWRmVeSWpSXmKPExsWy7bCmpu4/Lul4gzNXBS1+T5/CajFn1TZG i9V3+9ksuv5tYbFobf/GZHF6wiImi3et51gsHt/5zG5x9P9bNosp05oYLTZ/72Cz2HtL22LP 3pMsFpd3zWGz2PZ7PrPFlSmLmC1e/zjJZnH+73FWi98/5rA5CHvsnHWX3WPzCi2Py2dLPTZ9 msTu0bdlFaPH501yHu0Hupk8Nj15yxTAEcVlk5Kak1mWWqRvl8CV8exzN0vBV66KyR+3MTYw fuLoYuTkkBAwkXi5+jdjFyMXh5DAbkaJyU/PsUI4nxgl1j+7zAbhfGOUeLPjGhNMy7LrU6Fa 9jJKrN78kQXC+cwoceLseqAWDg42AU2JC5NLQUwRARuJnUtUQEqYBZYzS0zo+MEKMkhYwE7i 9qwZbCA2i4CqxJavzewgNq+As8SNKf2sEMvkJG6e62QGsTkFXCQuXLzLCBHfwiExf1YQhO0i sfbjT2YIW1ji1fEt7BC2lMTnd3vZIOxiiV93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sICdxO1ZM9hAbBYBVYktX5vBhvIK OEvcmNLPCrFATuLmuU5mEJtTwEXiwsW7YPOFgGou/iifwMi3gJFhFaNkakFxbnpusWGBYV5q uV5xYm5xaV66XnJ+7iZGcBRoae5g3L7qg94hRiYOxkOMEhzMSiK8K75JxQvxpiRWVqUW5ccX leakFh9ilOZgURLnvVG4ME5IID2xJDU7NbUgtQgmy8TBKdXAtHaSecW85y8um2yRMzLV3fPZ om6NT1/3Ir8N9/sa9wsU9vr8LG+Ob+/ru/l3oUH8nV3J+Y13POXdr+XuOxWhwfHchKGA31Ly m2rZzPdTz9uEy/4TiXksyxbauszj6qZ1k3e77/TZvZv9yYtDCz9tefnOYZP67zUvEusEDnQv MP/5mXsnjzb3pyxnng3Oy5TrTR7zrOqvsZgSy3vq38z/3Gu8ZN3ZD/+vZGW4m1pU/WJpMOdk 2VfS7nr5Z9vjlKuMBLbqRy7eVPVbquxeI1+72s97DbMDK+6fTjycF7nm6exu018Ge60iNPvu xj0L8p00Pdc4s1qbcVt1mPb8s29nm7EcWjZX+v+v4I3pR/d9VWIpzkg01GIuKk4EAK7A5s/x AgAA X-CMS-MailID: 20200724155329epcas5p345ba6bad0b8fe18056bb4bcd26c10019 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20200724155329epcas5p345ba6bad0b8fe18056bb4bcd26c10019 References: <1595605762-17010-1-git-send-email-joshi.k@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: SelvaKumar S Make iov_iter_truncate to report whether it actually truncated. This helps callers which want to process the iov_iter in its entirety. Signed-off-by: SelvaKumar S Signed-off-by: Kanchan Joshi Signed-off-by: Nitesh Shetty Signed-off-by: Javier Gonzalez --- include/linux/uio.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/linux/uio.h b/include/linux/uio.h index 9576fd8..c681a60 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -241,7 +241,7 @@ static inline size_t iov_iter_count(const struct iov_iter *i) * greater than the amount of data in iov_iter is fine - it'll just do * nothing in that case. */ -static inline void iov_iter_truncate(struct iov_iter *i, u64 count) +static inline bool iov_iter_truncate(struct iov_iter *i, u64 count) { /* * count doesn't have to fit in size_t - comparison extends both @@ -249,8 +249,11 @@ static inline void iov_iter_truncate(struct iov_iter *i, u64 count) * conversion in assignement is by definition greater than all * values of size_t, including old i->count. */ - if (i->count > count) + if (i->count > count) { i->count = count; + return true; + } + return false; } /* -- 2.7.4