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 Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7334FC77B7A for ; Thu, 25 May 2023 10:06:26 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1q27rT-0006Go-6X; Thu, 25 May 2023 10:06:23 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1q27rR-0006Gh-Q9 for linux-f2fs-devel@lists.sourceforge.net; Thu, 25 May 2023 10:06:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; 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:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=9Q+kM+TWjxXk+Cj89CRyijYjxLbQDo47dz+5qnhLfMA=; b=Mld8T8NyByGhflHLuYhWzUT+Ml Zw/lqEry4ARx3NBPh3wLCJz/oJCayIL6Q7IeFJ5aNdbnfxvW8LHTyGmlPEO5Y9hm7bpYBoxzoznv7 wAESEaew/Pg0iGJR8LscMbJxO9EywUV7WMCeqTk+AE3ugqzML7BT8cXW9bY3sPqRamkU=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; 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:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=9Q+kM+TWjxXk+Cj89CRyijYjxLbQDo47dz+5qnhLfMA=; b=YK4VXK9mKddCmkyu0jMKdxbjvS YGc1Ofttf4C28mUIdWhsZgUjkjOJt+kcS8azaE62X2VfA4L2BnF982xX9exQLxumsPyJIyk9ahDL2 euPaR86NVVpiMdDA3xlSY9x8JJ1YthKqLroy3JctWaeJkTq8Rb2suthvjLV7ZDiDi9jw=; Received: from verein.lst.de ([213.95.11.211]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1q27rH-00047K-K8 for linux-f2fs-devel@lists.sourceforge.net; Thu, 25 May 2023 10:06:22 +0000 Received: by verein.lst.de (Postfix, from userid 2407) id 45E6C68AFE; Thu, 25 May 2023 12:05:58 +0200 (CEST) Date: Thu, 25 May 2023 12:05:57 +0200 From: Christoph Hellwig To: Miklos Szeredi Message-ID: <20230525100557.GA30242@lst.de> References: <20230524063810.1595778-1-hch@lst.de> <20230524063810.1595778-10-hch@lst.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) X-Headers-End: 1q27rH-00047K-K8 Subject: Re: [f2fs-dev] [PATCH 09/11] fs: factor out a direct_write_fallback helper X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Darrick J. Wong" , linux-mm@kvack.org, Christoph Hellwig , Andreas Gruenbacher , Matthew Wilcox , cluster-devel@redhat.com, Ilya Dryomov , linux-ext4@vger.kernel.org, linux-nfs@vger.kernel.org, linux-block@vger.kernel.org, Damien Le Moal , Alexander Viro , Jaegeuk Kim , ceph-devel@vger.kernel.org, Xiubo Li , Trond Myklebust , Jens Axboe , Christian Brauner , Theodore Ts'o , linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, Anna Schumaker , linux-fsdevel@vger.kernel.org, Andrew Morton Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On Wed, May 24, 2023 at 09:00:36AM +0200, Miklos Szeredi wrote: > > +ssize_t direct_write_fallback(struct kiocb *iocb, struct iov_iter *iter, > > + ssize_t direct_written, ssize_t buffered_written) > > +{ > > + struct address_space *mapping = iocb->ki_filp->f_mapping; > > + loff_t pos = iocb->ki_pos - buffered_written; > > + loff_t end = iocb->ki_pos - 1; > > + int err; > > + > > + /* > > + * If the buffered write fallback returned an error, we want to return > > + * the number of bytes which were written by direct I/O, or the error > > + * code if that was zero. > > + * > > + * Note that this differs from normal direct-io semantics, which will > > + * return -EFOO even if some bytes were written. > > + */ > > + if (unlikely(buffered_written < 0)) > > + return buffered_written; > > Comment/code mismatch. The comment says: > > if (buffered_written < 0) > return direct_written ?: buffered_written; Yeah. And the old code matches the comment, so I'll update to that. I'm really wondering how I could come up with a good test case for this.. _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel