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=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, 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 A5BB2C43331 for ; Fri, 27 Mar 2020 08:10:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6FA1B20714 for ; Fri, 27 Mar 2020 08:10:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Rw0Ww4UY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726515AbgC0IKZ (ORCPT ); Fri, 27 Mar 2020 04:10:25 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:53416 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726027AbgC0IKZ (ORCPT ); Fri, 27 Mar 2020 04:10:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=RxHv9kYc/4ftbGH13qfOO4Yug8p1pMMg7j9QR/DQN08=; b=Rw0Ww4UYt0tIR5VtBuID+OESHr sOiX39A7ReHAnwkSDxWOixkJGt6P1p5zNYcQDkDj6ccJoJ+/bitewYe40rNbPMLktXjfLL9/XRJAw MGgJkYnXtZ2zS714hzJb/OEiNbP5TS6Aa4tb4dFts3jrDEKTDKMM6RywxX4Vn/V6gJgg5dYxzgIyU nIS61BpbFf7jRvibtk3zgflBPPxwuOVmgi4tDImudZYgRylEJM3O/ajTh179C+L8ehwfL2dUQi+f0 JdaBd8WU0Pp49NP1FDOhJhDjiUHJsm+1kDe/zIkzAoVOSpvZClZM1SyYLQGRlEqYVwclvho3rOAnJ QUsZldxg==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jHk4O-00080S-Ia; Fri, 27 Mar 2020 08:10:24 +0000 Date: Fri, 27 Mar 2020 01:10:24 -0700 From: Christoph Hellwig To: Goldwyn Rodrigues Cc: linux-btrfs@vger.kernel.org, Goldwyn Rodrigues Subject: Re: [PATCH 4/9] btrfs: Switch to iomap_dio_rw() for dio Message-ID: <20200327081024.GA24827@infradead.org> References: <20200326210254.17647-1-rgoldwyn@suse.de> <20200326210254.17647-5-rgoldwyn@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200326210254.17647-5-rgoldwyn@suse.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Thu, Mar 26, 2020 at 04:02:49PM -0500, Goldwyn Rodrigues wrote: > BTRFS direct I/O is now done under i_rwsem, shared in case of > reads and exclusive in case of writes. This guards against simultaneous > truncates. Btw, you really want to add the optimization of only taking it shared for all the easy write cases similar to what XFS has done for ages and what ext4 picked up now. Without that performance on someworkloads is going to be horrible. That could be a patch on top of this one, though. > +/* > + * btrfs_direct_IO - perform direct I/O > + * inode->i_rwsem must be locked before calling this function, shared or exclusive. > + * @iocb - kernel iocb > + * @iter - iter to/from data is copied This adds a way too long line. Also kerneldoc comments go below the arguments. Last but not least a lockdep_assert_held is much more useful than comments trying to document locking patterns..