From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bombadil.infradead.org ([65.50.211.133]:42853 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751362AbdLFSXF (ORCPT ); Wed, 6 Dec 2017 13:23:05 -0500 Date: Wed, 6 Dec 2017 10:23:04 -0800 From: Matthew Wilcox To: Harish Kasiviswanathan Cc: guaneryu@gmail.com, linux-fsdevel@vger.kernel.org, Felix.Kuehling@amd.com Subject: Re: [PATCH v3] direct-io: Fix unsigned comparison overflow Message-ID: <20171206182304.GA7829@bombadil.infradead.org> References: <1512579438-4854-1-git-send-email-Harish.Kasiviswanathan@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1512579438-4854-1-git-send-email-Harish.Kasiviswanathan@amd.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Wed, Dec 06, 2017 at 11:57:18AM -0500, Harish Kasiviswanathan wrote: > The first write after file create fails to take the direct IO > (Peer-to-Peer) path and falls back to slower software copy. The function > get_more_block() sets 'create' to 0 after comparing 'unsigned long > fs_startblk = 0' with 'long long (i_size_read(dio->inode) - 1) >> > i_blkbits = 0xfffffffffffff'. > > v2: Instead of casting to loff_t check explicitly if i_size > 0 > v3: Use cached dio->i_size instead of i_size_read() which isn't cheap on > 32-bit SMP > > Signed-off-by: Harish Kasiviswanathan Reviewed-by: Matthew Wilcox