Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3885289imu; Mon, 10 Dec 2018 09:18:51 -0800 (PST) X-Google-Smtp-Source: AFSGD/UGBpr7wNW4kb0CBeSw1/O06wzuCICMe2vWshG9TmK8j7Bo0ooOfFd0BG8iZXhljHNa0pWx X-Received: by 2002:a63:9a52:: with SMTP id e18mr11536565pgo.14.1544462331385; Mon, 10 Dec 2018 09:18:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544462331; cv=none; d=google.com; s=arc-20160816; b=eQQq0AdggohzYNquMU7S8kVNJyOtWhHCP5/lMUxEJA8rzT0B2sJo83Ld8LzfhvNCIs 2OqzcR6Q2g9hRQsxYo7HacaXZCwUvD7FjDjWphD7plUGFzT5pWTXXooF6w6S3Wg1P3gt 4eiEJOEKlx1kvYhC0VxKSb9Atp6yHOr1WR8joF4Egy8EyIHR0UBDv/ZrRf/llFz70wVG yBHxgufc2fAA1xJJRScp8XValeX+jmXNAzsvbnIul0iHrJJvT1yNX3LMLh34K7MHiyyF zEeXFegiOthlDJM+fEl0D79pNbCUft0D2vVqCn3Q2ZgNcLPUS/heIvybIt47g3IBZcTA mMzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=6rYw5Vtrk0tKaEwbwiopQNivhZN2CIMbO0uNLSn8RT4=; b=Cg7fhkHmniiwJfcEoODgIonRogrxooGpOUTl68QBBA2ELmrtdPnGqMzq1f5ctxrdAh WZ7OVQEQv288yaBFTl6/r8Dt9N7HEzSH2/hmjbirJT1mAWw7uqkRtxHFJqDmITUKPYTw 4+ZcrIz1sjhSGaSf6ZZF3fTHonF7AE82SBaR1QvfNEIP5RimaLjYHjsGG/bxdE87+RWo lOHgix+B/X54+GlKD31z9ZvxAgT6sTNQhLuFfRnswTkY7TegPoYRFo0UOJZzw32Ebc+G FzhOu59M4KyX7fYGVY+8GFQUbQ+I1bTdE6GZ3b14H6jPixF+tQLynbZTTpb/eYHcsyB4 Atxg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 a23si10082717plm.334.2018.12.10.09.18.35; Mon, 10 Dec 2018 09:18:51 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728679AbeLJRNw (ORCPT + 99 others); Mon, 10 Dec 2018 12:13:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40834 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728544AbeLJRNn (ORCPT ); Mon, 10 Dec 2018 12:13:43 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 269CE3C2CCC; Mon, 10 Dec 2018 17:13:43 +0000 (UTC) Received: from horse.redhat.com (unknown [10.18.25.234]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0246A5C232; Mon, 10 Dec 2018 17:13:34 +0000 (UTC) Received: by horse.redhat.com (Postfix, from userid 10451) id 8570722426B; Mon, 10 Dec 2018 12:13:30 -0500 (EST) From: Vivek Goyal To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: vgoyal@redhat.com, miklos@szeredi.hu, stefanha@redhat.com, dgilbert@redhat.com, sweil@redhat.com, swhiteho@redhat.com Subject: [PATCH 32/52] fuse: Define dax address space operations Date: Mon, 10 Dec 2018 12:12:58 -0500 Message-Id: <20181210171318.16998-33-vgoyal@redhat.com> In-Reply-To: <20181210171318.16998-1-vgoyal@redhat.com> References: <20181210171318.16998-1-vgoyal@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 10 Dec 2018 17:13:43 +0000 (UTC) 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 ->writepages 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 and call dax_flush() on those. Signed-off-by: Vivek Goyal --- fs/fuse/file.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 5230f2d84a14..eb12776f5ff6 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -2306,6 +2306,17 @@ static int fuse_writepages_fill(struct page *page, return err; } +static int fuse_dax_writepages(struct address_space *mapping, + struct writeback_control *wbc) +{ + + struct inode *inode = mapping->host; + struct fuse_conn *fc = get_fuse_conn(inode); + + return dax_writeback_mapping_range(mapping, + NULL, fc->dax_dev, wbc); +} + static int fuse_writepages(struct address_space *mapping, struct writeback_control *wbc) { @@ -3646,6 +3657,13 @@ static const struct address_space_operations fuse_file_aops = { .write_end = fuse_write_end, }; +static const struct address_space_operations fuse_dax_file_aops = { + .writepages = fuse_dax_writepages, + .direct_IO = noop_direct_IO, + .set_page_dirty = noop_set_page_dirty, + .invalidatepage = noop_invalidatepage, +}; + void fuse_init_file_inode(struct inode *inode) { struct fuse_inode *fi = get_fuse_inode(inode); @@ -3664,5 +3682,6 @@ void fuse_init_file_inode(struct inode *inode) if (fc->dax_dev) { inode->i_flags |= S_DAX; inode->i_fop = &fuse_dax_file_operations; + inode->i_data.a_ops = &fuse_dax_file_aops; } } -- 2.13.6