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=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 F32F7C4332B for ; Thu, 19 Mar 2020 09:03:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D05CF2051A for ; Thu, 19 Mar 2020 09:03:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726623AbgCSJDj (ORCPT ); Thu, 19 Mar 2020 05:03:39 -0400 Received: from verein.lst.de ([213.95.11.211]:40823 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725768AbgCSJDj (ORCPT ); Thu, 19 Mar 2020 05:03:39 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 340E968BEB; Thu, 19 Mar 2020 10:03:36 +0100 (CET) Date: Thu, 19 Mar 2020 10:03:36 +0100 From: Christoph Hellwig To: Nikolay Borisov Cc: Omar Sandoval , linux-btrfs@vger.kernel.org, kernel-team@fb.com, Christoph Hellwig Subject: Re: [PATCH 15/15] btrfs: unify buffered and direct I/O read repair Message-ID: <20200319090336.GA1577@lst.de> References: <7c593decda73deb58515d94e979db6a68527970b.1583789410.git.osandov@fb.com> <37bf11cc-92b3-2b15-ee87-0cbe8c662cc7@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <37bf11cc-92b3-2b15-ee87-0cbe8c662cc7@suse.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Thu, Mar 19, 2020 at 10:53:22AM +0200, Nikolay Borisov wrote: > Is this correct though, in case of buffered reads we are always called > with bi_status != BLK_STS_OK (we are called from end_bio_extent_readpage > in case uptodate is false, which happens if failed_bio->bi_status is > non-zero. Additionally the bio is guaranteed to not be cloned because > there is : ASSERT(!bio_flagged(bio, BIO_CLONED)); > If I understand this correctly this is the "this is a DIO " branch. IMO > it'd be clearer if you had bool is_dio = bio_flagged(failed_bio, > BIO_CLONED) at the top of the function and you used that. The non-fragile way would be to pass an explicit is_bio argument. The is cloned thing is just a side effect of the weird cloning done in the bio path, which hopefully won't survive too long.