From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22C72C43462 for ; Fri, 16 Apr 2021 15:41:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 087AF613C5 for ; Fri, 16 Apr 2021 15:41:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343988AbhDPPmK (ORCPT ); Fri, 16 Apr 2021 11:42:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:58065 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343945AbhDPPmG (ORCPT ); Fri, 16 Apr 2021 11:42:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618587701; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Z7hKywyh1tZwRsR88gPcT7+lcF3bjYRsTQC5tN00FOc=; b=K9ECu2NbUdnzrTQAgnACwOfaAI6Avbvq13Szq63Y+icrVuOIS+i+nyS2PYC9p7GQCYXKvr n8G/OE7w12ACu+NyGgDhXZMncEcz65liyFChOCf/UYiog7kYEj0lI0THTVIydPiwDvgKFn ORtbrZYiOnucSX//E750tLN0kDYphK0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-479-f5l__WGOOmSV_y5Z4pL24A-1; Fri, 16 Apr 2021 11:41:36 -0400 X-MC-Unique: f5l__WGOOmSV_y5Z4pL24A-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ADB6D10054F6; Fri, 16 Apr 2021 15:41:35 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-119-35.rdu2.redhat.com [10.10.119.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id E4584107D5C2; Fri, 16 Apr 2021 15:41:34 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: References: <20210327035019.GG1719932@casper.infradead.org> <20210201130800.GP308988@casper.infradead.org> <2884397.1616584210@warthog.procyon.org.uk> <1507388.1616833898@warthog.procyon.org.uk> <20210327135659.GH1719932@casper.infradead.org> <20210327155630.GJ1719932@casper.infradead.org> <1720948.1617010659@warthog.procyon.org.uk> <1268214.1618326494@warthog.procyon.org.uk> To: Mike Marshall Cc: dhowells@redhat.com, Matthew Wilcox , linux-fsdevel Subject: Re: [RFC PATCH v2] implement orangefs_readahead MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1612828.1618587694.1@warthog.procyon.org.uk> Date: Fri, 16 Apr 2021 16:41:34 +0100 Message-ID: <1612829.1618587694@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org In orangefs_readahead(): loff_t bytes_remaining = inode->i_size - readahead_pos(rac); loff_t pages_remaining = bytes_remaining / PAGE_SIZE; What happens if bytes_remaining < PAGE_SIZE? Or even what happens if bytes_remaining % PAGE_SIZE != 0? if ((ret = wait_for_direct_io(ORANGEFS_IO_READ, inode, &offset, &iter, readahead_length(rac), inode->i_size, NULL, NULL, file)) < 0) I wonder if you should use iov_length(&iter) rather than readahead_length(rac). They *should* be the same. Also, should you cache inode->i_size lest it change under you due to truncate? David