Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751244AbeACCIK (ORCPT + 1 other); Tue, 2 Jan 2018 21:08:10 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:43372 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750996AbeACCII (ORCPT ); Tue, 2 Jan 2018 21:08:08 -0500 Date: Wed, 3 Jan 2018 02:08:05 +0000 From: Al Viro To: Sean Fu Cc: tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ext4: Remove repeated test in ext4_file_read_iter. Message-ID: <20180103020805.GB21978@ZenIV.linux.org.uk> References: <1514362798-5850-1-git-send-email-fxinrong@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1514362798-5850-1-git-send-email-fxinrong@gmail.com> User-Agent: Mutt/1.9.0 (2017-09-02) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Wed, Dec 27, 2017 at 04:19:58PM +0800, Sean Fu wrote: > generic_file_read_iter has done the count test. > So ext4_file_read_iter don't need to test the count repeatedly. Huh? You do realize that generic_file_read_iter() is not the only variant possible there, right? static ssize_t ext4_dax_read_iter(struct kiocb *iocb, struct iov_iter *to) { struct inode *inode = file_inode(iocb->ki_filp); ssize_t ret; if (!inode_trylock_shared(inode)) { if (iocb->ki_flags & IOCB_NOWAIT) return -EAGAIN; inode_lock_shared(inode); } ... and now IOCB_NOWAIT read with zero count can fail with -EAGAIN.