Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1485816pxb; Fri, 27 Aug 2021 09:52:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsKTC26TzHfDcwZM+7thEdL1h2qx2bURZvsYv/Nk0XsSEOS4Knhc5iLJcgi9Sf065dLrrf X-Received: by 2002:a05:6402:b9c:: with SMTP id cf28mr11204307edb.356.1630083159509; Fri, 27 Aug 2021 09:52:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630083159; cv=none; d=google.com; s=arc-20160816; b=J+6yoSATlAhaBQ0l3tY267yMlfpYJJZSoe29t6UMp2Jnz0X4e+ZGUUigx2zY60J4b1 y3gBGgxwi+RMhJL/aEs+ckxmOqEozGkghhX6kxwjCrQnpjJnK0oRaW+D2P14PAMXGfWp /lLGYiTivS4PhIyHjmf2ZWF0AiyPEr1Fwke+ER8r0QW/Io3GXaTQvpONyhV1RGIqqq// KTHty2AMYaHpxpai31z8OFHEHk2+d3nYzgQk8ApcMGYO7zJ1u7DTSaVo5ZMmThNEvY7k vg3J26NFPsQ+0gLh1WvUH6JfzH0FXrmxi7QJzB+CU1EiP43PT0iPRM3ZvXejpAoL+Dt1 d9Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hSS15ajp7yjVj1XeNBbLODAMJtXekv1X+I9IyWo/qGc=; b=TiF29EweBeXRbhESpc8S0uhl0aUgcOorNweDHd9KVVAZh6lLIbOaBEM31r+1rn2u1e KhuL4txvATq46+7tTicfnd2sc2EE2qmdnhbmSUbK3DtPJEW1BIPuRKOnI8pXT3lFV24j HEOGnUvxA7HRjXstt5cZLnr+ZlBuLR8xyW7+HDbvkjhYaoKQAOZJ5N9GPKKKoLx1nE65 an6yNh4Xnratknzg+J1XEj/Jv/yxUff34JoxiNySc3mlDUcawMXX5noFspNUU3S2GZ6D 9sFCgLr9DnghqJ1lYwFVDjx5SqnLBy+N6NccZxUezjh57iFIg7Qf2cF7g3AXEoOVKsJh PauQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bqIdd+pY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j18si6608551edw.597.2021.08.27.09.52.13; Fri, 27 Aug 2021 09:52:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bqIdd+pY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235700AbhH0QvR (ORCPT + 99 others); Fri, 27 Aug 2021 12:51:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58065 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234869AbhH0QvF (ORCPT ); Fri, 27 Aug 2021 12:51:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630083016; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hSS15ajp7yjVj1XeNBbLODAMJtXekv1X+I9IyWo/qGc=; b=bqIdd+pYZa33Q0kwvk0oUIsVVcTEdHoTgIQYh/2M8ZFZnS2m3m9/TlMp3QMNlma03y1SQu jTuK7jw9YUeUVFWHQuhd3ENgpPfGfSRtH9/RTm5V73TIyxTLjR3FLU3KhUJI0exhWn2gs6 KUZ7FHt4nSs7YBTHOBkHnaZAdb5NS+A= 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-176-1sWkGHc9PhGJUi3iUBm0hg-1; Fri, 27 Aug 2021 12:50:14 -0400 X-MC-Unique: 1sWkGHc9PhGJUi3iUBm0hg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3BD741009E20; Fri, 27 Aug 2021 16:50:13 +0000 (UTC) Received: from max.com (unknown [10.40.194.206]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA7A160C04; Fri, 27 Aug 2021 16:50:10 +0000 (UTC) From: Andreas Gruenbacher To: Linus Torvalds , Alexander Viro , Christoph Hellwig , "Darrick J. Wong" Cc: Jan Kara , Matthew Wilcox , cluster-devel@redhat.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, ocfs2-devel@oss.oracle.com, Andreas Gruenbacher Subject: [PATCH v7 06/19] gfs2: Add wrapper for iomap_file_buffered_write Date: Fri, 27 Aug 2021 18:49:13 +0200 Message-Id: <20210827164926.1726765-7-agruenba@redhat.com> In-Reply-To: <20210827164926.1726765-1-agruenba@redhat.com> References: <20210827164926.1726765-1-agruenba@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a wrapper around iomap_file_buffered_write. We'll add code for when the operation needs to be retried here later. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/file.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 84ec053d43b4..55ec1cadc9e6 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c @@ -876,6 +876,18 @@ static ssize_t gfs2_file_read_iter(struct kiocb *iocb, struct iov_iter *to) return written ? written : ret; } +static ssize_t gfs2_file_buffered_write(struct kiocb *iocb, struct iov_iter *from) +{ + struct file *file = iocb->ki_filp; + struct inode *inode = file_inode(file); + ssize_t ret; + + current->backing_dev_info = inode_to_bdi(inode); + ret = iomap_file_buffered_write(iocb, from, &gfs2_iomap_ops); + current->backing_dev_info = NULL; + return ret; +} + /** * gfs2_file_write_iter - Perform a write to a file * @iocb: The io context @@ -927,9 +939,7 @@ static ssize_t gfs2_file_write_iter(struct kiocb *iocb, struct iov_iter *from) goto out_unlock; iocb->ki_flags |= IOCB_DSYNC; - current->backing_dev_info = inode_to_bdi(inode); - buffered = iomap_file_buffered_write(iocb, from, &gfs2_iomap_ops); - current->backing_dev_info = NULL; + buffered = gfs2_file_buffered_write(iocb, from); if (unlikely(buffered <= 0)) { if (!ret) ret = buffered; @@ -951,9 +961,7 @@ static ssize_t gfs2_file_write_iter(struct kiocb *iocb, struct iov_iter *from) if (!ret || ret2 > 0) ret += ret2; } else { - current->backing_dev_info = inode_to_bdi(inode); - ret = iomap_file_buffered_write(iocb, from, &gfs2_iomap_ops); - current->backing_dev_info = NULL; + ret = gfs2_file_buffered_write(iocb, from); if (likely(ret > 0)) { iocb->ki_pos += ret; ret = generic_write_sync(iocb, ret); -- 2.26.3