diff options
author | Paul Gortmaker <paul.gortmaker@windriver.com> | 2018-08-02 11:39:11 -0400 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2018-08-02 11:39:11 -0400 |
commit | dc963b63a3cdcec3a29a429e6d50573484d2c849 (patch) | |
tree | 704d392861e228cb1ec12cc502d597099a2fd246 | |
parent | 789faf9daf15ebdd1ce5663a2d08bca39158445d (diff) | |
download | longterm-queue-4.12-dc963b63a3cdcec3a29a429e6d50573484d2c849.tar.gz |
libnvdimm: ctxt refresh
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-rw-r--r-- | queue/libnvdimm-btt-Fix-an-incompatibility-in-the-log-layo.patch | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/queue/libnvdimm-btt-Fix-an-incompatibility-in-the-log-layo.patch b/queue/libnvdimm-btt-Fix-an-incompatibility-in-the-log-layo.patch index 89f125e..468b2bc 100644 --- a/queue/libnvdimm-btt-Fix-an-incompatibility-in-the-log-layo.patch +++ b/queue/libnvdimm-btt-Fix-an-incompatibility-in-the-log-layo.patch @@ -1,4 +1,4 @@ -From 24e3a7fb60a9187e5df90e5fa655ffc94b9c4f77 Mon Sep 17 00:00:00 2001 +From 3ba1900f47525ad22d41b371cc12e7fa511a9809 Mon Sep 17 00:00:00 2001 From: Vishal Verma <vishal.l.verma@intel.com> Date: Mon, 18 Dec 2017 09:28:39 -0700 Subject: [PATCH] libnvdimm, btt: Fix an incompatibility in the log layout @@ -20,12 +20,13 @@ Cc: <stable@vger.kernel.org> Fixes: 5212e11fde4d ("nd_btt: atomic sector updates") Signed-off-by: Vishal Verma <vishal.l.verma@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> +Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c -index e949e3302af4..c586bcdb5190 100644 +index 3cd58143d468..c808bb6e0ba2 100644 --- a/drivers/nvdimm/btt.c +++ b/drivers/nvdimm/btt.c -@@ -211,12 +211,12 @@ static int btt_map_read(struct arena_info *arena, u32 lba, u32 *mapping, +@@ -192,13 +192,13 @@ static int btt_map_read(struct arena_info *arena, u32 lba, u32 *mapping, return ret; } @@ -34,6 +35,7 @@ index e949e3302af4..c586bcdb5190 100644 +static int btt_log_group_read(struct arena_info *arena, u32 lane, + struct log_group *log) { + WARN_ON(!ent); return arena_read_bytes(arena, - arena->logoff + (2 * lane * LOG_ENT_SIZE), ent, - 2 * LOG_ENT_SIZE, 0); @@ -42,7 +44,7 @@ index e949e3302af4..c586bcdb5190 100644 } static struct dentry *debugfs_root; -@@ -256,6 +256,8 @@ static void arena_debugfs_init(struct arena_info *a, struct dentry *parent, +@@ -238,6 +238,8 @@ static void arena_debugfs_init(struct arena_info *a, struct dentry *parent, debugfs_create_x64("logoff", S_IRUGO, d, &a->logoff); debugfs_create_x64("info2off", S_IRUGO, d, &a->info2off); debugfs_create_x32("flags", S_IRUGO, d, &a->flags); @@ -51,7 +53,7 @@ index e949e3302af4..c586bcdb5190 100644 } static void btt_debugfs_init(struct btt *btt) -@@ -274,6 +276,11 @@ static void btt_debugfs_init(struct btt *btt) +@@ -256,6 +258,11 @@ static void btt_debugfs_init(struct btt *btt) } } @@ -63,7 +65,7 @@ index e949e3302af4..c586bcdb5190 100644 /* * This function accepts two log entries, and uses the * sequence number to find the 'older' entry. -@@ -283,8 +290,10 @@ static void btt_debugfs_init(struct btt *btt) +@@ -265,8 +272,10 @@ static void btt_debugfs_init(struct btt *btt) * * TODO The logic feels a bit kludge-y. make it better.. */ @@ -75,7 +77,7 @@ index e949e3302af4..c586bcdb5190 100644 int old; /* -@@ -292,23 +301,23 @@ static int btt_log_get_old(struct log_entry *ent) +@@ -274,23 +283,23 @@ static int btt_log_get_old(struct log_entry *ent) * the next time, the following logic works out to put this * (next) entry into [1] */ @@ -106,7 +108,7 @@ index e949e3302af4..c586bcdb5190 100644 old = 1; else old = 0; -@@ -328,17 +337,18 @@ static int btt_log_read(struct arena_info *arena, u32 lane, +@@ -315,17 +324,18 @@ static int btt_log_read(struct arena_info *arena, u32 lane, { int ret; int old_ent, ret_ent; @@ -121,7 +123,7 @@ index e949e3302af4..c586bcdb5190 100644 - old_ent = btt_log_get_old(log); + old_ent = btt_log_get_old(arena, &log); if (old_ent < 0 || old_ent > 1) { - dev_err(to_dev(arena), + dev_info(to_dev(arena), "log corruption (%d): lane %d seq [%d, %d]\n", - old_ent, lane, log[0].seq, log[1].seq); + old_ent, lane, log.ent[arena->log_index[0]].seq, @@ -129,7 +131,7 @@ index e949e3302af4..c586bcdb5190 100644 /* TODO set error state? */ return -EIO; } -@@ -346,7 +356,7 @@ static int btt_log_read(struct arena_info *arena, u32 lane, +@@ -333,7 +343,7 @@ static int btt_log_read(struct arena_info *arena, u32 lane, ret_ent = (old_flag ? old_ent : (1 - old_ent)); if (ent != NULL) @@ -138,7 +140,7 @@ index e949e3302af4..c586bcdb5190 100644 return ret_ent; } -@@ -360,17 +370,13 @@ static int __btt_log_write(struct arena_info *arena, u32 lane, +@@ -347,17 +357,13 @@ static int __btt_log_write(struct arena_info *arena, u32 lane, u32 sub, struct log_entry *ent, unsigned long flags) { int ret; @@ -161,7 +163,7 @@ index e949e3302af4..c586bcdb5190 100644 /* split the 16B write into atomic, durable halves */ ret = arena_write_bytes(arena, ns_off, src, log_half, flags); if (ret) -@@ -453,7 +459,7 @@ static int btt_log_init(struct arena_info *arena) +@@ -436,7 +442,7 @@ static int btt_log_init(struct arena_info *arena) { size_t logsize = arena->info2off - arena->logoff; size_t chunk_size = SZ_4K, offset = 0; @@ -170,7 +172,7 @@ index e949e3302af4..c586bcdb5190 100644 void *zerobuf; int ret; u32 i; -@@ -485,11 +491,11 @@ static int btt_log_init(struct arena_info *arena) +@@ -466,11 +472,11 @@ static int btt_log_init(struct arena_info *arena) } for (i = 0; i < arena->nfree; i++) { @@ -187,7 +189,7 @@ index e949e3302af4..c586bcdb5190 100644 if (ret) goto free; } -@@ -594,6 +600,123 @@ static int btt_freelist_init(struct arena_info *arena) +@@ -531,6 +537,123 @@ static int btt_freelist_init(struct arena_info *arena) return 0; } @@ -311,7 +313,7 @@ index e949e3302af4..c586bcdb5190 100644 static int btt_rtt_init(struct arena_info *arena) { arena->rtt = kcalloc(arena->nfree, sizeof(u32), GFP_KERNEL); -@@ -650,8 +773,7 @@ static struct arena_info *alloc_arena(struct btt *btt, size_t size, +@@ -586,8 +709,7 @@ static struct arena_info *alloc_arena(struct btt *btt, size_t size, available -= 2 * BTT_PG_SIZE; /* The log takes a fixed amount of space based on nfree */ @@ -321,7 +323,7 @@ index e949e3302af4..c586bcdb5190 100644 available -= logsize; /* Calculate optimal split between map and data area */ -@@ -668,6 +790,10 @@ static struct arena_info *alloc_arena(struct btt *btt, size_t size, +@@ -604,6 +726,10 @@ static struct arena_info *alloc_arena(struct btt *btt, size_t size, arena->mapoff = arena->dataoff + datasize; arena->logoff = arena->mapoff + mapsize; arena->info2off = arena->logoff + logsize; @@ -332,7 +334,7 @@ index e949e3302af4..c586bcdb5190 100644 return arena; } -@@ -758,6 +884,13 @@ static int discover_arenas(struct btt *btt) +@@ -694,6 +820,13 @@ static int discover_arenas(struct btt *btt) arena->external_lba_start = cur_nlba; parse_arena_meta(arena, super, cur_off); @@ -343,14 +345,14 @@ index e949e3302af4..c586bcdb5190 100644 + goto out; + } + - mutex_init(&arena->err_lock); ret = btt_freelist_init(arena); if (ret) + goto out; diff --git a/drivers/nvdimm/btt.h b/drivers/nvdimm/btt.h -index 884fbbbdd18a..db3cb6d4d0d4 100644 +index b2f8651e5395..0f80b6b3d4a3 100644 --- a/drivers/nvdimm/btt.h +++ b/drivers/nvdimm/btt.h -@@ -27,6 +27,7 @@ +@@ -26,6 +26,7 @@ #define MAP_ERR_MASK (1 << MAP_ERR_SHIFT) #define MAP_LBA_MASK (~((1 << MAP_TRIM_SHIFT) | (1 << MAP_ERR_SHIFT))) #define MAP_ENT_NORMAL 0xC0000000 @@ -358,7 +360,7 @@ index 884fbbbdd18a..db3cb6d4d0d4 100644 #define LOG_ENT_SIZE sizeof(struct log_entry) #define ARENA_MIN_SIZE (1UL << 24) /* 16 MB */ #define ARENA_MAX_SIZE (1ULL << 39) /* 512 GB */ -@@ -50,12 +51,52 @@ enum btt_init_state { +@@ -44,12 +45,52 @@ enum btt_init_state { INIT_READY }; @@ -412,18 +414,18 @@ index 884fbbbdd18a..db3cb6d4d0d4 100644 }; struct btt_sb { -@@ -126,6 +167,7 @@ struct aligned_lock { +@@ -117,6 +158,7 @@ struct aligned_lock { + * @list: List head for list of arenas * @debugfs_dir: Debugfs dentry * @flags: Arena flags - may signify error states. - * @err_lock: Mutex for synchronizing error clearing. + * @log_index: Indices of the valid log entries in a log_group * * arena_info is a per-arena handle. Once an arena is narrowed down for an * IO, this struct is passed around for the duration of the IO. -@@ -158,6 +200,7 @@ struct arena_info { +@@ -147,6 +189,7 @@ struct arena_info { + struct dentry *debugfs_dir; /* Arena flags */ u32 flags; - struct mutex err_lock; + int log_index[2]; }; |