Received: by 10.223.185.111 with SMTP id b44csp1651340wrg; Sat, 10 Mar 2018 10:37:41 -0800 (PST) X-Google-Smtp-Source: AG47ELsk6BXeZnm7swRfjRgXUoAXBqPgZSk+LCl6pBum8xqbILL9nMyqWaQnqvh/rvnPDENwl+d8 X-Received: by 10.99.119.78 with SMTP id s75mr2291499pgc.238.1520707061394; Sat, 10 Mar 2018 10:37:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520707061; cv=none; d=google.com; s=arc-20160816; b=FeLzwPmTMz5F9OEMLIocYbBnHxVG43pipiWC/JERWY7f2BfU9LgGtezrcHJunQuvIt hWaPnRVO/H6f/5M6W6LPMM1CAM3WxtpeHnrUwoeqInGA43DJ+zFQRWhL4Tn+MPb5mJU6 RTamNn7nn+bHhtMOCzpXa0bDj1CnGOEKww8AGCvq5ZeMaxPZTA9kkwIrbOSh64RjyvOH q/28YamMU5cSKDwstdip9nXWBDUMjNt9DfsKov8NuKl7lxpbYGSDbaFtsIV/kjmWRvkS ZWBnctfjX+D0KwP4PUoDVA3Pe2RZn15dgkAfzAZm5VXPfjUJJ3RnDFBucIBqhxtWgyDC xfPw== 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=e/w9TtRPfI9EbDv1V1l5hDfaKWNt68DfNpTJnoCFpvg=; b=BwesU+gH2uABsNQQdKLRmq1AMKTSXtKY5xPAv0onPWhlHAFSU1Kru6p8eP/KAeIyN8 quAi08V15Ppilv6MqeoIMaYsrBGjrvmcB5hYGgOnKDQbA2lJmnnhHV3sO4wCv1txNzU8 eBTpZNel3LCR3T2CdHVnMlGLJf15rXsjtqjkBMDVVsJtnak1R+THtZDFHu5kZU9s1uzc 92br3brDwzznFewf9vXzmi0I4vqpryA3C3ImmaD8V5w6q4aB3jDWVXzsV2lCrBImYKiq rmLPZ+iao5I8HIRnDIyuwlEMXxP6iSpL3ymgewEWk0DNaDhelAD16M4OiwrUXLnIjxaB eQFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@eng.ucsd.edu header.s=google header.b=aceuqL6J; 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 k1-v6si3086125pld.75.2018.03.10.10.37.27; Sat, 10 Mar 2018 10:37:41 -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=aceuqL6J; 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 S1750971AbeCJSgi (ORCPT + 99 others); Sat, 10 Mar 2018 13:36:38 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:39698 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932376AbeCJSU6 (ORCPT ); Sat, 10 Mar 2018 13:20:58 -0500 Received: by mail-pf0-f193.google.com with SMTP id u5so2617747pfh.6 for ; Sat, 10 Mar 2018 10:20:57 -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=e/w9TtRPfI9EbDv1V1l5hDfaKWNt68DfNpTJnoCFpvg=; b=aceuqL6JefAKIjsAS/bbHI33OW5TvSYJeV8sfuYpZLxKUBoRjJqZ3o7qDC6YYCUTMk gXRfM0VoX/xJNaVAcUkGt+fqyRDZy4U5Q3P26PUYH5a6X5JvCm5UaMTmQn8eF8HpnqoT p2NsnqBsnPz9HZ0X4dYK+4rrqBVMMWvdViIXc= 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=e/w9TtRPfI9EbDv1V1l5hDfaKWNt68DfNpTJnoCFpvg=; b=BUouaouyE2aE1M84HvQjDhyEGldQJ4rQDSjPDkHJrttAeRLuV/S/Ptfqq0egRnK2Hp APZdtiNl42zdMDMLcMmFGxOpjQXC48FjEB3gDeQZuaNbIO1iQRxlPHHtoY9IkA8IvJPX MzJKpON67LXpBBK2cQUvnqbav1MJhAQ+/9VQGEDG/AfTwYZ/SSoJ+PRdERoVrTYck+dG vUFgEOMVYci53hXeFddbQyzV4teO6ohRInkwHGZ2AV9e0JWev/H8OG4U8swt76NsOvNf 9buqezZPsXctmwuGbukUI89suIgXGFwHQoDzjyjEJpLraUBeLYXbcdmrQfSKGZuYq4mg 44bQ== X-Gm-Message-State: AElRT7HcW1W3GCjJqzyiCtrDe9a0A+TXJwE9J7OesMJyAHbVvUW4wPFc f2a5LSHu8pL9gqQYEASxcN+Akg== X-Received: by 10.101.90.140 with SMTP id c12mr2197885pgt.56.1520706057497; Sat, 10 Mar 2018 10:20:57 -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.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 10 Mar 2018 10:20:56 -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 34/83] Journal: NOVA light weight journal definitions. Date: Sat, 10 Mar 2018 10:18:15 -0800 Message-Id: <1520705944-6723-35-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 uses per-CPU lite journals to provide fast atomicity guarantees for multi-log appending and multi-word inplace updates. NOVA uses undo journaling. Each journal is a circular buffer of 4KB pmem page. Two pointers, journal_head and journal_tail reside in the reserved journal block, and point to the journal page. If the two pointers are not equal, there are uncommitted transactions and NOVA recovers the data by replaying the journal entries. Signed-off-by: Andiry Xu --- fs/nova/bbuild.c | 1 + fs/nova/journal.h | 43 +++++++++++++++++++++++++++++++++++++++++++ fs/nova/log.c | 1 + fs/nova/super.c | 1 + 4 files changed, 46 insertions(+) create mode 100644 fs/nova/journal.h diff --git a/fs/nova/bbuild.c b/fs/nova/bbuild.c index 66053cb..af1b352 100644 --- a/fs/nova/bbuild.c +++ b/fs/nova/bbuild.c @@ -25,6 +25,7 @@ #include #include #include "nova.h" +#include "journal.h" #include "super.h" #include "inode.h" diff --git a/fs/nova/journal.h b/fs/nova/journal.h new file mode 100644 index 0000000..d1d0ffb --- /dev/null +++ b/fs/nova/journal.h @@ -0,0 +1,43 @@ +#ifndef __JOURNAL_H +#define __JOURNAL_H + +#include +#include +#include "nova.h" +#include "super.h" + + +/* ======================= Lite journal ========================= */ + +#define NOVA_MAX_JOURNAL_LENGTH 128 + +#define JOURNAL_INODE 1 +#define JOURNAL_ENTRY 2 + +/* Lightweight journal entry */ +struct nova_lite_journal_entry { + __le64 type; // JOURNAL_INODE or JOURNAL_ENTRY + __le64 data1; + __le64 data2; + __le32 padding; + __le32 csum; +} __attribute((__packed__)); + +/* Head and tail pointers into a circular queue of journal entries. There's + * one of these per CPU. + */ +struct journal_ptr_pair { + __le64 journal_head; + __le64 journal_tail; +}; + +static inline +struct journal_ptr_pair *nova_get_journal_pointers(struct super_block *sb, + int cpu) +{ + return (struct journal_ptr_pair *)((char *)nova_get_block(sb, + NOVA_DEF_BLOCK_SIZE_4K * JOURNAL_START) + cpu * CACHELINE_SIZE); +} + + +#endif diff --git a/fs/nova/log.c b/fs/nova/log.c index bdd133e..f01b7c8 100644 --- a/fs/nova/log.c +++ b/fs/nova/log.c @@ -16,6 +16,7 @@ */ #include "nova.h" +#include "journal.h" #include "inode.h" #include "log.h" diff --git a/fs/nova/super.c b/fs/nova/super.c index c0427fd..d73c202 100644 --- a/fs/nova/super.c +++ b/fs/nova/super.c @@ -38,6 +38,7 @@ #include #include #include "nova.h" +#include "journal.h" #include "super.h" int measure_timing; -- 2.7.4