Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4701321ybf; Wed, 4 Mar 2020 09:00:48 -0800 (PST) X-Google-Smtp-Source: ADFU+vsBXXhjzyArOuV+PglKZEWa9MnN6BEfwKUtlVYLFKTV/Ky8rDGSz5TeMJi4RyMk0Sig7QDf X-Received: by 2002:a9d:6411:: with SMTP id h17mr3128051otl.332.1583341248331; Wed, 04 Mar 2020 09:00:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583341248; cv=none; d=google.com; s=arc-20160816; b=auZDuQSQ50E5AYDATO55ZMNxsIbgPeatAf3aXG8QpUY3z5YQWPbfk9UEoWEC6hJIvj RxugZ4KsgX5JS3ULNbdvWMvha5C1PbMOt+2XWdwXGwPDEJnGuCq9AqxVCS4+QN+T3rm1 gqvAwYhO8qJuC5SDZp+VLSc/G/8m1FQ5FdrKmfHfvYeQy5zOroh2kARNrFVX5O/hOA8C +RGxE/k1i5U4f3LxxSwlehpiN5v/z9wTX0ZY/f64n9msCq34apAoU1YOheQMp/JA2Ot5 SVXbeFWMecj1lII5UbGQYYMxW+sztCaTVIu4YQcybT0kUqFpRnxf1SJPCC9iJqkOCKJa 93yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BDyna82gOULpd6exk200NRUKeqMshv908IMcsDkgfcs=; b=P7l6Wbog9EQDlsaejtOXtdfVzWrpJqv6u8R9m1DaVCwEIA3z56kQfGWx5vclTlQd6v MRFgN9MAz0Y9hHBL2W7fFZKcWGKG/F9uCJ3sWZfY0WXK2DBUYc69Vn65lXwUudaqRbze QBmELz7qjeOnRQKBdTVaS5yGnXgLEM7yY57S8RVo+lnHDJ+XLT4ck3gKYkKWeHs6kAe9 71yw61qC/u3THG/92sjv6PmlWTHk6fiLOgJaB3t+Z+utg4AEFRnyJrezFzp9DdQMYIPC RJdqyrcV2o2wrAxaHp7l5GZLPNc4/8vJCK0WyX0IS7p6xUiBBvjLaox+AS0mXdBTuZMT UmGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WGDktcE6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id h128si1521279oif.258.2020.03.04.09.00.27; Wed, 04 Mar 2020 09:00:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WGDktcE6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S2388257AbgCDQ77 (ORCPT + 99 others); Wed, 4 Mar 2020 11:59:59 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:33453 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729811AbgCDQ7S (ORCPT ); Wed, 4 Mar 2020 11:59:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583341157; 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=BDyna82gOULpd6exk200NRUKeqMshv908IMcsDkgfcs=; b=WGDktcE6ApXdD+PsZy0xtkI/tTQuPVN9UMxS1+WP0xfe0aAC4SrmpOWGd/pTun3c7dKNCW hcE8j7vraTjfjb4BrXiUBlNDlFuKr6dwLd8h1U1PCBPyePmQDtaev+LeRHvZqoG0vtXzs5 7x7LYOKyJS82saa83/rPCgfSCdcjets= 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-469-G7_KU9XAPJmSDI_OWHjqAA-1; Wed, 04 Mar 2020 11:59:13 -0500 X-MC-Unique: G7_KU9XAPJmSDI_OWHjqAA-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 56BBA107ACCA; Wed, 4 Mar 2020 16:59:12 +0000 (UTC) Received: from horse.redhat.com (unknown [10.18.25.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2FA4960C84; Wed, 4 Mar 2020 16:59:12 +0000 (UTC) Received: by horse.redhat.com (Postfix, from userid 10451) id 8153F225816; Wed, 4 Mar 2020 11:59:03 -0500 (EST) From: Vivek Goyal To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org, virtio-fs@redhat.com, miklos@szeredi.hu Cc: vgoyal@redhat.com, stefanha@redhat.com, dgilbert@redhat.com, mst@redhat.com Subject: [PATCH 16/20] fuse,virtiofs: Define dax address space operations Date: Wed, 4 Mar 2020 11:58:41 -0500 Message-Id: <20200304165845.3081-17-vgoyal@redhat.com> In-Reply-To: <20200304165845.3081-1-vgoyal@redhat.com> References: <20200304165845.3081-1-vgoyal@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is done along the lines of ext4 and xfs. I primarily wanted ->writep= ages hook at this time so that I could call into dax_writeback_mapping_range()= . This in turn will decide which pfns need to be written back. Signed-off-by: Vivek Goyal --- fs/fuse/file.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index ab56396cf661..619aff6b5f44 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -2696,6 +2696,16 @@ static int fuse_writepages_fill(struct page *page, return err; } =20 +static int fuse_dax_writepages(struct address_space *mapping, + struct writeback_control *wbc) +{ + + struct inode *inode =3D mapping->host; + struct fuse_conn *fc =3D get_fuse_conn(inode); + + return dax_writeback_mapping_range(mapping, fc->dax_dev, wbc); +} + static int fuse_writepages(struct address_space *mapping, struct writeback_control *wbc) { @@ -4032,6 +4042,13 @@ static const struct address_space_operations fuse_= file_aops =3D { .write_end =3D fuse_write_end, }; =20 +static const struct address_space_operations fuse_dax_file_aops =3D { + .writepages =3D fuse_dax_writepages, + .direct_IO =3D noop_direct_IO, + .set_page_dirty =3D noop_set_page_dirty, + .invalidatepage =3D noop_invalidatepage, +}; + void fuse_init_file_inode(struct inode *inode) { struct fuse_inode *fi =3D get_fuse_inode(inode); @@ -4049,5 +4066,6 @@ void fuse_init_file_inode(struct inode *inode) =20 if (fc->dax_dev) { inode->i_flags |=3D S_DAX; + inode->i_data.a_ops =3D &fuse_dax_file_aops; } } --=20 2.20.1