From patchwork Sat Mar 10 18:18:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andiry Xu X-Patchwork-Id: 10273869 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1DF3B601A0 for ; Sat, 10 Mar 2018 18:20:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D3BB28BAE for ; Sat, 10 Mar 2018 18:20:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0102E29735; Sat, 10 Mar 2018 18:20:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=no version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ADB5128BAE for ; Sat, 10 Mar 2018 18:20:55 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id C595022603B04; Sat, 10 Mar 2018 10:14:33 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c00::241; helo=mail-pf0-x241.google.com; envelope-from=jix024@eng.ucsd.edu; receiver=linux-nvdimm@lists.01.org Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com [IPv6:2607:f8b0:400e:c00::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C521022603AE4 for ; Sat, 10 Mar 2018 10:14:31 -0800 (PST) Received: by mail-pf0-x241.google.com with SMTP id f80so2617490pfa.8 for ; Sat, 10 Mar 2018 10:20:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eng.ucsd.edu; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=onvPGvPFTagofoGFZaXXqPotBNWCKBniFnEDO59jYDE=; b=hrZiwP2kpTYHhYGWAImBgZXAGSuNfDbzE4xt1h7hMp3WrBbOO+ly+khXgIHTCGECbV F12nxHdD535JdSbXYVmJoD40uDz0tUtAe8TfgR0N2FUtxjaQBWIp2EO8NL6SlVRdw3Mx wWqPv/yVkqxSIHB5cfobiqRspHqV4icKbbpuQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=onvPGvPFTagofoGFZaXXqPotBNWCKBniFnEDO59jYDE=; b=QjbvkqF0ipMiuAvAZabSl6jUSWi37tlaHw+KnzdebaF5hiEfeJ1QdvkRPdQnag1ox4 5MAu13sGwz3sHtlGATOx7r6KVGUCbqYZa6LxIfO5d1CZfonh39HYPMC6kYc6MOa3Avx2 Hz5jdjFrmgOEQLK+u+hdYByH1eTD+W5TF2xDEs+lkBJv6KVhqx2aqrg6nQD5LBh9TP0Y kreD9oMjXJKQ35Fiwhs0u8ioyTFGLEP5DnO1IhzdkYtGOrISCMlL77WcEqlz6ykIb7cM HyaVMtj1DAeUvxrb7lboZNaR15jPRj9hzNC6r060ZZrvATMIIYYfJHOEKs060A9zEdWi 6EAA== X-Gm-Message-State: AElRT7HfydgViALasuXm/j7e908tnJFkEPK/PTXXvJ6DGgcm0bS90eHC 1a9+RosHVrOUBgq+iFXOE8gUOg== X-Google-Smtp-Source: AG47ELtI78Mc2a9/94ThLjXFl0c6rWYNxLwb2ftUZPJ7g7L/GYFBI0l1MOOp9H/kXpMA6aht4ZDpRg== X-Received: by 10.98.156.16 with SMTP id f16mr2673798pfe.180.1520706050263; Sat, 10 Mar 2018 10:20:50 -0800 (PST) Received: from brienza-desktop.8.8.4.4 (andxu.ucsd.edu. [132.239.17.134]) by smtp.gmail.com with ESMTPSA id h80sm9210167pfj.181.2018.03.10.10.20.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 10 Mar 2018 10:20:49 -0800 (PST) From: Andiry Xu To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org Subject: [RFC v2 28/83] Add NOVA address space operations Date: Sat, 10 Mar 2018 10:18:09 -0800 Message-Id: <1520705944-6723-29-git-send-email-jix024@eng.ucsd.edu> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520705944-6723-1-git-send-email-jix024@eng.ucsd.edu> References: <1520705944-6723-1-git-send-email-jix024@eng.ucsd.edu> X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: coughlan@redhat.com, miklos@szeredi.hu, Andiry Xu , david@fromorbit.com, jack@suse.com, swanson@cs.ucsd.edu, swhiteho@redhat.com, andiry.xu@gmail.com MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP From: Andiry Xu direct_IO and writepages support. Signed-off-by: Andiry Xu --- fs/nova/inode.c | 24 ++++++++++++++++++++++++ fs/nova/inode.h | 1 + 2 files changed, 25 insertions(+) diff --git a/fs/nova/inode.c b/fs/nova/inode.c index 7c10d0e..a30b6aa 100644 --- a/fs/nova/inode.c +++ b/fs/nova/inode.c @@ -175,6 +175,7 @@ static int nova_read_inode(struct super_block *sb, struct inode *inode, } inode->i_blocks = sih->i_blocks; + inode->i_mapping->a_ops = &nova_aops_dax; switch (inode->i_mode & S_IFMT) { case S_IFREG: @@ -488,3 +489,26 @@ int nova_free_inuse_inode(struct super_block *sb, unsigned long ino) return ret; } +static ssize_t nova_direct_IO(struct kiocb *iocb, struct iov_iter *iter) +{ + /* DAX does not support direct IO */ + return -EIO; +} + +static int nova_writepages(struct address_space *mapping, + struct writeback_control *wbc) +{ + int ret; + timing_t wp_time; + + NOVA_START_TIMING(write_pages_t, wp_time); + ret = dax_writeback_mapping_range(mapping, + mapping->host->i_sb->s_bdev, wbc); + NOVA_END_TIMING(write_pages_t, wp_time); + return ret; +} + +const struct address_space_operations nova_aops_dax = { + .writepages = nova_writepages, + .direct_IO = nova_direct_IO, +}; diff --git a/fs/nova/inode.h b/fs/nova/inode.h index 497343d..e00b3b9 100644 --- a/fs/nova/inode.h +++ b/fs/nova/inode.h @@ -221,6 +221,7 @@ static inline int nova_persist_inode(struct nova_inode *pi) } +extern const struct address_space_operations nova_aops_dax; int nova_init_inode_inuse_list(struct super_block *sb); int nova_init_inode_table(struct super_block *sb); int nova_get_inode_address(struct super_block *sb, u64 ino,