From patchwork Tue Oct 15 09:01:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13835936 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D53BC1E7C21; Tue, 15 Oct 2024 09:02:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728982956; cv=fail; b=qlNnRPjpU7kDv9d0/R/ebkGCPmV6R1OIpOazMefTk7qnaQ+v5jQ3pr7VHN/6JfjwoHUW01T5RDINnsbkfilU29kyPpgCBgHlfOooyFI7Zv7D+tZmMNiW4+6MZFdff2HFMju3NdzI2SAjeXbkj/XZuawceKj3OoEawksXqfuGDVs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728982956; c=relaxed/simple; bh=X3U10wfn6VZKScjWTDOaiqO+ijk2vv06rH73YhyzAOs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=hkH3SrqOZUcoUwHY+dk6p+CE5oD/rEjJ3U2uf8gYY1Ltfp2k1CP8PxYqtuuzlwrh5beslRgemuvcl5YHG7/1LGiftid6GdIfWXS/TiWUbeYKnmDN4GJN17um63aLIKntZGNOOPGNa+WFgyMuYeTKRf7VDLonlRfMJFrSuXrQxOY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=MMTS/Gn0; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=Kv6qr9dM; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="MMTS/Gn0"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="Kv6qr9dM" Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49F6F53C029379; Tue, 15 Oct 2024 09:02:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=3Wz+PKAUG3I3uWHJFoCK8hDmtQ0OHydkijKbkOLn0cE=; b= MMTS/Gn08zbhyfR9000PL8KE6v2ys5n9QQFsvaoEVxtFTeRYyMo8C1nCgTNqPWx6 p7rIhFT8uETgd3NafM0nMKmLEm7i1ltqBUCc69gry6T1pKtiiuPO8gW/qfQoiShU D2JC4gxv5Wp/Fec/H4Yk68ltqiQ2K9oPPdWfYjg8MA6T3ofQ9dGpU3L1EwjSh0Hn HqdkvfMgqRscQTv/W5aQxPV9iFpd+25Z16ZUd7MF6oqJO+bdxATngmHMAFAf50l+ ShyWTjWuimMzMHCCMLqpvTq+onHnqxSxgRAKT6RrXH4D4GZ1QjCV7cw4up871QIO +GX9W9/el6U0eg61tRth7w== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 427hnt8anv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Oct 2024 09:02:11 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49F90aRp010968; Tue, 15 Oct 2024 09:01:57 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2171.outbound.protection.outlook.com [104.47.59.171]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 427fjdehqu-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Oct 2024 09:01:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=e2iW9cP1jQcko1qO013LuiQkoBzWWP9CJdjZ6AflA5V9C1NMwg6pzTXVECwvHYBpBGyANvgQlknkDA/LZBoQm+/X06mVhTvOTJU4SaLJZX3uLphdcb75Wb5CHHvuQdZ62q0Mq+naucYrWmkp62gAKwF6rcSZWzLwjKsl+Y3vofwpUdY653v3LO7Os/qNY31trOfibVxfTSo7IJSOQPQnIWRSVmVbUo4/DppxsSWlMxWJxoRZX6P55a2Sgvzcx5Zl1fwUqfkELLeZWW8U1pkuYHyFm+TqwdVx/PgTSdHM7BrFAP4X1yGwtqOb3MHkVTS/qJFgRMJaOBq+G9d0OUh5Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3Wz+PKAUG3I3uWHJFoCK8hDmtQ0OHydkijKbkOLn0cE=; b=FUK/FxWISClT19ZQhTrjEwfXCar++jEASrMzK+m9u3DGa+kmmx1o40uuaIvT30MAHInYNf+eIRIO0fFVXUbXSMJgo/AQibnd+rzOOxMrZqgBWwfC1lUTDZaUNW6a0WlBFp018EPrq7QtZfMY4OiyFLaf8rgwTI6OEq7Fs6aqskzYX29ho2sStHqGFjkq9BQ17UPOMX4PsGCWp+zhwued7Ba8R+4TtnARuabdGR5ECFMGe+737s+RB08iCyHZ+PYe9P7qeCDvQlzqGYjXBjI1blqdJMJUIWU0+Ah1z1CxzWmJ+g0jdySw3OsN2k75uY3FmQN1VxUvoClhh331wW27FQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3Wz+PKAUG3I3uWHJFoCK8hDmtQ0OHydkijKbkOLn0cE=; b=Kv6qr9dMiyH86pFEwO35YFA6qTnP98DQ6typGT7QAQEjLQnFMnVvNNthyWrnqZR6HKdccGs16V7RaUQyQa+CS/EMnOMu3WRcY2eiIXjoNOjWfUtREYmzrCx7vHjaZiXmzafmQfxWEenEYJq8g+pfs8ZzZKOsNXyrc/NM3tuK1yg= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by CY5PR10MB6093.namprd10.prod.outlook.com (2603:10b6:930:3a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17; Tue, 15 Oct 2024 09:01:54 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%4]) with mapi id 15.20.8048.020; Tue, 15 Oct 2024 09:01:54 +0000 From: John Garry To: axboe@kernel.dk, brauner@kernel.org, djwong@kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz, dchinner@redhat.com, hch@lst.de, cem@kernel.org Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, hare@suse.de, martin.petersen@oracle.com, catherine.hoang@oracle.com, mcgrof@kernel.org, ritesh.list@gmail.com, ojaswin@linux.ibm.com, John Garry Subject: [PATCH v8 1/7] block/fs: Pass an iocb to generic_atomic_write_valid() Date: Tue, 15 Oct 2024 09:01:36 +0000 Message-Id: <20241015090142.3189518-2-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241015090142.3189518-1-john.g.garry@oracle.com> References: <20241015090142.3189518-1-john.g.garry@oracle.com> X-ClientProxiedBy: BL1PR13CA0154.namprd13.prod.outlook.com (2603:10b6:208:2bd::9) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|CY5PR10MB6093:EE_ X-MS-Office365-Filtering-Correlation-Id: 33cc5779-dd7c-430d-b595-08dcecf803b2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|366016|1800799024; X-Microsoft-Antispam-Message-Info: TQrpOFF9EZrv3f45ucM2YHDTIbjjLuJlO+zkhimK5giCsjhSHOAJb0r9npezgmrXJhMgkZsquy2FsC4yfLLTcPs2R9FLRPqft1w5SASCy3HC8rHiPnt2dgmhdzdKhg4s81vDgkK9+fRHtBkDc/V2Hsr4OQvvZ1jLwev7kVq7v6m7z/oT1DIf60eFbM+jYAyUqe31tJ5f8dwHbuTips6vJzfdvMZBPkAhAJv/kowxz1/NosNfvupMbrXZfXiFIILBBU9Mo4XCt9AAgF1ucI1K3U5PWx0Kvd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:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(376014)(366016)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OYfcxssWs4F+0+LOpndbhxQ+/8Cz+LEakq3VOzhKHXcqpR70j0uYR9CNxnKMs0+8KBMi6wZzm5kurxchnucfjHO2NJ81mnSPtt1ebtiwi8ndRkG0X1k5w4q0xtEMnIfCsNdA/kO371vdhMc9Owi8SVrT3Q8a4cpu8GE0Z51PuU3XoV1cPhTDknMu7W1muNSZ0u5WawpvachzH0JPo7ID53QN/tzp6E2mzwca1SYNHr5A9pX1I8oPpPMCjNhUxHAZLTKGvA/R9ZQ5zq+tgtX9TjRoxxrjJdsixQ7tsXNTsEOalSYX5bWbn1vk4VLo+P4SdjtmSsHVkvrre6gBlm9lyrE0b31SAhkcH9hJUCQ55Qp1sW+knNdS0c+QNGmmd7NIdapkxiq82iXLyHzlGjCcc5goiftCXm7U7fJ/qF7hEZG5LOdb1IikPUatyc5IbRNhrkouFOdcBPyNkLYoGgk7aVFa6S/jsO7j1+O0aOety98DgFvZymI1JSNTOP15NaQ4f8gqYhf/bopHaic+TZQbZua5HJrBVVg+uwHq7jpATOMKF99zPJRnvvCdK9Bg+et+cboXy5c7Lk8uMcFpR0P9FGPX5gaOoUuvdojAA8c72WP47399sJWbYcTt3EiHiIldB1JvHqIqbYBuBib+nZZG0QgqQdV2TJppMsMqVFnBCEEdiIT9j4trBi1cCDjApYSRAZPtr2T+fPhlYEAfcuhByNwDFpTrawlf8sGUR49lWv6Iybm/ArG1fceA5RfcEoUtyWT07Vm/0cYz7x8yUveEIsKT3mvbdMYI+Bjwj+FEkcUNeRCOwOvWDE7Goi3orlA3VO9F3/kl8giYvdYAIuvCl1fBo062Tc9p1I8KUH5Y1PmzFxp1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qMRt2a0XFIg3IRCa5FoMz0wO0gFTcSnJEFjAahUuUGzdUFeo8BNfcqy3TocyPW31H2ADT7QZOaS8sq7XaZxwOads9vBIbVBzNiVLkysQO4UmVkv2FM+8aoiVA7QZ9esNoPV9GQ9GclfDjc8kdV6vQa1lNOlgeGuP1FcN0BqZZWcnufFl4KoZ0vzn0im36P0DYrv1VYz9cVgMLLkTdeudGWpr9FabEVt91Bor0ZAuSZP3J3esAcRXPI309SrKHGdRRdawYMqD/ykLh8280Mo3iVmJ/iwHmyU4zRmlOBpL8R6e4yo9v5i+evsxnAcOY9OL5+nwvA2HgfJ7ZweTEBKqN1xb/bHIWslcFQp56wSiwcS0UxSo1A= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 33cc5779-dd7c-430d-b595-08dcecf803b2 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 09:01:53.9757 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: n/AzC4Xw/TvcPiMAG07pzDENqEzHBLQFim1Er4yD4McSQlRMUM8pyXP4shS/jpILOKydnAUnYNdhYsPsDIow5Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR10MB6093 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_05,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 adultscore=0 spamscore=0 mlxscore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410150060 X-Proofpoint-ORIG-GUID: Uqejx3LkqsfNB_L4sD_mFDkjx13CYNDB X-Proofpoint-GUID: Uqejx3LkqsfNB_L4sD_mFDkjx13CYNDB Darrick and Hannes both thought it better that generic_atomic_write_valid() should be passed a struct iocb, and not just the member of that struct which is referenced; see [0] and [1]. I think that makes a more generic and clean API, so make that change. [0] https://lore.kernel.org/linux-block/680ce641-729b-4150-b875-531a98657682@suse.de/ [1] https://lore.kernel.org/linux-xfs/20240620212401.GA3058325@frogsfrogsfrogs/ Fixes: c34fc6f26ab8 ("fs: Initial atomic write support") Suggested-by: "Darrick J. Wong" Suggested-by: Hannes Reinecke Reviewed-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig Signed-off-by: John Garry --- block/fops.c | 8 ++++---- fs/read_write.c | 4 ++-- include/linux/fs.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/block/fops.c b/block/fops.c index e696ae53bf1e..968b47b615c4 100644 --- a/block/fops.c +++ b/block/fops.c @@ -35,13 +35,13 @@ static blk_opf_t dio_bio_write_op(struct kiocb *iocb) return opf; } -static bool blkdev_dio_invalid(struct block_device *bdev, loff_t pos, +static bool blkdev_dio_invalid(struct block_device *bdev, struct kiocb *iocb, struct iov_iter *iter, bool is_atomic) { - if (is_atomic && !generic_atomic_write_valid(iter, pos)) + if (is_atomic && !generic_atomic_write_valid(iocb, iter)) return true; - return pos & (bdev_logical_block_size(bdev) - 1) || + return iocb->ki_pos & (bdev_logical_block_size(bdev) - 1) || !bdev_iter_is_aligned(bdev, iter); } @@ -374,7 +374,7 @@ static ssize_t blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter) if (!iov_iter_count(iter)) return 0; - if (blkdev_dio_invalid(bdev, iocb->ki_pos, iter, is_atomic)) + if (blkdev_dio_invalid(bdev, iocb, iter, is_atomic)) return -EINVAL; nr_pages = bio_iov_vecs_to_alloc(iter, BIO_MAX_VECS + 1); diff --git a/fs/read_write.c b/fs/read_write.c index 64dc24afdb3a..2c3263530828 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -1830,7 +1830,7 @@ int generic_file_rw_checks(struct file *file_in, struct file *file_out) return 0; } -bool generic_atomic_write_valid(struct iov_iter *iter, loff_t pos) +bool generic_atomic_write_valid(struct kiocb *iocb, struct iov_iter *iter) { size_t len = iov_iter_count(iter); @@ -1840,7 +1840,7 @@ bool generic_atomic_write_valid(struct iov_iter *iter, loff_t pos) if (!is_power_of_2(len)) return false; - if (!IS_ALIGNED(pos, len)) + if (!IS_ALIGNED(iocb->ki_pos, len)) return false; return true; diff --git a/include/linux/fs.h b/include/linux/fs.h index e3c603d01337..fbfa032d1d90 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -3721,6 +3721,6 @@ static inline bool vfs_empty_path(int dfd, const char __user *path) return !c; } -bool generic_atomic_write_valid(struct iov_iter *iter, loff_t pos); +bool generic_atomic_write_valid(struct kiocb *iocb, struct iov_iter *iter); #endif /* _LINUX_FS_H */