Received: by 10.223.185.111 with SMTP id b44csp1646366wrg; Sat, 10 Mar 2018 10:30:34 -0800 (PST) X-Google-Smtp-Source: AG47ELvy4NzZBaBARzFgaN2JQz+nUZ5GXoc9W6iU37iRYamhxGij+tvX0/MTJAL/6F7T9fdq/lKM X-Received: by 10.99.120.5 with SMTP id t5mr2237551pgc.156.1520706634475; Sat, 10 Mar 2018 10:30:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520706634; cv=none; d=google.com; s=arc-20160816; b=llOwPqUCDhQ9eiBlGEJAqVMCiFV1ZzOctrH5HK/a5jTo/jz1YHklfmpmgbWy1wRSBm 1TCeSOAfHsB15T7zLVUrZzATsHnRIW39iwX12XR0SZX7KO7gz9OoiIOmCj5rO+U77Re1 cleUZU5LKRyzcc89+IvZLS7ZqF+q+ds0ZsD0F2S4Vrn+S8G27egd7x4NHr+jppva9SSL M0RJjA7IoncI9IyjUT/7tRcWxdX+WIElMglb5Db5S6bFbFAidZPtWS7bWTj2ciNQB40A bj5u89LhmznagMI1pIdJpH27PJUM7cJwyGn1k2IWP76sdoS/Jj88qSitn6o+ziBfe/82 AFcg== 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:dkim-signature:arc-authentication-results; bh=9C9qI/DKDRVjJe2Nglx8k6p2hItWb+mTwUASmPBBnnI=; b=xpfUOw7WjnTQv9XoWYhL4ykf+s8n394O0M0mnv0Qc3hfCvr1qSj4rXloGL5jlie7PU lT0i1vTTRg0JNTNOWqVqgdMTvycA4DUU5muxouY+Zsk4IY+58n5hp2kP3WE5cZ1x9//Z 8sAxj2y762e7C57a31ZIOSf3hTablFI0tOEg6hCJc9dMctb6tasmbBibp5k38MN+4YKP 3jmOzOokkc2UisQmd0lIAe1zSfOU2u+N4beT8M5LmT0Z6W+DTWZGZOnW4teuId+NktHY vMXeQuhMDTr4g40fCvjNkHSfEkl74SNZRsfqp+ElcjlclgPkVwpl0gtFG9zy8NwTL0PK XaEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@eng.ucsd.edu header.s=google header.b=dD+Hn+pZ; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 94-v6si3088437ple.694.2018.03.10.10.30.19; Sat, 10 Mar 2018 10:30:34 -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=@eng.ucsd.edu header.s=google header.b=dD+Hn+pZ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751780AbeCJS2Y (ORCPT + 99 others); Sat, 10 Mar 2018 13:28:24 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:34794 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932811AbeCJSVg (ORCPT ); Sat, 10 Mar 2018 13:21:36 -0500 Received: by mail-pf0-f193.google.com with SMTP id j20so2625540pfi.1 for ; Sat, 10 Mar 2018 10:21:36 -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=9C9qI/DKDRVjJe2Nglx8k6p2hItWb+mTwUASmPBBnnI=; b=dD+Hn+pZrHLn0SCI3zYUzrmTU/jbEaFEWltuk16QGGV/0hlYDi6vi14kb48BJmtWiO WuS3wnuf9FhUbRRHe+H+nK57beVkdzn0BjsA+9QdL9zaq7/blB7KPpNGLnQZMfsmMZq5 4h+4xp0eeS5ieEpYAuoBe4EUoKUZUBZHtSCWQ= 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=9C9qI/DKDRVjJe2Nglx8k6p2hItWb+mTwUASmPBBnnI=; b=k9tz/aXcdsOLjMc1LsTfVp/yYtoxUJN6ODPNO857OcA2tvLRCNFHH2ermawreK3GnW HkfSjQueHBqg0KquY4KJc1RLRXTGJsDzqjg42cLKBQxJ3nOUYZOSqU0R2t2gZUNhAq21 Wb7++BE5+/Q7RbJwb7R2uaKIiTpDG7spfUjUOMOpyRpAyvVzsrRGt952t7NgAU0QzaB+ cvlcIPbHybEhGFfTVj5LbB64NzUG0E7qSaNW4nGLykqJN5ERSN6OhR/aKJbLaKvAnXcc PEd4uTu2tFq+eBTLB8y/Pvk9NRLZc4PJIVu8wxOJzzmXhTKTZ2GHDb8cevkK3iXS0nBD 6X2g== X-Gm-Message-State: AElRT7HvZtJC9y+yINHOd3FZdCBxnFfjsu8aYT+4ptUPInMzoxW8seGC 1iiQT+UI+I0h8+pjsOqS3v5tNw== X-Received: by 10.99.105.202 with SMTP id e193mr2186262pgc.84.1520706096005; Sat, 10 Mar 2018 10:21:36 -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.21.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 10 Mar 2018 10:21:35 -0800 (PST) From: Andiry Xu To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org Cc: dan.j.williams@intel.com, andy.rudoff@intel.com, coughlan@redhat.com, swanson@cs.ucsd.edu, david@fromorbit.com, jack@suse.com, swhiteho@redhat.com, miklos@szeredi.hu, andiry.xu@gmail.com, Andiry Xu Subject: [RFC v2 66/83] Super: Add file write item cache. Date: Sat, 10 Mar 2018 10:18:47 -0800 Message-Id: <1520705944-6723-67-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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andiry Xu nova_file_write_item combines a file write item with a list head. NOVA uses a linked list of file write items to describe a write operation. Signed-off-by: Andiry Xu --- fs/nova/super.c | 43 ++++++++++++++++++++++++++++++++++++++++++- fs/nova/super.h | 3 +++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/fs/nova/super.c b/fs/nova/super.c index 0847e57..9710be8 100644 --- a/fs/nova/super.c +++ b/fs/nova/super.c @@ -55,6 +55,7 @@ static const struct export_operations nova_export_ops; static struct kmem_cache *nova_inode_cachep; static struct kmem_cache *nova_range_node_cachep; +static struct kmem_cache *nova_file_write_item_cachep; /* FIXME: should the following variable be one per NOVA instance? */ @@ -791,6 +792,21 @@ inline void nova_free_inode_node(struct super_block *sb, nova_free_range_node(node); } +inline void nova_free_file_write_item(struct nova_file_write_item *item) +{ + kmem_cache_free(nova_file_write_item_cachep, item); +} + +inline struct nova_file_write_item * +nova_alloc_file_write_item(struct super_block *sb) +{ + struct nova_file_write_item *p; + + p = (struct nova_file_write_item *) + kmem_cache_alloc(nova_file_write_item_cachep, GFP_NOFS); + return p; +} + inline struct nova_range_node *nova_alloc_range_node(struct super_block *sb) { struct nova_range_node *p; @@ -849,6 +865,18 @@ static int __init init_rangenode_cache(void) return 0; } +static int __init init_file_write_item_cache(void) +{ + nova_file_write_item_cachep = kmem_cache_create( + "nova_file_write_item_cache", + sizeof(struct nova_file_write_item), + 0, (SLAB_RECLAIM_ACCOUNT | + SLAB_MEM_SPREAD), NULL); + if (nova_file_write_item_cachep == NULL) + return -ENOMEM; + return 0; +} + static int __init init_inodecache(void) { nova_inode_cachep = kmem_cache_create("nova_inode_cache", @@ -875,6 +903,11 @@ static void destroy_rangenode_cache(void) kmem_cache_destroy(nova_range_node_cachep); } +static void destroy_file_write_item_cache(void) +{ + kmem_cache_destroy(nova_file_write_item_cachep); +} + /* * the super block writes are all done "on the fly", so the @@ -974,14 +1007,21 @@ static int __init init_nova_fs(void) if (rc) goto out1; - rc = register_filesystem(&nova_fs_type); + rc = init_file_write_item_cache(); if (rc) goto out2; + rc = register_filesystem(&nova_fs_type); + if (rc) + goto out3; + out: NOVA_END_TIMING(init_t, init_time); return rc; +out3: + destroy_file_write_item_cache(); + out2: destroy_inodecache(); @@ -993,6 +1033,7 @@ static int __init init_nova_fs(void) static void __exit exit_nova_fs(void) { unregister_filesystem(&nova_fs_type); + destroy_file_write_item_cache(); destroy_inodecache(); destroy_rangenode_cache(); } diff --git a/fs/nova/super.h b/fs/nova/super.h index 56a840e..bcf9548 100644 --- a/fs/nova/super.h +++ b/fs/nova/super.h @@ -160,8 +160,11 @@ static inline struct nova_super_block *nova_get_super(struct super_block *sb) extern void nova_error_mng(struct super_block *sb, const char *fmt, ...); extern struct nova_range_node *nova_alloc_range_node(struct super_block *sb); extern inline struct nova_range_node *nova_alloc_inode_node(struct super_block *sb); +extern struct nova_file_write_item * +nova_alloc_file_write_item(struct super_block *sb); extern void nova_free_range_node(struct nova_range_node *node); extern inline void nova_free_inode_node(struct super_block *sb, struct nova_range_node *node); +void nova_free_file_write_item(struct nova_file_write_item *item); #endif -- 2.7.4