+++ /dev/null
-From 8b9bd2db0e9557b04fb4c8b36bd03900b3af3a8a Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 8 Sep 2020 14:27:09 +0800
-Subject: debugobjects: Free per CPU pool after CPU unplug
-
-From: Zqiang <qiang.zhang@windriver.com>
-
-[ Upstream commit 88451f2cd3cec2abc30debdf129422d2699d1eba ]
-
-If a CPU is offlined the debug objects per CPU pool is not cleaned up. If
-the CPU is never onlined again then the objects in the pool are wasted.
-
-Add a CPU hotplug callback which is invoked after the CPU is dead to free
-the pool.
-
-[ tglx: Massaged changelog and added comment about remote access safety ]
-
-Signed-off-by: Zqiang <qiang.zhang@windriver.com>
-Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-Cc: Waiman Long <longman@redhat.com>
-Link: https://lore.kernel.org/r/20200908062709.11441-1-qiang.zhang@windriver.com
-Stable-dep-of: eabb7f1ace53 ("lib/debugobjects: fix stat count and optimize debug_objects_mem_init")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- include/linux/cpuhotplug.h | 1 +
- lib/debugobjects.c | 25 +++++++++++++++++++++++++
- 2 files changed, 26 insertions(+)
-
-diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
-index 15835f37bd5f..970b47fcd6ff 100644
---- a/include/linux/cpuhotplug.h
-+++ b/include/linux/cpuhotplug.h
-@@ -36,6 +36,7 @@ enum cpuhp_state {
- CPUHP_X86_MCE_DEAD,
- CPUHP_VIRT_NET_DEAD,
- CPUHP_SLUB_DEAD,
-+ CPUHP_DEBUG_OBJ_DEAD,
- CPUHP_MM_WRITEBACK_DEAD,
- CPUHP_MM_VMSTAT_DEAD,
- CPUHP_SOFTIRQ_DEAD,
-diff --git a/lib/debugobjects.c b/lib/debugobjects.c
-index 48054dbf1b51..746b632792b5 100644
---- a/lib/debugobjects.c
-+++ b/lib/debugobjects.c
-@@ -19,6 +19,7 @@
- #include <linux/slab.h>
- #include <linux/hash.h>
- #include <linux/kmemleak.h>
-+#include <linux/cpu.h>
-
- #define ODEBUG_HASH_BITS 14
- #define ODEBUG_HASH_SIZE (1 << ODEBUG_HASH_BITS)
-@@ -433,6 +434,25 @@ static void free_object(struct debug_obj *obj)
- }
- }
-
-+#ifdef CONFIG_HOTPLUG_CPU
-+static int object_cpu_offline(unsigned int cpu)
-+{
-+ struct debug_percpu_free *percpu_pool;
-+ struct hlist_node *tmp;
-+ struct debug_obj *obj;
-+
-+ /* Remote access is safe as the CPU is dead already */
-+ percpu_pool = per_cpu_ptr(&percpu_obj_pool, cpu);
-+ hlist_for_each_entry_safe(obj, tmp, &percpu_pool->free_objs, node) {
-+ hlist_del(&obj->node);
-+ kmem_cache_free(obj_cache, obj);
-+ }
-+ percpu_pool->obj_free = 0;
-+
-+ return 0;
-+}
-+#endif
-+
- /*
- * We run out of memory. That means we probably have tons of objects
- * allocated.
-@@ -1378,6 +1398,11 @@ void __init debug_objects_mem_init(void)
- } else
- debug_objects_selftest();
-
-+#ifdef CONFIG_HOTPLUG_CPU
-+ cpuhp_setup_state_nocalls(CPUHP_DEBUG_OBJ_DEAD, "object:offline", NULL,
-+ object_cpu_offline);
-+#endif
-+
- /*
- * Increase the thresholds for allocating and freeing objects
- * according to the number of possible CPUs available in the system.
---
-2.35.1
-
Cc: stable@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
- fs/ext4/inode.c | 3 ++-
+ fs/ext4/inode.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
-diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
-index 5eb1d9ac269c..0830a4de47bc 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
-@@ -4530,7 +4530,8 @@ int ext4_truncate(struct inode *inode)
+@@ -4556,7 +4556,8 @@ int ext4_truncate(struct inode *inode)
/* If we zero-out tail of the page, we have to create jinode for jbd2 */
if (inode->i_size & (inode->i_sb->s_blocksize - 1)) {
goto out_trace;
}
---
-2.35.1
-
+++ /dev/null
-From da383a89ea15bc937f28cf199eeee546d82be16a Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 5 Nov 2019 17:44:17 +0100
-Subject: ext4, jbd2: Provide accessor function for handle credits
-
-From: Jan Kara <jack@suse.cz>
-
-[ Upstream commit a9a8344ee1714f835ba394077e8c13d751e2f148 ]
-
-Provide accessor function to get number of credits available in a handle
-and use it from ext4. Later, computation of available credits won't be
-so straightforward.
-
-Reviewed-by: Theodore Ts'o <tytso@mit.edu>
-Signed-off-by: Jan Kara <jack@suse.cz>
-Link: https://lore.kernel.org/r/20191105164437.32602-11-jack@suse.cz
-Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-Stable-dep-of: d87a7b4c77a9 ("jbd2: use the correct print format")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/ext4/ext4_jbd2.c | 13 +++++++------
- fs/ext4/ext4_jbd2.h | 7 -------
- fs/ext4/xattr.c | 2 +-
- include/linux/jbd2.h | 6 ++++++
- 4 files changed, 14 insertions(+), 14 deletions(-)
-
-diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c
-index 2b98d893cda9..731bbfdbce5b 100644
---- a/fs/ext4/ext4_jbd2.c
-+++ b/fs/ext4/ext4_jbd2.c
-@@ -119,8 +119,8 @@ handle_t *__ext4_journal_start_reserved(handle_t *handle, unsigned int line,
- return ext4_get_nojournal();
-
- sb = handle->h_journal->j_private;
-- trace_ext4_journal_start_reserved(sb, handle->h_buffer_credits,
-- _RET_IP_);
-+ trace_ext4_journal_start_reserved(sb,
-+ jbd2_handle_buffer_credits(handle), _RET_IP_);
- err = ext4_journal_check_start(sb);
- if (err < 0) {
- jbd2_journal_free_reserved(handle);
-@@ -138,10 +138,10 @@ int __ext4_journal_ensure_credits(handle_t *handle, int check_cred,
- {
- if (!ext4_handle_valid(handle))
- return 0;
-- if (handle->h_buffer_credits >= check_cred)
-+ if (jbd2_handle_buffer_credits(handle) >= check_cred)
- return 0;
- return ext4_journal_extend(handle,
-- extend_cred - handle->h_buffer_credits);
-+ extend_cred - jbd2_handle_buffer_credits(handle));
- }
-
- static void ext4_journal_abort_handle(const char *caller, unsigned int line,
-@@ -289,7 +289,7 @@ int __ext4_handle_dirty_metadata(const char *where, unsigned int line,
- handle->h_type,
- handle->h_line_no,
- handle->h_requested_credits,
-- handle->h_buffer_credits, err);
-+ jbd2_handle_buffer_credits(handle), err);
- return err;
- }
- ext4_error_inode(inode, where, line,
-@@ -300,7 +300,8 @@ int __ext4_handle_dirty_metadata(const char *where, unsigned int line,
- handle->h_type,
- handle->h_line_no,
- handle->h_requested_credits,
-- handle->h_buffer_credits, err);
-+ jbd2_handle_buffer_credits(handle),
-+ err);
- }
- } else {
- if (inode)
-diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
-index 481bf770a374..a4b980eae4da 100644
---- a/fs/ext4/ext4_jbd2.h
-+++ b/fs/ext4/ext4_jbd2.h
-@@ -288,13 +288,6 @@ static inline int ext4_handle_is_aborted(handle_t *handle)
- return 0;
- }
-
--static inline int ext4_handle_has_enough_credits(handle_t *handle, int needed)
--{
-- if (ext4_handle_valid(handle) && handle->h_buffer_credits < needed)
-- return 0;
-- return 1;
--}
--
- #define ext4_journal_start_sb(sb, type, nblocks) \
- __ext4_journal_start_sb((sb), __LINE__, (type), (nblocks), 0)
-
-diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
-index cf1af6a4a567..40f76cf6d031 100644
---- a/fs/ext4/xattr.c
-+++ b/fs/ext4/xattr.c
-@@ -2330,7 +2330,7 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
- flags & XATTR_CREATE);
- brelse(bh);
-
-- if (!ext4_handle_has_enough_credits(handle, credits)) {
-+ if (jbd2_handle_buffer_credits(handle) < credits) {
- error = -ENOSPC;
- goto cleanup;
- }
-diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
-index b0e97e5de8ca..a0768a4b3e84 100644
---- a/include/linux/jbd2.h
-+++ b/include/linux/jbd2.h
-@@ -1644,6 +1644,12 @@ static inline tid_t jbd2_get_latest_transaction(journal_t *journal)
- return tid;
- }
-
-+
-+static inline int jbd2_handle_buffer_credits(handle_t *handle)
-+{
-+ return handle->h_buffer_credits;
-+}
-+
- #ifdef __KERNEL__
-
- #define buffer_trace_init(bh) do {} while (0)
---
-2.35.1
-
Stable-dep-of: a71248b1accb ("ext4: fix use-after-free in ext4_orphan_cleanup")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
- fs/ext4/inode.c | 17 +++++++++--------
+ fs/ext4/inode.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
-diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
-index a39567e03580..5eb1d9ac269c 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
-@@ -4513,7 +4513,7 @@ int ext4_truncate(struct inode *inode)
+@@ -4539,7 +4539,7 @@ int ext4_truncate(struct inode *inode)
trace_ext4_truncate_enter(inode);
if (!ext4_can_truncate(inode))
ext4_clear_inode_flag(inode, EXT4_INODE_EOFBLOCKS);
-@@ -4524,16 +4524,14 @@ int ext4_truncate(struct inode *inode)
+@@ -4550,16 +4550,14 @@ int ext4_truncate(struct inode *inode)
int has_inline = 1;
err = ext4_inline_data_truncate(inode, &has_inline);
}
if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
-@@ -4542,8 +4540,10 @@ int ext4_truncate(struct inode *inode)
+@@ -4568,8 +4566,10 @@ int ext4_truncate(struct inode *inode)
credits = ext4_blocks_for_truncate(inode);
handle = ext4_journal_start(inode, EXT4_HT_TRUNCATE, credits);
if (inode->i_size & (inode->i_sb->s_blocksize - 1))
ext4_block_truncate_page(handle, mapping, inode->i_size);
-@@ -4592,6 +4592,7 @@ int ext4_truncate(struct inode *inode)
+@@ -4618,6 +4618,7 @@ out_stop:
ext4_mark_inode_dirty(handle, inode);
ext4_journal_stop(handle);
trace_ext4_truncate_exit(inode);
return err;
}
---
-2.35.1
-
+++ /dev/null
-From 629cf5472a71183744208ab6d8ee4305367bb86b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 5 Nov 2019 17:44:16 +0100
-Subject: ext4: Provide function to handle transaction restarts
-
-From: Jan Kara <jack@suse.cz>
-
-[ Upstream commit a413036791d040e33badcc634453a4d0c0705499 ]
-
-Provide ext4_journal_ensure_credits_fn() function to ensure transaction
-has given amount of credits and call helper function to prepare for
-restarting a transaction. This allows to remove some boilerplate code
-from various places, add proper error handling for the case where
-transaction extension or restart fails, and reduces following changes
-needed for proper revoke record reservation tracking.
-
-Signed-off-by: Jan Kara <jack@suse.cz>
-Link: https://lore.kernel.org/r/20191105164437.32602-10-jack@suse.cz
-Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-Stable-dep-of: d87a7b4c77a9 ("jbd2: use the correct print format")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/ext4/ext4.h | 4 +-
- fs/ext4/ext4_jbd2.c | 11 ++++++
- fs/ext4/ext4_jbd2.h | 48 +++++++++++++++++++++++
- fs/ext4/extents.c | 68 +++++++++++++++++++-------------
- fs/ext4/indirect.c | 93 +++++++++++++++++++++++++-------------------
- fs/ext4/inode.c | 26 -------------
- fs/ext4/migrate.c | 95 +++++++++++++++++----------------------------
- fs/ext4/resize.c | 46 +++++-----------------
- fs/ext4/xattr.c | 90 ++++++++++++++++--------------------------
- 9 files changed, 234 insertions(+), 247 deletions(-)
-
-diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
-index 946804c3c4b1..6017a55b3834 100644
---- a/fs/ext4/ext4.h
-+++ b/fs/ext4/ext4.h
-@@ -2634,7 +2634,6 @@ extern int ext4_can_truncate(struct inode *inode);
- extern int ext4_truncate(struct inode *);
- extern int ext4_break_layouts(struct inode *);
- extern int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length);
--extern int ext4_truncate_restart_trans(handle_t *, struct inode *, int nblocks);
- extern void ext4_set_inode_flags(struct inode *);
- extern int ext4_alloc_da_blocks(struct inode *inode);
- extern void ext4_set_aops(struct inode *inode);
-@@ -3327,6 +3326,9 @@ extern int ext4_swap_extents(handle_t *handle, struct inode *inode1,
- ext4_lblk_t lblk2, ext4_lblk_t count,
- int mark_unwritten,int *err);
- extern int ext4_clu_mapped(struct inode *inode, ext4_lblk_t lclu);
-+extern int ext4_datasem_ensure_credits(handle_t *handle, struct inode *inode,
-+ int check_cred, int restart_cred);
-+
-
- /* move_extent.c */
- extern void ext4_double_down_write_data_sem(struct inode *first,
-diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c
-index 7c70b08d104c..2b98d893cda9 100644
---- a/fs/ext4/ext4_jbd2.c
-+++ b/fs/ext4/ext4_jbd2.c
-@@ -133,6 +133,17 @@ handle_t *__ext4_journal_start_reserved(handle_t *handle, unsigned int line,
- return handle;
- }
-
-+int __ext4_journal_ensure_credits(handle_t *handle, int check_cred,
-+ int extend_cred)
-+{
-+ if (!ext4_handle_valid(handle))
-+ return 0;
-+ if (handle->h_buffer_credits >= check_cred)
-+ return 0;
-+ return ext4_journal_extend(handle,
-+ extend_cred - handle->h_buffer_credits);
-+}
-+
- static void ext4_journal_abort_handle(const char *caller, unsigned int line,
- const char *err_fn,
- struct buffer_head *bh,
-diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
-index ef8fcf7d0d3b..481bf770a374 100644
---- a/fs/ext4/ext4_jbd2.h
-+++ b/fs/ext4/ext4_jbd2.h
-@@ -346,6 +346,54 @@ static inline int ext4_journal_restart(handle_t *handle, int nblocks)
- return 0;
- }
-
-+int __ext4_journal_ensure_credits(handle_t *handle, int check_cred,
-+ int extend_cred);
-+
-+
-+/*
-+ * Ensure @handle has at least @check_creds credits available. If not,
-+ * transaction will be extended or restarted to contain at least @extend_cred
-+ * credits. Before restarting transaction @fn is executed to allow for cleanup
-+ * before the transaction is restarted.
-+ *
-+ * The return value is < 0 in case of error, 0 in case the handle has enough
-+ * credits or transaction extension succeeded, 1 in case transaction had to be
-+ * restarted.
-+ */
-+#define ext4_journal_ensure_credits_fn(handle, check_cred, extend_cred, fn) \
-+({ \
-+ __label__ __ensure_end; \
-+ int err = __ext4_journal_ensure_credits((handle), (check_cred), \
-+ (extend_cred)); \
-+ \
-+ if (err <= 0) \
-+ goto __ensure_end; \
-+ err = (fn); \
-+ if (err < 0) \
-+ goto __ensure_end; \
-+ err = ext4_journal_restart((handle), (extend_cred)); \
-+ if (err == 0) \
-+ err = 1; \
-+__ensure_end: \
-+ err; \
-+})
-+
-+/*
-+ * Ensure given handle has at least requested amount of credits available,
-+ * possibly restarting transaction if needed.
-+ */
-+static inline int ext4_journal_ensure_credits(handle_t *handle, int credits)
-+{
-+ return ext4_journal_ensure_credits_fn(handle, credits, credits, 0);
-+}
-+
-+static inline int ext4_journal_ensure_credits_batch(handle_t *handle,
-+ int credits)
-+{
-+ return ext4_journal_ensure_credits_fn(handle, credits,
-+ EXT4_MAX_TRANS_DATA, 0);
-+}
-+
- static inline int ext4_journal_blocks_per_page(struct inode *inode)
- {
- if (EXT4_JOURNAL(inode) != NULL)
-diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
-index 27760c39f70e..81226addfefe 100644
---- a/fs/ext4/extents.c
-+++ b/fs/ext4/extents.c
-@@ -100,29 +100,40 @@ static int ext4_split_extent_at(handle_t *handle,
- static int ext4_find_delayed_extent(struct inode *inode,
- struct extent_status *newes);
-
--static int ext4_ext_truncate_extend_restart(handle_t *handle,
-- struct inode *inode,
-- int needed)
-+static int ext4_ext_trunc_restart_fn(struct inode *inode, int *dropped)
- {
-- int err;
--
-- if (!ext4_handle_valid(handle))
-- return 0;
-- if (handle->h_buffer_credits >= needed)
-- return 0;
- /*
-- * If we need to extend the journal get a few extra blocks
-- * while we're at it for efficiency's sake.
-+ * Drop i_data_sem to avoid deadlock with ext4_map_blocks. At this
-+ * moment, get_block can be called only for blocks inside i_size since
-+ * page cache has been already dropped and writes are blocked by
-+ * i_mutex. So we can safely drop the i_data_sem here.
- */
-- needed += 3;
-- err = ext4_journal_extend(handle, needed - handle->h_buffer_credits);
-- if (err <= 0)
-- return err;
-- err = ext4_truncate_restart_trans(handle, inode, needed);
-- if (err == 0)
-- err = -EAGAIN;
-+ BUG_ON(EXT4_JOURNAL(inode) == NULL);
-+ ext4_discard_preallocations(inode);
-+ up_write(&EXT4_I(inode)->i_data_sem);
-+ *dropped = 1;
-+ return 0;
-+}
-
-- return err;
-+/*
-+ * Make sure 'handle' has at least 'check_cred' credits. If not, restart
-+ * transaction with 'restart_cred' credits. The function drops i_data_sem
-+ * when restarting transaction and gets it after transaction is restarted.
-+ *
-+ * The function returns 0 on success, 1 if transaction had to be restarted,
-+ * and < 0 in case of fatal error.
-+ */
-+int ext4_datasem_ensure_credits(handle_t *handle, struct inode *inode,
-+ int check_cred, int restart_cred)
-+{
-+ int ret;
-+ int dropped = 0;
-+
-+ ret = ext4_journal_ensure_credits_fn(handle, check_cred, restart_cred,
-+ ext4_ext_trunc_restart_fn(inode, &dropped));
-+ if (dropped)
-+ down_write(&EXT4_I(inode)->i_data_sem);
-+ return ret;
- }
-
- /*
-@@ -2868,9 +2879,13 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode,
- }
- credits += EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb);
-
-- err = ext4_ext_truncate_extend_restart(handle, inode, credits);
-- if (err)
-+ err = ext4_datasem_ensure_credits(handle, inode, credits,
-+ credits);
-+ if (err) {
-+ if (err > 0)
-+ err = -EAGAIN;
- goto out;
-+ }
-
- err = ext4_ext_get_access(handle, inode, path + depth);
- if (err)
-@@ -5259,13 +5274,10 @@ ext4_access_path(handle_t *handle, struct inode *inode,
- * descriptor) for each block group; assume two block
- * groups
- */
-- if (handle->h_buffer_credits < 7) {
-- credits = ext4_writepage_trans_blocks(inode);
-- err = ext4_ext_truncate_extend_restart(handle, inode, credits);
-- /* EAGAIN is success */
-- if (err && err != -EAGAIN)
-- return err;
-- }
-+ credits = ext4_writepage_trans_blocks(inode);
-+ err = ext4_datasem_ensure_credits(handle, inode, 7, credits);
-+ if (err < 0)
-+ return err;
-
- err = ext4_ext_get_access(handle, inode, path);
- return err;
-diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c
-index a131d2781342..9e13e31a1a22 100644
---- a/fs/ext4/indirect.c
-+++ b/fs/ext4/indirect.c
-@@ -696,27 +696,62 @@ int ext4_ind_trans_blocks(struct inode *inode, int nrblocks)
- return DIV_ROUND_UP(nrblocks, EXT4_ADDR_PER_BLOCK(inode->i_sb)) + 4;
- }
-
-+static int ext4_ind_trunc_restart_fn(handle_t *handle, struct inode *inode,
-+ struct buffer_head *bh, int *dropped)
-+{
-+ int err;
-+
-+ if (bh) {
-+ BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata");
-+ err = ext4_handle_dirty_metadata(handle, inode, bh);
-+ if (unlikely(err))
-+ return err;
-+ }
-+ err = ext4_mark_inode_dirty(handle, inode);
-+ if (unlikely(err))
-+ return err;
-+ /*
-+ * Drop i_data_sem to avoid deadlock with ext4_map_blocks. At this
-+ * moment, get_block can be called only for blocks inside i_size since
-+ * page cache has been already dropped and writes are blocked by
-+ * i_mutex. So we can safely drop the i_data_sem here.
-+ */
-+ BUG_ON(EXT4_JOURNAL(inode) == NULL);
-+ ext4_discard_preallocations(inode);
-+ up_write(&EXT4_I(inode)->i_data_sem);
-+ *dropped = 1;
-+ return 0;
-+}
-+
- /*
- * Truncate transactions can be complex and absolutely huge. So we need to
- * be able to restart the transaction at a conventient checkpoint to make
- * sure we don't overflow the journal.
- *
- * Try to extend this transaction for the purposes of truncation. If
-- * extend fails, we need to propagate the failure up and restart the
-- * transaction in the top-level truncate loop. --sct
-- *
-- * Returns 0 if we managed to create more room. If we can't create more
-- * room, and the transaction must be restarted we return 1.
-+ * extend fails, we restart transaction.
- */
--static int try_to_extend_transaction(handle_t *handle, struct inode *inode)
-+static int ext4_ind_truncate_ensure_credits(handle_t *handle,
-+ struct inode *inode,
-+ struct buffer_head *bh)
- {
-- if (!ext4_handle_valid(handle))
-- return 0;
-- if (ext4_handle_has_enough_credits(handle, EXT4_RESERVE_TRANS_BLOCKS+1))
-- return 0;
-- if (!ext4_journal_extend(handle, ext4_blocks_for_truncate(inode)))
-- return 0;
-- return 1;
-+ int ret;
-+ int dropped = 0;
-+
-+ ret = ext4_journal_ensure_credits_fn(handle, EXT4_RESERVE_TRANS_BLOCKS,
-+ ext4_blocks_for_truncate(inode),
-+ ext4_ind_trunc_restart_fn(handle, inode, bh, &dropped));
-+ if (dropped)
-+ down_write(&EXT4_I(inode)->i_data_sem);
-+ if (ret <= 0)
-+ return ret;
-+ if (bh) {
-+ BUFFER_TRACE(bh, "retaking write access");
-+ ret = ext4_journal_get_write_access(handle, bh);
-+ if (unlikely(ret))
-+ return ret;
-+ }
-+ return 0;
- }
-
- /*
-@@ -851,27 +886,9 @@ static int ext4_clear_blocks(handle_t *handle, struct inode *inode,
- return 1;
- }
-
-- if (try_to_extend_transaction(handle, inode)) {
-- if (bh) {
-- BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata");
-- err = ext4_handle_dirty_metadata(handle, inode, bh);
-- if (unlikely(err))
-- goto out_err;
-- }
-- err = ext4_mark_inode_dirty(handle, inode);
-- if (unlikely(err))
-- goto out_err;
-- err = ext4_truncate_restart_trans(handle, inode,
-- ext4_blocks_for_truncate(inode));
-- if (unlikely(err))
-- goto out_err;
-- if (bh) {
-- BUFFER_TRACE(bh, "retaking write access");
-- err = ext4_journal_get_write_access(handle, bh);
-- if (unlikely(err))
-- goto out_err;
-- }
-- }
-+ err = ext4_ind_truncate_ensure_credits(handle, inode, bh);
-+ if (err < 0)
-+ goto out_err;
-
- for (p = first; p < last; p++)
- *p = 0;
-@@ -1054,11 +1071,9 @@ static void ext4_free_branches(handle_t *handle, struct inode *inode,
- */
- if (ext4_handle_is_aborted(handle))
- return;
-- if (try_to_extend_transaction(handle, inode)) {
-- ext4_mark_inode_dirty(handle, inode);
-- ext4_truncate_restart_trans(handle, inode,
-- ext4_blocks_for_truncate(inode));
-- }
-+ if (ext4_ind_truncate_ensure_credits(handle, inode,
-+ NULL) < 0)
-+ return;
-
- /*
- * The forget flag here is critical because if
-diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
-index b38427b8d083..a39567e03580 100644
---- a/fs/ext4/inode.c
-+++ b/fs/ext4/inode.c
-@@ -163,32 +163,6 @@ int ext4_inode_is_fast_symlink(struct inode *inode)
- (inode->i_size < EXT4_N_BLOCKS * 4);
- }
-
--/*
-- * Restart the transaction associated with *handle. This does a commit,
-- * so before we call here everything must be consistently dirtied against
-- * this transaction.
-- */
--int ext4_truncate_restart_trans(handle_t *handle, struct inode *inode,
-- int nblocks)
--{
-- int ret;
--
-- /*
-- * Drop i_data_sem to avoid deadlock with ext4_map_blocks. At this
-- * moment, get_block can be called only for blocks inside i_size since
-- * page cache has been already dropped and writes are blocked by
-- * i_mutex. So we can safely drop the i_data_sem here.
-- */
-- BUG_ON(EXT4_JOURNAL(inode) == NULL);
-- jbd_debug(2, "restarting handle %p\n", handle);
-- up_write(&EXT4_I(inode)->i_data_sem);
-- ret = ext4_journal_restart(handle, nblocks);
-- down_write(&EXT4_I(inode)->i_data_sem);
-- ext4_discard_preallocations(inode);
--
-- return ret;
--}
--
- /*
- * Called at the last iput() if i_nlink is zero.
- */
-diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c
-index dbba3c3a2f06..6d1243819ab3 100644
---- a/fs/ext4/migrate.c
-+++ b/fs/ext4/migrate.c
-@@ -50,29 +50,9 @@ static int finish_range(handle_t *handle, struct inode *inode,
- needed = ext4_ext_calc_credits_for_single_extent(inode,
- lb->last_block - lb->first_block + 1, path);
-
-- /*
-- * Make sure the credit we accumalated is not really high
-- */
-- if (needed && ext4_handle_has_enough_credits(handle,
-- EXT4_RESERVE_TRANS_BLOCKS)) {
-- up_write((&EXT4_I(inode)->i_data_sem));
-- retval = ext4_journal_restart(handle, needed);
-- down_write((&EXT4_I(inode)->i_data_sem));
-- if (retval)
-- goto err_out;
-- } else if (needed) {
-- retval = ext4_journal_extend(handle, needed);
-- if (retval) {
-- /*
-- * IF not able to extend the journal restart the journal
-- */
-- up_write((&EXT4_I(inode)->i_data_sem));
-- retval = ext4_journal_restart(handle, needed);
-- down_write((&EXT4_I(inode)->i_data_sem));
-- if (retval)
-- goto err_out;
-- }
-- }
-+ retval = ext4_datasem_ensure_credits(handle, inode, needed, needed);
-+ if (retval < 0)
-+ goto err_out;
- retval = ext4_ext_insert_extent(handle, inode, &path, &newext, 0);
- err_out:
- up_write((&EXT4_I(inode)->i_data_sem));
-@@ -196,26 +176,6 @@ static int update_tind_extent_range(handle_t *handle, struct inode *inode,
-
- }
-
--static int extend_credit_for_blkdel(handle_t *handle, struct inode *inode)
--{
-- int retval = 0, needed;
--
-- if (ext4_handle_has_enough_credits(handle, EXT4_RESERVE_TRANS_BLOCKS+1))
-- return 0;
-- /*
-- * We are freeing a blocks. During this we touch
-- * superblock, group descriptor and block bitmap.
-- * So allocate a credit of 3. We may update
-- * quota (user and group).
-- */
-- needed = 3 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb);
--
-- if (ext4_journal_extend(handle, needed) != 0)
-- retval = ext4_journal_restart(handle, needed);
--
-- return retval;
--}
--
- static int free_dind_blocks(handle_t *handle,
- struct inode *inode, __le32 i_data)
- {
-@@ -223,6 +183,7 @@ static int free_dind_blocks(handle_t *handle,
- __le32 *tmp_idata;
- struct buffer_head *bh;
- unsigned long max_entries = inode->i_sb->s_blocksize >> 2;
-+ int err;
-
- bh = ext4_sb_bread(inode->i_sb, le32_to_cpu(i_data), 0);
- if (IS_ERR(bh))
-@@ -231,7 +192,12 @@ static int free_dind_blocks(handle_t *handle,
- tmp_idata = (__le32 *)bh->b_data;
- for (i = 0; i < max_entries; i++) {
- if (tmp_idata[i]) {
-- extend_credit_for_blkdel(handle, inode);
-+ err = ext4_journal_ensure_credits(handle,
-+ EXT4_RESERVE_TRANS_BLOCKS);
-+ if (err < 0) {
-+ put_bh(bh);
-+ return err;
-+ }
- ext4_free_blocks(handle, inode, NULL,
- le32_to_cpu(tmp_idata[i]), 1,
- EXT4_FREE_BLOCKS_METADATA |
-@@ -239,7 +205,9 @@ static int free_dind_blocks(handle_t *handle,
- }
- }
- put_bh(bh);
-- extend_credit_for_blkdel(handle, inode);
-+ err = ext4_journal_ensure_credits(handle, EXT4_RESERVE_TRANS_BLOCKS);
-+ if (err < 0)
-+ return err;
- ext4_free_blocks(handle, inode, NULL, le32_to_cpu(i_data), 1,
- EXT4_FREE_BLOCKS_METADATA |
- EXT4_FREE_BLOCKS_FORGET);
-@@ -270,7 +238,9 @@ static int free_tind_blocks(handle_t *handle,
- }
- }
- put_bh(bh);
-- extend_credit_for_blkdel(handle, inode);
-+ retval = ext4_journal_ensure_credits(handle, EXT4_RESERVE_TRANS_BLOCKS);
-+ if (retval < 0)
-+ return retval;
- ext4_free_blocks(handle, inode, NULL, le32_to_cpu(i_data), 1,
- EXT4_FREE_BLOCKS_METADATA |
- EXT4_FREE_BLOCKS_FORGET);
-@@ -283,7 +253,10 @@ static int free_ind_block(handle_t *handle, struct inode *inode, __le32 *i_data)
-
- /* ei->i_data[EXT4_IND_BLOCK] */
- if (i_data[0]) {
-- extend_credit_for_blkdel(handle, inode);
-+ retval = ext4_journal_ensure_credits(handle,
-+ EXT4_RESERVE_TRANS_BLOCKS);
-+ if (retval < 0)
-+ return retval;
- ext4_free_blocks(handle, inode, NULL,
- le32_to_cpu(i_data[0]), 1,
- EXT4_FREE_BLOCKS_METADATA |
-@@ -318,12 +291,9 @@ static int ext4_ext_swap_inode_data(handle_t *handle, struct inode *inode,
- * One credit accounted for writing the
- * i_data field of the original inode
- */
-- retval = ext4_journal_extend(handle, 1);
-- if (retval) {
-- retval = ext4_journal_restart(handle, 1);
-- if (retval)
-- goto err_out;
-- }
-+ retval = ext4_journal_ensure_credits(handle, 1);
-+ if (retval < 0)
-+ goto err_out;
-
- i_data[0] = ei->i_data[EXT4_IND_BLOCK];
- i_data[1] = ei->i_data[EXT4_DIND_BLOCK];
-@@ -391,15 +361,19 @@ static int free_ext_idx(handle_t *handle, struct inode *inode,
- ix = EXT_FIRST_INDEX(eh);
- for (i = 0; i < le16_to_cpu(eh->eh_entries); i++, ix++) {
- retval = free_ext_idx(handle, inode, ix);
-- if (retval)
-- break;
-+ if (retval) {
-+ put_bh(bh);
-+ return retval;
-+ }
- }
- }
- put_bh(bh);
-- extend_credit_for_blkdel(handle, inode);
-+ retval = ext4_journal_ensure_credits(handle, EXT4_RESERVE_TRANS_BLOCKS);
-+ if (retval < 0)
-+ return retval;
- ext4_free_blocks(handle, inode, NULL, block, 1,
- EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET);
-- return retval;
-+ return 0;
- }
-
- /*
-@@ -578,9 +552,9 @@ int ext4_ext_migrate(struct inode *inode)
- }
-
- /* We mark the tmp_inode dirty via ext4_ext_tree_init. */
-- if (ext4_journal_extend(handle, 1) != 0)
-- ext4_journal_restart(handle, 1);
--
-+ retval = ext4_journal_ensure_credits(handle, 1);
-+ if (retval < 0)
-+ goto out_stop;
- /*
- * Mark the tmp_inode as of size zero
- */
-@@ -599,6 +573,7 @@ int ext4_ext_migrate(struct inode *inode)
-
- /* Reset the extent details */
- ext4_ext_tree_init(handle, tmp_inode);
-+out_stop:
- ext4_journal_stop(handle);
- out_tmp_inode:
- unlock_new_inode(tmp_inode);
-diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
-index 880307ba0f27..44b52921f7f4 100644
---- a/fs/ext4/resize.c
-+++ b/fs/ext4/resize.c
-@@ -430,30 +430,6 @@ static struct buffer_head *bclean(handle_t *handle, struct super_block *sb,
- return bh;
- }
-
--/*
-- * If we have fewer than thresh credits, extend by EXT4_MAX_TRANS_DATA.
-- * If that fails, restart the transaction & regain write access for the
-- * buffer head which is used for block_bitmap modifications.
-- */
--static int extend_or_restart_transaction(handle_t *handle, int thresh)
--{
-- int err;
--
-- if (ext4_handle_has_enough_credits(handle, thresh))
-- return 0;
--
-- err = ext4_journal_extend(handle, EXT4_MAX_TRANS_DATA);
-- if (err < 0)
-- return err;
-- if (err) {
-- err = ext4_journal_restart(handle, EXT4_MAX_TRANS_DATA);
-- if (err)
-- return err;
-- }
--
-- return 0;
--}
--
- /*
- * set_flexbg_block_bitmap() mark clusters [@first_cluster, @last_cluster] used.
- *
-@@ -493,8 +469,8 @@ static int set_flexbg_block_bitmap(struct super_block *sb, handle_t *handle,
- continue;
- }
-
-- err = extend_or_restart_transaction(handle, 1);
-- if (err)
-+ err = ext4_journal_ensure_credits_batch(handle, 1);
-+ if (err < 0)
- return err;
-
- bh = sb_getblk(sb, flex_gd->groups[group].block_bitmap);
-@@ -586,8 +562,8 @@ static int setup_new_flex_group_blocks(struct super_block *sb,
- struct buffer_head *gdb;
-
- ext4_debug("update backup group %#04llx\n", block);
-- err = extend_or_restart_transaction(handle, 1);
-- if (err)
-+ err = ext4_journal_ensure_credits_batch(handle, 1);
-+ if (err < 0)
- goto out;
-
- gdb = sb_getblk(sb, block);
-@@ -644,8 +620,8 @@ static int setup_new_flex_group_blocks(struct super_block *sb,
-
- /* Initialize block bitmap of the @group */
- block = group_data[i].block_bitmap;
-- err = extend_or_restart_transaction(handle, 1);
-- if (err)
-+ err = ext4_journal_ensure_credits_batch(handle, 1);
-+ if (err < 0)
- goto out;
-
- bh = bclean(handle, sb, block);
-@@ -673,8 +649,8 @@ static int setup_new_flex_group_blocks(struct super_block *sb,
-
- /* Initialize inode bitmap of the @group */
- block = group_data[i].inode_bitmap;
-- err = extend_or_restart_transaction(handle, 1);
-- if (err)
-+ err = ext4_journal_ensure_credits_batch(handle, 1);
-+ if (err < 0)
- goto out;
- /* Mark unused entries in inode bitmap used */
- bh = bclean(handle, sb, block);
-@@ -1157,10 +1133,8 @@ static void update_backups(struct super_block *sb, sector_t blk_off, char *data,
- ext4_fsblk_t backup_block;
-
- /* Out of journal space, and can't get more - abort - so sad */
-- if (ext4_handle_valid(handle) &&
-- handle->h_buffer_credits == 0 &&
-- ext4_journal_extend(handle, EXT4_MAX_TRANS_DATA) &&
-- (err = ext4_journal_restart(handle, EXT4_MAX_TRANS_DATA)))
-+ err = ext4_journal_ensure_credits_batch(handle, 1);
-+ if (err < 0)
- break;
-
- if (meta_bg == 0)
-diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
-index 78df2d65998e..cf1af6a4a567 100644
---- a/fs/ext4/xattr.c
-+++ b/fs/ext4/xattr.c
-@@ -982,55 +982,6 @@ int __ext4_xattr_set_credits(struct super_block *sb, struct inode *inode,
- return credits;
- }
-
--static int ext4_xattr_ensure_credits(handle_t *handle, struct inode *inode,
-- int credits, struct buffer_head *bh,
-- bool dirty, bool block_csum)
--{
-- int error;
--
-- if (!ext4_handle_valid(handle))
-- return 0;
--
-- if (handle->h_buffer_credits >= credits)
-- return 0;
--
-- error = ext4_journal_extend(handle, credits - handle->h_buffer_credits);
-- if (!error)
-- return 0;
-- if (error < 0) {
-- ext4_warning(inode->i_sb, "Extend journal (error %d)", error);
-- return error;
-- }
--
-- if (bh && dirty) {
-- if (block_csum)
-- ext4_xattr_block_csum_set(inode, bh);
-- error = ext4_handle_dirty_metadata(handle, NULL, bh);
-- if (error) {
-- ext4_warning(inode->i_sb, "Handle metadata (error %d)",
-- error);
-- return error;
-- }
-- }
--
-- error = ext4_journal_restart(handle, credits);
-- if (error) {
-- ext4_warning(inode->i_sb, "Restart journal (error %d)", error);
-- return error;
-- }
--
-- if (bh) {
-- error = ext4_journal_get_write_access(handle, bh);
-- if (error) {
-- ext4_warning(inode->i_sb,
-- "Get write access failed (error %d)",
-- error);
-- return error;
-- }
-- }
-- return 0;
--}
--
- static int ext4_xattr_inode_update_ref(handle_t *handle, struct inode *ea_inode,
- int ref_change)
- {
-@@ -1148,6 +1099,24 @@ static int ext4_xattr_inode_inc_ref_all(handle_t *handle, struct inode *parent,
- return saved_err;
- }
-
-+static int ext4_xattr_restart_fn(handle_t *handle, struct inode *inode,
-+ struct buffer_head *bh, bool block_csum, bool dirty)
-+{
-+ int error;
-+
-+ if (bh && dirty) {
-+ if (block_csum)
-+ ext4_xattr_block_csum_set(inode, bh);
-+ error = ext4_handle_dirty_metadata(handle, NULL, bh);
-+ if (error) {
-+ ext4_warning(inode->i_sb, "Handle metadata (error %d)",
-+ error);
-+ return error;
-+ }
-+ }
-+ return 0;
-+}
-+
- static void
- ext4_xattr_inode_dec_ref_all(handle_t *handle, struct inode *parent,
- struct buffer_head *bh,
-@@ -1184,13 +1153,23 @@ ext4_xattr_inode_dec_ref_all(handle_t *handle, struct inode *parent,
- continue;
- }
-
-- err = ext4_xattr_ensure_credits(handle, parent, credits, bh,
-- dirty, block_csum);
-- if (err) {
-+ err = ext4_journal_ensure_credits_fn(handle, credits, credits,
-+ ext4_xattr_restart_fn(handle, parent, bh, block_csum,
-+ dirty));
-+ if (err < 0) {
- ext4_warning_inode(ea_inode, "Ensure credits err=%d",
- err);
- continue;
- }
-+ if (err > 0) {
-+ err = ext4_journal_get_write_access(handle, bh);
-+ if (err) {
-+ ext4_warning_inode(ea_inode,
-+ "Re-get write access err=%d",
-+ err);
-+ continue;
-+ }
-+ }
-
- err = ext4_xattr_inode_dec_ref(handle, ea_inode);
- if (err) {
-@@ -2879,11 +2858,8 @@ int ext4_xattr_delete_inode(handle_t *handle, struct inode *inode,
- struct inode *ea_inode;
- int error;
-
-- error = ext4_xattr_ensure_credits(handle, inode, extra_credits,
-- NULL /* bh */,
-- false /* dirty */,
-- false /* block_csum */);
-- if (error) {
-+ error = ext4_journal_ensure_credits(handle, extra_credits);
-+ if (error < 0) {
- EXT4_ERROR_INODE(inode, "ensure credits (error %d)", error);
- goto cleanup;
- }
---
-2.35.1
-
+++ /dev/null
-From 58a5adc78307d3204ab19ba2ed2eb1cd0929363f Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 5 Nov 2019 17:44:22 +0100
-Subject: jbd2: Drop pointless wakeup from jbd2_journal_stop()
-
-From: Jan Kara <jack@suse.cz>
-
-[ Upstream commit 5559b2d81b51de75cb7864bb1fbb82982f7e8fff ]
-
-When we drop last handle from a transaction and journal->j_barrier_count
-> 0, jbd2_journal_stop() wakes up journal->j_wait_transaction_locked
-wait queue. This looks pointless - wait for outstanding handles always
-happens on journal->j_wait_updates waitqueue.
-journal->j_wait_transaction_locked is used to wait for transaction state
-changes and by start_this_handle() for waiting until
-journal->j_barrier_count drops to 0. The first case is clearly
-irrelevant here since only jbd2 thread changes transaction state. The
-second case looks related but jbd2_journal_unlock_updates() is
-responsible for the wakeup in this case. So just drop the wakeup.
-
-Reviewed-by: Theodore Ts'o <tytso@mit.edu>
-Signed-off-by: Jan Kara <jack@suse.cz>
-Link: https://lore.kernel.org/r/20191105164437.32602-16-jack@suse.cz
-Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-Stable-dep-of: d87a7b4c77a9 ("jbd2: use the correct print format")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/jbd2/transaction.c | 5 +----
- 1 file changed, 1 insertion(+), 4 deletions(-)
-
-diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
-index ce66dbbf0f90..6d78648392f0 100644
---- a/fs/jbd2/transaction.c
-+++ b/fs/jbd2/transaction.c
-@@ -1850,11 +1850,8 @@ int jbd2_journal_stop(handle_t *handle)
- * once we do this, we must not dereference transaction
- * pointer again.
- */
-- if (atomic_dec_and_test(&transaction->t_updates)) {
-+ if (atomic_dec_and_test(&transaction->t_updates))
- wake_up(&journal->j_wait_updates);
-- if (journal->j_barrier_count)
-- wake_up(&journal->j_wait_transaction_locked);
-- }
-
- rwsem_release(&journal->j_trans_commit_map, 1, _THIS_IP_);
-
---
-2.35.1
-
+++ /dev/null
-From 80aa738f12e908dff5edaf9940b57127ba63363b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 5 Nov 2019 17:44:23 +0100
-Subject: jbd2: Factor out common parts of stopping and restarting a handle
-
-From: Jan Kara <jack@suse.cz>
-
-[ Upstream commit ec8b6f600e49dc87a8564807fec4193bf93ee2b5 ]
-
-jbd2__journal_restart() has quite some code that is common with
-jbd2_journal_stop(). Factor this functionality into stop_this_handle()
-helper and use it from both functions. Note that this also drops
-t_handle_lock protection from jbd2__journal_restart() as
-jbd2_journal_stop() does the same thing without it.
-
-Signed-off-by: Jan Kara <jack@suse.cz>
-Link: https://lore.kernel.org/r/20191105164437.32602-17-jack@suse.cz
-Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-Stable-dep-of: d87a7b4c77a9 ("jbd2: use the correct print format")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/jbd2/transaction.c | 98 ++++++++++++++++++++-----------------------
- 1 file changed, 46 insertions(+), 52 deletions(-)
-
-diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
-index 6d78648392f0..ee9a778c8fbe 100644
---- a/fs/jbd2/transaction.c
-+++ b/fs/jbd2/transaction.c
-@@ -514,12 +514,17 @@ handle_t *jbd2_journal_start(journal_t *journal, int nblocks)
- }
- EXPORT_SYMBOL(jbd2_journal_start);
-
--void jbd2_journal_free_reserved(handle_t *handle)
-+static void __jbd2_journal_unreserve_handle(handle_t *handle)
- {
- journal_t *journal = handle->h_journal;
-
- WARN_ON(!handle->h_reserved);
- sub_reserved_credits(journal, handle->h_buffer_credits);
-+}
-+
-+void jbd2_journal_free_reserved(handle_t *handle)
-+{
-+ __jbd2_journal_unreserve_handle(handle);
- jbd2_free_handle(handle);
- }
- EXPORT_SYMBOL(jbd2_journal_free_reserved);
-@@ -657,6 +662,28 @@ int jbd2_journal_extend(handle_t *handle, int nblocks)
- return result;
- }
-
-+static void stop_this_handle(handle_t *handle)
-+{
-+ transaction_t *transaction = handle->h_transaction;
-+ journal_t *journal = transaction->t_journal;
-+
-+ J_ASSERT(journal_current_handle() == handle);
-+ J_ASSERT(atomic_read(&transaction->t_updates) > 0);
-+ current->journal_info = NULL;
-+ atomic_sub(handle->h_buffer_credits,
-+ &transaction->t_outstanding_credits);
-+ if (handle->h_rsv_handle)
-+ __jbd2_journal_unreserve_handle(handle->h_rsv_handle);
-+ if (atomic_dec_and_test(&transaction->t_updates))
-+ wake_up(&journal->j_wait_updates);
-+
-+ rwsem_release(&journal->j_trans_commit_map, 1, _THIS_IP_);
-+ /*
-+ * Scope of the GFP_NOFS context is over here and so we can restore the
-+ * original alloc context.
-+ */
-+ memalloc_nofs_restore(handle->saved_alloc_context);
-+}
-
- /**
- * int jbd2_journal_restart() - restart a handle .
-@@ -679,52 +706,34 @@ int jbd2__journal_restart(handle_t *handle, int nblocks, gfp_t gfp_mask)
- transaction_t *transaction = handle->h_transaction;
- journal_t *journal;
- tid_t tid;
-- int need_to_start, ret;
-+ int need_to_start;
-
- /* If we've had an abort of any type, don't even think about
- * actually doing the restart! */
- if (is_handle_aborted(handle))
- return 0;
- journal = transaction->t_journal;
-+ tid = transaction->t_tid;
-
- /*
- * First unlink the handle from its current transaction, and start the
- * commit on that.
- */
-- J_ASSERT(atomic_read(&transaction->t_updates) > 0);
-- J_ASSERT(journal_current_handle() == handle);
--
-- read_lock(&journal->j_state_lock);
-- spin_lock(&transaction->t_handle_lock);
-- atomic_sub(handle->h_buffer_credits,
-- &transaction->t_outstanding_credits);
-- if (handle->h_rsv_handle) {
-- sub_reserved_credits(journal,
-- handle->h_rsv_handle->h_buffer_credits);
-- }
-- if (atomic_dec_and_test(&transaction->t_updates))
-- wake_up(&journal->j_wait_updates);
-- tid = transaction->t_tid;
-- spin_unlock(&transaction->t_handle_lock);
-+ jbd_debug(2, "restarting handle %p\n", handle);
-+ stop_this_handle(handle);
- handle->h_transaction = NULL;
-- current->journal_info = NULL;
-
-- jbd_debug(2, "restarting handle %p\n", handle);
-+ /*
-+ * TODO: If we use READ_ONCE / WRITE_ONCE for j_commit_request we can
-+ * get rid of pointless j_state_lock traffic like this.
-+ */
-+ read_lock(&journal->j_state_lock);
- need_to_start = !tid_geq(journal->j_commit_request, tid);
- read_unlock(&journal->j_state_lock);
- if (need_to_start)
- jbd2_log_start_commit(journal, tid);
--
-- rwsem_release(&journal->j_trans_commit_map, 1, _THIS_IP_);
- handle->h_buffer_credits = nblocks;
-- /*
-- * Restore the original nofs context because the journal restart
-- * is basically the same thing as journal stop and start.
-- * start_this_handle will start a new nofs context.
-- */
-- memalloc_nofs_restore(handle->saved_alloc_context);
-- ret = start_this_handle(journal, handle, gfp_mask);
-- return ret;
-+ return start_this_handle(journal, handle, gfp_mask);
- }
- EXPORT_SYMBOL(jbd2__journal_restart);
-
-@@ -1734,16 +1743,12 @@ int jbd2_journal_stop(handle_t *handle)
- * Handle is already detached from the transaction so there is
- * nothing to do other than free the handle.
- */
-- if (handle->h_rsv_handle)
-- jbd2_free_handle(handle->h_rsv_handle);
-+ memalloc_nofs_restore(handle->saved_alloc_context);
- goto free_and_exit;
- }
- journal = transaction->t_journal;
- tid = transaction->t_tid;
-
-- J_ASSERT(journal_current_handle() == handle);
-- J_ASSERT(atomic_read(&transaction->t_updates) > 0);
--
- if (is_handle_aborted(handle))
- err = -EIO;
-
-@@ -1813,9 +1818,6 @@ int jbd2_journal_stop(handle_t *handle)
-
- if (handle->h_sync)
- transaction->t_synchronous_commit = 1;
-- current->journal_info = NULL;
-- atomic_sub(handle->h_buffer_credits,
-- &transaction->t_outstanding_credits);
-
- /*
- * If the handle is marked SYNC, we need to set another commit
-@@ -1845,27 +1847,19 @@ int jbd2_journal_stop(handle_t *handle)
- }
-
- /*
-- * Once we drop t_updates, if it goes to zero the transaction
-- * could start committing on us and eventually disappear. So
-- * once we do this, we must not dereference transaction
-- * pointer again.
-+ * Once stop_this_handle() drops t_updates, the transaction could start
-+ * committing on us and eventually disappear. So we must not
-+ * dereference transaction pointer again after calling
-+ * stop_this_handle().
- */
-- if (atomic_dec_and_test(&transaction->t_updates))
-- wake_up(&journal->j_wait_updates);
--
-- rwsem_release(&journal->j_trans_commit_map, 1, _THIS_IP_);
-+ stop_this_handle(handle);
-
- if (wait_for_commit)
- err = jbd2_log_wait_commit(journal, tid);
-
-- if (handle->h_rsv_handle)
-- jbd2_journal_free_reserved(handle->h_rsv_handle);
- free_and_exit:
-- /*
-- * Scope of the GFP_NOFS context is over here and so we can restore the
-- * original alloc context.
-- */
-- memalloc_nofs_restore(handle->saved_alloc_context);
-+ if (handle->h_rsv_handle)
-+ jbd2_free_handle(handle->h_rsv_handle);
- jbd2_free_handle(handle);
- return err;
- }
---
-2.35.1
-
+++ /dev/null
-From 6fddfed79a11832d9931d6a0d5aa6b42022a716c Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 5 Nov 2019 17:44:20 +0100
-Subject: jbd2: Reorganize jbd2_journal_stop()
-
-From: Jan Kara <jack@suse.cz>
-
-[ Upstream commit dfaf5ffda227be3e867fee7c0f6a66749392fbd0 ]
-
-Move code in jbd2_journal_stop() around a bit. It removes some
-unnecessary code duplication and will make factoring out parts common
-with jbd2__journal_restart() easier.
-
-Reviewed-by: Theodore Ts'o <tytso@mit.edu>
-Signed-off-by: Jan Kara <jack@suse.cz>
-Link: https://lore.kernel.org/r/20191105164437.32602-14-jack@suse.cz
-Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-Stable-dep-of: d87a7b4c77a9 ("jbd2: use the correct print format")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/jbd2/transaction.c | 40 ++++++++++++++++------------------------
- 1 file changed, 16 insertions(+), 24 deletions(-)
-
-diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
-index 09f4d00fece2..ce66dbbf0f90 100644
---- a/fs/jbd2/transaction.c
-+++ b/fs/jbd2/transaction.c
-@@ -1722,41 +1722,34 @@ int jbd2_journal_stop(handle_t *handle)
- tid_t tid;
- pid_t pid;
-
-+ if (--handle->h_ref > 0) {
-+ jbd_debug(4, "h_ref %d -> %d\n", handle->h_ref + 1,
-+ handle->h_ref);
-+ if (is_handle_aborted(handle))
-+ return -EIO;
-+ return 0;
-+ }
- if (!transaction) {
- /*
-- * Handle is already detached from the transaction so
-- * there is nothing to do other than decrease a refcount,
-- * or free the handle if refcount drops to zero
-+ * Handle is already detached from the transaction so there is
-+ * nothing to do other than free the handle.
- */
-- if (--handle->h_ref > 0) {
-- jbd_debug(4, "h_ref %d -> %d\n", handle->h_ref + 1,
-- handle->h_ref);
-- return err;
-- } else {
-- if (handle->h_rsv_handle)
-- jbd2_free_handle(handle->h_rsv_handle);
-- goto free_and_exit;
-- }
-+ if (handle->h_rsv_handle)
-+ jbd2_free_handle(handle->h_rsv_handle);
-+ goto free_and_exit;
- }
- journal = transaction->t_journal;
-+ tid = transaction->t_tid;
-
- J_ASSERT(journal_current_handle() == handle);
-+ J_ASSERT(atomic_read(&transaction->t_updates) > 0);
-
- if (is_handle_aborted(handle))
- err = -EIO;
-- else
-- J_ASSERT(atomic_read(&transaction->t_updates) > 0);
--
-- if (--handle->h_ref > 0) {
-- jbd_debug(4, "h_ref %d -> %d\n", handle->h_ref + 1,
-- handle->h_ref);
-- return err;
-- }
-
- jbd_debug(4, "Handle %p going down\n", handle);
- trace_jbd2_handle_stats(journal->j_fs_dev->bd_dev,
-- transaction->t_tid,
-- handle->h_type, handle->h_line_no,
-+ tid, handle->h_type, handle->h_line_no,
- jiffies - handle->h_start_jiffies,
- handle->h_sync, handle->h_requested_credits,
- (handle->h_requested_credits -
-@@ -1841,7 +1834,7 @@ int jbd2_journal_stop(handle_t *handle)
- jbd_debug(2, "transaction too old, requesting commit for "
- "handle %p\n", handle);
- /* This is non-blocking */
-- jbd2_log_start_commit(journal, transaction->t_tid);
-+ jbd2_log_start_commit(journal, tid);
-
- /*
- * Special case: JBD2_SYNC synchronous updates require us
-@@ -1857,7 +1850,6 @@ int jbd2_journal_stop(handle_t *handle)
- * once we do this, we must not dereference transaction
- * pointer again.
- */
-- tid = transaction->t_tid;
- if (atomic_dec_and_test(&transaction->t_updates)) {
- wake_up(&journal->j_wait_updates);
- if (journal->j_barrier_count)
---
-2.35.1
-
+++ /dev/null
-From 55669547a3e0e8afd16ee7caf0fece14eae96399 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 11 Jun 2022 21:06:34 +0800
-Subject: lib/debugobjects: fix stat count and optimize debug_objects_mem_init
-
-From: wuchi <wuchi.zero@gmail.com>
-
-[ Upstream commit eabb7f1ace53e127309407b2b5e74e8199e85270 ]
-
-1. Var debug_objects_allocated tracks valid kmem_cache_alloc calls, so
- track it in debug_objects_replace_static_objects. Do similar things in
- object_cpu_offline.
-
-2. In debug_objects_mem_init, there is no need to call function
- cpuhp_setup_state_nocalls when debug_objects_enabled = 0 (out of
- memory).
-
-Link: https://lkml.kernel.org/r/20220611130634.99741-1-wuchi.zero@gmail.com
-Fixes: 634d61f45d6f ("debugobjects: Percpu pool lookahead freeing/allocation")
-Fixes: c4b73aabd098 ("debugobjects: Track number of kmem_cache_alloc/kmem_cache_free done")
-Signed-off-by: wuchi <wuchi.zero@gmail.com>
-Reviewed-by: Waiman Long <longman@redhat.com>
-Cc: Thomas Gleixner <tglx@linutronix.de>
-Cc: Christoph Hellwig <hch@lst.de>
-Cc: Kees Cook <keescook@chromium.org>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- lib/debugobjects.c | 10 ++++++++++
- 1 file changed, 10 insertions(+)
-
-diff --git a/lib/debugobjects.c b/lib/debugobjects.c
-index 746b632792b5..7ca6459259fa 100644
---- a/lib/debugobjects.c
-+++ b/lib/debugobjects.c
-@@ -440,6 +440,7 @@ static int object_cpu_offline(unsigned int cpu)
- struct debug_percpu_free *percpu_pool;
- struct hlist_node *tmp;
- struct debug_obj *obj;
-+ unsigned long flags;
-
- /* Remote access is safe as the CPU is dead already */
- percpu_pool = per_cpu_ptr(&percpu_obj_pool, cpu);
-@@ -447,6 +448,12 @@ static int object_cpu_offline(unsigned int cpu)
- hlist_del(&obj->node);
- kmem_cache_free(obj_cache, obj);
- }
-+
-+ raw_spin_lock_irqsave(&pool_lock, flags);
-+ obj_pool_used -= percpu_pool->obj_free;
-+ debug_objects_freed += percpu_pool->obj_free;
-+ raw_spin_unlock_irqrestore(&pool_lock, flags);
-+
- percpu_pool->obj_free = 0;
-
- return 0;
-@@ -1327,6 +1334,8 @@ static int __init debug_objects_replace_static_objects(void)
- hlist_add_head(&obj->node, &objects);
- }
-
-+ debug_objects_allocated += i;
-+
- /*
- * debug_objects_mem_init() is now called early that only one CPU is up
- * and interrupts have been disabled, so it is safe to replace the
-@@ -1395,6 +1404,7 @@ void __init debug_objects_mem_init(void)
- debug_objects_enabled = 0;
- kmem_cache_destroy(obj_cache);
- pr_warn("out of memory.\n");
-+ return;
- } else
- debug_objects_selftest();
-
---
-2.35.1
-
+++ /dev/null
-From d748ca1246af36e2ff1c7c8d52665324c5fff82e Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 3 Jul 2020 10:49:21 +0800
-Subject: nvme-pci: add a blank line after declarations
-
-From: Baolin Wang <baolin.wang@linux.alibaba.com>
-
-[ Upstream commit 4e523547e2bf755d40cb10e85795c2f9620ff3fb ]
-
-Add a blank line after declarations to make code more readable.
-
-Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
-Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
-Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
-Signed-off-by: Christoph Hellwig <hch@lst.de>
-Stable-dep-of: c89a529e823d ("nvme-pci: fix mempool alloc size")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/nvme/host/pci.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
-index 5d62d1042c0e..c31fb6902c71 100644
---- a/drivers/nvme/host/pci.c
-+++ b/drivers/nvme/host/pci.c
-@@ -1076,6 +1076,7 @@ static irqreturn_t nvme_irq(int irq, void *data)
- static irqreturn_t nvme_irq_check(int irq, void *data)
- {
- struct nvme_queue *nvmeq = data;
-+
- if (nvme_cqe_pending(nvmeq))
- return IRQ_WAKE_THREAD;
- return IRQ_NONE;
-@@ -1470,6 +1471,7 @@ static int nvme_cmb_qdepth(struct nvme_dev *dev, int nr_io_queues,
-
- if (q_size_aligned * nr_io_queues > dev->cmb_size) {
- u64 mem_per_q = div_u64(dev->cmb_size, nr_io_queues);
-+
- mem_per_q = round_down(mem_per_q, dev->ctrl.page_size);
- q_depth = div_u64(mem_per_q, entry_size);
-
-@@ -2940,6 +2942,7 @@ static void nvme_reset_done(struct pci_dev *pdev)
- static void nvme_shutdown(struct pci_dev *pdev)
- {
- struct nvme_dev *dev = pci_get_drvdata(pdev);
-+
- nvme_disable_prepare_reset(dev, true);
- }
-
-@@ -3070,6 +3073,7 @@ static int nvme_suspend(struct device *dev)
- static int nvme_simple_suspend(struct device *dev)
- {
- struct nvme_dev *ndev = pci_get_drvdata(to_pci_dev(dev));
-+
- return nvme_disable_prepare_reset(ndev, true);
- }
-
---
-2.35.1
-
+++ /dev/null
-From 1334339945a0beed85953a5585970e0c6d4c5b3c Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 3 Jul 2020 10:49:23 +0800
-Subject: nvme-pci: use the consistent return type of nvme_pci_iod_alloc_size()
-
-From: Baolin Wang <baolin.wang@linux.alibaba.com>
-
-[ Upstream commit 9056fc9fc514ecd2457a59c575863ecb07c4fa5e ]
-
-The nvme_pci_iod_alloc_size() should return 'size_t' type to be
-consistent with the sizeof return value.
-
-Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
-Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
-Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
-Signed-off-by: Christoph Hellwig <hch@lst.de>
-Stable-dep-of: c89a529e823d ("nvme-pci: fix mempool alloc size")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/nvme/host/pci.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
-index c31fb6902c71..2b723d113bb3 100644
---- a/drivers/nvme/host/pci.c
-+++ b/drivers/nvme/host/pci.c
-@@ -363,7 +363,7 @@ static int nvme_pci_npages_sgl(unsigned int num_seg)
- return DIV_ROUND_UP(num_seg * sizeof(struct nvme_sgl_desc), PAGE_SIZE);
- }
-
--static unsigned int nvme_pci_iod_alloc_size(struct nvme_dev *dev,
-+static size_t nvme_pci_iod_alloc_size(struct nvme_dev *dev,
- unsigned int size, unsigned int nseg, bool use_sgl)
- {
- size_t alloc_size;
---
-2.35.1
-
+++ /dev/null
-From 332d74ed7afca6f1f88a6eff40c61ee73e68b513 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 5 Nov 2019 17:44:18 +0100
-Subject: ocfs2: Use accessor function for h_buffer_credits
-
-From: Jan Kara <jack@suse.cz>
-
-[ Upstream commit 9797a902480521dc8e7a478e38f0c896ffff8784 ]
-
-Use the jbd2 accessor function for h_buffer_credits.
-
-Reviewed-by: Theodore Ts'o <tytso@mit.edu>
-Signed-off-by: Jan Kara <jack@suse.cz>
-Link: https://lore.kernel.org/r/20191105164437.32602-12-jack@suse.cz
-Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-Stable-dep-of: d87a7b4c77a9 ("jbd2: use the correct print format")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/ocfs2/alloc.c | 32 ++++++++++++++++----------------
- fs/ocfs2/journal.c | 4 ++--
- 2 files changed, 18 insertions(+), 18 deletions(-)
-
-diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
-index 4db87b26cf7b..9bc3e926b717 100644
---- a/fs/ocfs2/alloc.c
-+++ b/fs/ocfs2/alloc.c
-@@ -2288,9 +2288,9 @@ static int ocfs2_extend_rotate_transaction(handle_t *handle, int subtree_depth,
- int ret = 0;
- int credits = (path->p_tree_depth - subtree_depth) * 2 + 1 + op_credits;
-
-- if (handle->h_buffer_credits < credits)
-+ if (jbd2_handle_buffer_credits(handle) < credits)
- ret = ocfs2_extend_trans(handle,
-- credits - handle->h_buffer_credits);
-+ credits - jbd2_handle_buffer_credits(handle));
-
- return ret;
- }
-@@ -2367,7 +2367,7 @@ static int ocfs2_rotate_tree_right(handle_t *handle,
- struct ocfs2_path *right_path,
- struct ocfs2_path **ret_left_path)
- {
-- int ret, start, orig_credits = handle->h_buffer_credits;
-+ int ret, start, orig_credits = jbd2_handle_buffer_credits(handle);
- u32 cpos;
- struct ocfs2_path *left_path = NULL;
- struct super_block *sb = ocfs2_metadata_cache_get_super(et->et_ci);
-@@ -3148,7 +3148,7 @@ static int ocfs2_rotate_tree_left(handle_t *handle,
- struct ocfs2_path *path,
- struct ocfs2_cached_dealloc_ctxt *dealloc)
- {
-- int ret, orig_credits = handle->h_buffer_credits;
-+ int ret, orig_credits = jbd2_handle_buffer_credits(handle);
- struct ocfs2_path *tmp_path = NULL, *restart_path = NULL;
- struct ocfs2_extent_block *eb;
- struct ocfs2_extent_list *el;
-@@ -3386,8 +3386,8 @@ static int ocfs2_merge_rec_right(struct ocfs2_path *left_path,
- right_path);
-
- ret = ocfs2_extend_rotate_transaction(handle, subtree_index,
-- handle->h_buffer_credits,
-- right_path);
-+ jbd2_handle_buffer_credits(handle),
-+ right_path);
- if (ret) {
- mlog_errno(ret);
- goto out;
-@@ -3548,8 +3548,8 @@ static int ocfs2_merge_rec_left(struct ocfs2_path *right_path,
- right_path);
-
- ret = ocfs2_extend_rotate_transaction(handle, subtree_index,
-- handle->h_buffer_credits,
-- left_path);
-+ jbd2_handle_buffer_credits(handle),
-+ left_path);
- if (ret) {
- mlog_errno(ret);
- goto out;
-@@ -3623,7 +3623,7 @@ static int ocfs2_merge_rec_left(struct ocfs2_path *right_path,
- le16_to_cpu(el->l_next_free_rec) == 1) {
- /* extend credit for ocfs2_remove_rightmost_path */
- ret = ocfs2_extend_rotate_transaction(handle, 0,
-- handle->h_buffer_credits,
-+ jbd2_handle_buffer_credits(handle),
- right_path);
- if (ret) {
- mlog_errno(ret);
-@@ -3669,7 +3669,7 @@ static int ocfs2_try_to_merge_extent(handle_t *handle,
- if (ctxt->c_split_covers_rec && ctxt->c_has_empty_extent) {
- /* extend credit for ocfs2_remove_rightmost_path */
- ret = ocfs2_extend_rotate_transaction(handle, 0,
-- handle->h_buffer_credits,
-+ jbd2_handle_buffer_credits(handle),
- path);
- if (ret) {
- mlog_errno(ret);
-@@ -3725,7 +3725,7 @@ static int ocfs2_try_to_merge_extent(handle_t *handle,
-
- /* extend credit for ocfs2_remove_rightmost_path */
- ret = ocfs2_extend_rotate_transaction(handle, 0,
-- handle->h_buffer_credits,
-+ jbd2_handle_buffer_credits(handle),
- path);
- if (ret) {
- mlog_errno(ret);
-@@ -3755,7 +3755,7 @@ static int ocfs2_try_to_merge_extent(handle_t *handle,
-
- /* extend credit for ocfs2_remove_rightmost_path */
- ret = ocfs2_extend_rotate_transaction(handle, 0,
-- handle->h_buffer_credits,
-+ jbd2_handle_buffer_credits(handle),
- path);
- if (ret) {
- mlog_errno(ret);
-@@ -3799,7 +3799,7 @@ static int ocfs2_try_to_merge_extent(handle_t *handle,
- if (ctxt->c_split_covers_rec) {
- /* extend credit for ocfs2_remove_rightmost_path */
- ret = ocfs2_extend_rotate_transaction(handle, 0,
-- handle->h_buffer_credits,
-+ jbd2_handle_buffer_credits(handle),
- path);
- if (ret) {
- mlog_errno(ret);
-@@ -5358,7 +5358,7 @@ static int ocfs2_truncate_rec(handle_t *handle,
- if (ocfs2_is_empty_extent(&el->l_recs[0]) && index > 0) {
- /* extend credit for ocfs2_remove_rightmost_path */
- ret = ocfs2_extend_rotate_transaction(handle, 0,
-- handle->h_buffer_credits,
-+ jbd2_handle_buffer_credits(handle),
- path);
- if (ret) {
- mlog_errno(ret);
-@@ -5427,8 +5427,8 @@ static int ocfs2_truncate_rec(handle_t *handle,
- }
-
- ret = ocfs2_extend_rotate_transaction(handle, 0,
-- handle->h_buffer_credits,
-- path);
-+ jbd2_handle_buffer_credits(handle),
-+ path);
- if (ret) {
- mlog_errno(ret);
- goto out;
-diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
-index da95ed79c12e..595745602f1e 100644
---- a/fs/ocfs2/journal.c
-+++ b/fs/ocfs2/journal.c
-@@ -420,7 +420,7 @@ int ocfs2_extend_trans(handle_t *handle, int nblocks)
- if (!nblocks)
- return 0;
-
-- old_nblocks = handle->h_buffer_credits;
-+ old_nblocks = jbd2_handle_buffer_credits(handle);
-
- trace_ocfs2_extend_trans(old_nblocks, nblocks);
-
-@@ -461,7 +461,7 @@ int ocfs2_allocate_extend_trans(handle_t *handle, int thresh)
-
- BUG_ON(!handle);
-
-- old_nblks = handle->h_buffer_credits;
-+ old_nblks = jbd2_handle_buffer_credits(handle);
- trace_ocfs2_allocate_extend_trans(old_nblks, thresh);
-
- if (old_nblks < thresh)
---
-2.35.1
-
arm-dts-qcom-apq8064-fix-coresight-compatible.patch
arm64-dts-qcom-sdm845-cheza-fix-ap-suspend-pin-bias.patch
drivers-soc-ti-knav_qmss_queue-mark-knav_acc_firmwar.patch
-soc-qcom-llcc-cleanup-to-get-rid-of-sdm845-specific-.patch
-soc-qcom-rename-llcc-slice-to-llcc-qcom.patch
-soc-qcom-llcc-make-irq-truly-optional.patch
arm-dts-spear600-fix-clcd-interrupt.patch
soc-ti-knav_qmss_queue-use-pm_runtime_resume_and_get.patch
soc-ti-knav_qmss_queue-fix-pm-disable-depth-imbalanc.patch
fs-don-t-audit-the-capability-check-in-simple_xattr_.patch
selftests-ftrace-event_triggers-wait-longer-for-test.patch
perf-fix-possible-memleak-in-pmu_dev_alloc.patch
-debugobjects-free-per-cpu-pool-after-cpu-unplug.patch
-lib-debugobjects-fix-stat-count-and-optimize-debug_o.patch
timerqueue-use-rb_entry_safe-in-timerqueue_getnext.patch
proc-fixup-uptime-selftest.patch
lib-fonts-fix-undefined-behavior-in-bit-shift-for-ge.patch
media-dvbdev-fix-refcnt-bug.patch
cifs-fix-oops-during-encryption.patch
nvme-pci-fix-doorbell-buffer-value-endianness.patch
-nvme-pci-add-a-blank-line-after-declarations.patch
-nvme-pci-use-the-consistent-return-type-of-nvme_pci_.patch
ata-ahci-fix-pcs-quirk-application-for-suspend.patch
nvme-resync-include-linux-nvme.h-with-nvmecli.patch
nvme-fix-the-nvme_cmd_effects_cse_mask-definition.patch
ipv6-raw-deduct-extension-header-length-in-rawv6_push_pending_frames.patch
wifi-wilc1000-sdio-fix-module-autoloading.patch
usb-ulpi-defer-ulpi_register-on-ulpi_read_id-timeout.patch
-ext4-provide-function-to-handle-transaction-restarts.patch
-ext4-jbd2-provide-accessor-function-for-handle-credi.patch
-ocfs2-use-accessor-function-for-h_buffer_credits.patch
-jbd2-reorganize-jbd2_journal_stop.patch
-jbd2-drop-pointless-wakeup-from-jbd2_journal_stop.patch
-jbd2-factor-out-common-parts-of-stopping-and-restart.patch
jbd2-use-the-correct-print-format.patch
quota-factor-out-setup-of-quota-inode.patch
ext4-fix-bug_on-in-__es_tree_search-caused-by-bad-qu.patch
+++ /dev/null
-From d32095a22ff3e4994e74422f3a96a5b5be74a12f Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 18 Jul 2019 18:32:36 +0530
-Subject: soc: qcom: llcc cleanup to get rid of sdm845 specific driver file
-
-From: Vivek Gautam <vivek.gautam@codeaurora.org>
-
-[ Upstream commit a14b820316e84310b1bad3701a8d4c9159377633 ]
-
-A single file should suffice the need to program the llcc for
-various platforms. Get rid of sdm845 specific driver file to
-make way for a more generic driver.
-
-Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
-Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
-Stable-dep-of: c882c899ead3 ("soc: qcom: llcc: make irq truly optional")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/soc/qcom/Kconfig | 14 +---
- drivers/soc/qcom/Makefile | 1 -
- drivers/soc/qcom/llcc-sdm845.c | 100 -----------------------------
- drivers/soc/qcom/llcc-slice.c | 60 +++++++++++++++--
- include/linux/soc/qcom/llcc-qcom.h | 57 ++++++----------
- 5 files changed, 77 insertions(+), 155 deletions(-)
- delete mode 100644 drivers/soc/qcom/llcc-sdm845.c
-
-diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
-index 661e47acc354..c6df8b43fa6d 100644
---- a/drivers/soc/qcom/Kconfig
-+++ b/drivers/soc/qcom/Kconfig
-@@ -58,17 +58,9 @@ config QCOM_LLCC
- depends on ARCH_QCOM || COMPILE_TEST
- help
- Qualcomm Technologies, Inc. platform specific
-- Last Level Cache Controller(LLCC) driver. This provides interfaces
-- to clients that use the LLCC. Say yes here to enable LLCC slice
-- driver.
--
--config QCOM_SDM845_LLCC
-- tristate "Qualcomm Technologies, Inc. SDM845 LLCC driver"
-- depends on QCOM_LLCC
-- help
-- Say yes here to enable the LLCC driver for SDM845. This provides
-- data required to configure LLCC so that clients can start using the
-- LLCC slices.
-+ Last Level Cache Controller(LLCC) driver for platforms such as,
-+ SDM845. This provides interfaces to clients that use the LLCC.
-+ Say yes here to enable LLCC slice driver.
-
- config QCOM_MDT_LOADER
- tristate
-diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile
-index 162788701a77..28d45b2e87e8 100644
---- a/drivers/soc/qcom/Makefile
-+++ b/drivers/soc/qcom/Makefile
-@@ -22,6 +22,5 @@ obj-$(CONFIG_QCOM_SOCINFO) += socinfo.o
- obj-$(CONFIG_QCOM_WCNSS_CTRL) += wcnss_ctrl.o
- obj-$(CONFIG_QCOM_APR) += apr.o
- obj-$(CONFIG_QCOM_LLCC) += llcc-slice.o
--obj-$(CONFIG_QCOM_SDM845_LLCC) += llcc-sdm845.o
- obj-$(CONFIG_QCOM_RPMHPD) += rpmhpd.o
- obj-$(CONFIG_QCOM_RPMPD) += rpmpd.o
-diff --git a/drivers/soc/qcom/llcc-sdm845.c b/drivers/soc/qcom/llcc-sdm845.c
-deleted file mode 100644
-index 86600d97c36d..000000000000
---- a/drivers/soc/qcom/llcc-sdm845.c
-+++ /dev/null
-@@ -1,100 +0,0 @@
--// SPDX-License-Identifier: GPL-2.0
--/*
-- * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
-- *
-- */
--
--#include <linux/kernel.h>
--#include <linux/module.h>
--#include <linux/of.h>
--#include <linux/of_device.h>
--#include <linux/soc/qcom/llcc-qcom.h>
--
--/*
-- * SCT(System Cache Table) entry contains of the following members:
-- * usecase_id: Unique id for the client's use case
-- * slice_id: llcc slice id for each client
-- * max_cap: The maximum capacity of the cache slice provided in KB
-- * priority: Priority of the client used to select victim line for replacement
-- * fixed_size: Boolean indicating if the slice has a fixed capacity
-- * bonus_ways: Bonus ways are additional ways to be used for any slice,
-- * if client ends up using more than reserved cache ways. Bonus
-- * ways are allocated only if they are not reserved for some
-- * other client.
-- * res_ways: Reserved ways for the cache slice, the reserved ways cannot
-- * be used by any other client than the one its assigned to.
-- * cache_mode: Each slice operates as a cache, this controls the mode of the
-- * slice: normal or TCM(Tightly Coupled Memory)
-- * probe_target_ways: Determines what ways to probe for access hit. When
-- * configured to 1 only bonus and reserved ways are probed.
-- * When configured to 0 all ways in llcc are probed.
-- * dis_cap_alloc: Disable capacity based allocation for a client
-- * retain_on_pc: If this bit is set and client has maintained active vote
-- * then the ways assigned to this client are not flushed on power
-- * collapse.
-- * activate_on_init: Activate the slice immediately after the SCT is programmed
-- */
--#define SCT_ENTRY(uid, sid, mc, p, fs, bway, rway, cmod, ptw, dca, rp, a) \
-- { \
-- .usecase_id = uid, \
-- .slice_id = sid, \
-- .max_cap = mc, \
-- .priority = p, \
-- .fixed_size = fs, \
-- .bonus_ways = bway, \
-- .res_ways = rway, \
-- .cache_mode = cmod, \
-- .probe_target_ways = ptw, \
-- .dis_cap_alloc = dca, \
-- .retain_on_pc = rp, \
-- .activate_on_init = a, \
-- }
--
--static struct llcc_slice_config sdm845_data[] = {
-- SCT_ENTRY(LLCC_CPUSS, 1, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 1),
-- SCT_ENTRY(LLCC_VIDSC0, 2, 512, 2, 1, 0x0, 0x0f0, 0, 0, 1, 1, 0),
-- SCT_ENTRY(LLCC_VIDSC1, 3, 512, 2, 1, 0x0, 0x0f0, 0, 0, 1, 1, 0),
-- SCT_ENTRY(LLCC_ROTATOR, 4, 563, 2, 1, 0x0, 0x00e, 2, 0, 1, 1, 0),
-- SCT_ENTRY(LLCC_VOICE, 5, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0),
-- SCT_ENTRY(LLCC_AUDIO, 6, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0),
-- SCT_ENTRY(LLCC_MDMHPGRW, 7, 1024, 2, 0, 0xfc, 0xf00, 0, 0, 1, 1, 0),
-- SCT_ENTRY(LLCC_MDM, 8, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0),
-- SCT_ENTRY(LLCC_CMPT, 10, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0),
-- SCT_ENTRY(LLCC_GPUHTW, 11, 512, 1, 1, 0xc, 0x0, 0, 0, 1, 1, 0),
-- SCT_ENTRY(LLCC_GPU, 12, 2304, 1, 0, 0xff0, 0x2, 0, 0, 1, 1, 0),
-- SCT_ENTRY(LLCC_MMUHWT, 13, 256, 2, 0, 0x0, 0x1, 0, 0, 1, 0, 1),
-- SCT_ENTRY(LLCC_CMPTDMA, 15, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0),
-- SCT_ENTRY(LLCC_DISP, 16, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0),
-- SCT_ENTRY(LLCC_VIDFW, 17, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0),
-- SCT_ENTRY(LLCC_MDMHPFX, 20, 1024, 2, 1, 0x0, 0xf00, 0, 0, 1, 1, 0),
-- SCT_ENTRY(LLCC_MDMPNG, 21, 1024, 0, 1, 0x1e, 0x0, 0, 0, 1, 1, 0),
-- SCT_ENTRY(LLCC_AUDHW, 22, 1024, 1, 1, 0xffc, 0x2, 0, 0, 1, 1, 0),
--};
--
--static int sdm845_qcom_llcc_remove(struct platform_device *pdev)
--{
-- return qcom_llcc_remove(pdev);
--}
--
--static int sdm845_qcom_llcc_probe(struct platform_device *pdev)
--{
-- return qcom_llcc_probe(pdev, sdm845_data, ARRAY_SIZE(sdm845_data));
--}
--
--static const struct of_device_id sdm845_qcom_llcc_of_match[] = {
-- { .compatible = "qcom,sdm845-llcc", },
-- { }
--};
--
--static struct platform_driver sdm845_qcom_llcc_driver = {
-- .driver = {
-- .name = "sdm845-llcc",
-- .of_match_table = sdm845_qcom_llcc_of_match,
-- },
-- .probe = sdm845_qcom_llcc_probe,
-- .remove = sdm845_qcom_llcc_remove,
--};
--module_platform_driver(sdm845_qcom_llcc_driver);
--
--MODULE_DESCRIPTION("QCOM sdm845 LLCC driver");
--MODULE_LICENSE("GPL v2");
-diff --git a/drivers/soc/qcom/llcc-slice.c b/drivers/soc/qcom/llcc-slice.c
-index 4a6111635f82..19039f19af97 100644
---- a/drivers/soc/qcom/llcc-slice.c
-+++ b/drivers/soc/qcom/llcc-slice.c
-@@ -1,6 +1,6 @@
- // SPDX-License-Identifier: GPL-2.0
- /*
-- * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
-+ * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
- *
- */
-
-@@ -11,6 +11,7 @@
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/mutex.h>
-+#include <linux/of.h>
- #include <linux/of_device.h>
- #include <linux/regmap.h>
- #include <linux/sizes.h>
-@@ -46,6 +47,27 @@
-
- #define BANK_OFFSET_STRIDE 0x80000
-
-+static struct llcc_slice_config sdm845_data[] = {
-+ { LLCC_CPUSS, 1, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 1 },
-+ { LLCC_VIDSC0, 2, 512, 2, 1, 0x0, 0x0f0, 0, 0, 1, 1, 0 },
-+ { LLCC_VIDSC1, 3, 512, 2, 1, 0x0, 0x0f0, 0, 0, 1, 1, 0 },
-+ { LLCC_ROTATOR, 4, 563, 2, 1, 0x0, 0x00e, 2, 0, 1, 1, 0 },
-+ { LLCC_VOICE, 5, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0 },
-+ { LLCC_AUDIO, 6, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0 },
-+ { LLCC_MDMHPGRW, 7, 1024, 2, 0, 0xfc, 0xf00, 0, 0, 1, 1, 0 },
-+ { LLCC_MDM, 8, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0 },
-+ { LLCC_CMPT, 10, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0 },
-+ { LLCC_GPUHTW, 11, 512, 1, 1, 0xc, 0x0, 0, 0, 1, 1, 0 },
-+ { LLCC_GPU, 12, 2304, 1, 0, 0xff0, 0x2, 0, 0, 1, 1, 0 },
-+ { LLCC_MMUHWT, 13, 256, 2, 0, 0x0, 0x1, 0, 0, 1, 0, 1 },
-+ { LLCC_CMPTDMA, 15, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0 },
-+ { LLCC_DISP, 16, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0 },
-+ { LLCC_VIDFW, 17, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0 },
-+ { LLCC_MDMHPFX, 20, 1024, 2, 1, 0x0, 0xf00, 0, 0, 1, 1, 0 },
-+ { LLCC_MDMPNG, 21, 1024, 0, 1, 0x1e, 0x0, 0, 0, 1, 1, 0 },
-+ { LLCC_AUDHW, 22, 1024, 1, 1, 0xffc, 0x2, 0, 0, 1, 1, 0 },
-+};
-+
- static struct llcc_drv_data *drv_data = (void *) -EPROBE_DEFER;
-
- static struct regmap_config llcc_regmap_config = {
-@@ -301,13 +323,12 @@ static int qcom_llcc_cfg_program(struct platform_device *pdev)
- return ret;
- }
-
--int qcom_llcc_remove(struct platform_device *pdev)
-+static int qcom_llcc_remove(struct platform_device *pdev)
- {
- /* Set the global pointer to a error code to avoid referencing it */
- drv_data = ERR_PTR(-ENODEV);
- return 0;
- }
--EXPORT_SYMBOL_GPL(qcom_llcc_remove);
-
- static struct regmap *qcom_llcc_init_mmio(struct platform_device *pdev,
- const char *name)
-@@ -327,8 +348,8 @@ static struct regmap *qcom_llcc_init_mmio(struct platform_device *pdev,
- return devm_regmap_init_mmio(&pdev->dev, base, &llcc_regmap_config);
- }
-
--int qcom_llcc_probe(struct platform_device *pdev,
-- const struct llcc_slice_config *llcc_cfg, u32 sz)
-+static int qcom_llcc_probe(struct platform_device *pdev,
-+ const struct llcc_slice_config *llcc_cfg, u32 sz)
- {
- u32 num_banks;
- struct device *dev = &pdev->dev;
-@@ -408,6 +429,31 @@ int qcom_llcc_probe(struct platform_device *pdev,
- drv_data = ERR_PTR(-ENODEV);
- return ret;
- }
--EXPORT_SYMBOL_GPL(qcom_llcc_probe);
-+
-+static int sdm845_qcom_llcc_remove(struct platform_device *pdev)
-+{
-+ return qcom_llcc_remove(pdev);
-+}
-+
-+static int sdm845_qcom_llcc_probe(struct platform_device *pdev)
-+{
-+ return qcom_llcc_probe(pdev, sdm845_data, ARRAY_SIZE(sdm845_data));
-+}
-+
-+static const struct of_device_id sdm845_qcom_llcc_of_match[] = {
-+ { .compatible = "qcom,sdm845-llcc", },
-+ { }
-+};
-+
-+static struct platform_driver sdm845_qcom_llcc_driver = {
-+ .driver = {
-+ .name = "sdm845-llcc",
-+ .of_match_table = sdm845_qcom_llcc_of_match,
-+ },
-+ .probe = sdm845_qcom_llcc_probe,
-+ .remove = sdm845_qcom_llcc_remove,
-+};
-+module_platform_driver(sdm845_qcom_llcc_driver);
-+
-+MODULE_DESCRIPTION("QCOM sdm845 LLCC driver");
- MODULE_LICENSE("GPL v2");
--MODULE_DESCRIPTION("Qualcomm Last Level Cache Controller");
-diff --git a/include/linux/soc/qcom/llcc-qcom.h b/include/linux/soc/qcom/llcc-qcom.h
-index eb71a50b8afc..d5cad6f7953c 100644
---- a/include/linux/soc/qcom/llcc-qcom.h
-+++ b/include/linux/soc/qcom/llcc-qcom.h
-@@ -39,18 +39,27 @@ struct llcc_slice_desc {
-
- /**
- * llcc_slice_config - Data associated with the llcc slice
-- * @usecase_id: usecase id for which the llcc slice is used
-- * @slice_id: llcc slice id assigned to each slice
-- * @max_cap: maximum capacity of the llcc slice
-- * @priority: priority of the llcc slice
-- * @fixed_size: whether the llcc slice can grow beyond its size
-- * @bonus_ways: bonus ways associated with llcc slice
-- * @res_ways: reserved ways associated with llcc slice
-- * @cache_mode: mode of the llcc slice
-- * @probe_target_ways: Probe only reserved and bonus ways on a cache miss
-- * @dis_cap_alloc: Disable capacity based allocation
-- * @retain_on_pc: Retain through power collapse
-- * @activate_on_init: activate the slice on init
-+ * @usecase_id: Unique id for the client's use case
-+ * @slice_id: llcc slice id for each client
-+ * @max_cap: The maximum capacity of the cache slice provided in KB
-+ * @priority: Priority of the client used to select victim line for replacement
-+ * @fixed_size: Boolean indicating if the slice has a fixed capacity
-+ * @bonus_ways: Bonus ways are additional ways to be used for any slice,
-+ * if client ends up using more than reserved cache ways. Bonus
-+ * ways are allocated only if they are not reserved for some
-+ * other client.
-+ * @res_ways: Reserved ways for the cache slice, the reserved ways cannot
-+ * be used by any other client than the one its assigned to.
-+ * @cache_mode: Each slice operates as a cache, this controls the mode of the
-+ * slice: normal or TCM(Tightly Coupled Memory)
-+ * @probe_target_ways: Determines what ways to probe for access hit. When
-+ * configured to 1 only bonus and reserved ways are probed.
-+ * When configured to 0 all ways in llcc are probed.
-+ * @dis_cap_alloc: Disable capacity based allocation for a client
-+ * @retain_on_pc: If this bit is set and client has maintained active vote
-+ * then the ways assigned to this client are not flushed on power
-+ * collapse.
-+ * @activate_on_init: Activate the slice immediately after it is programmed
- */
- struct llcc_slice_config {
- u32 usecase_id;
-@@ -154,20 +163,6 @@ int llcc_slice_activate(struct llcc_slice_desc *desc);
- */
- int llcc_slice_deactivate(struct llcc_slice_desc *desc);
-
--/**
-- * qcom_llcc_probe - program the sct table
-- * @pdev: platform device pointer
-- * @table: soc sct table
-- * @sz: Size of the config table
-- */
--int qcom_llcc_probe(struct platform_device *pdev,
-- const struct llcc_slice_config *table, u32 sz);
--
--/**
-- * qcom_llcc_remove - remove the sct table
-- * @pdev: Platform device pointer
-- */
--int qcom_llcc_remove(struct platform_device *pdev);
- #else
- static inline struct llcc_slice_desc *llcc_slice_getd(u32 uid)
- {
-@@ -197,16 +192,6 @@ static inline int llcc_slice_deactivate(struct llcc_slice_desc *desc)
- {
- return -EINVAL;
- }
--static inline int qcom_llcc_probe(struct platform_device *pdev,
-- const struct llcc_slice_config *table, u32 sz)
--{
-- return -ENODEV;
--}
--
--static inline int qcom_llcc_remove(struct platform_device *pdev)
--{
-- return -ENODEV;
--}
- #endif
-
- #endif
---
-2.35.1
-
+++ /dev/null
-From 90b2ebda483b7719456e32b44f2353dd467e50e7 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 4 Nov 2022 16:30:41 +0100
-Subject: soc: qcom: llcc: make irq truly optional
-
-From: Luca Weiss <luca.weiss@fairphone.com>
-
-[ Upstream commit c882c899ead3545102a4d71b5fbe73b9e4bc2657 ]
-
-The function platform_get_irq prints an error message into the kernel
-log when the irq isn't found.
-
-Since the interrupt is actually optional and not provided by some SoCs,
-use platform_get_irq_optional which does not print an error message.
-
-Fixes: c081f3060fab ("soc: qcom: Add support to register LLCC EDAC driver")
-Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
-Signed-off-by: Bjorn Andersson <andersson@kernel.org>
-Link: https://lore.kernel.org/r/20221104153041.412020-1-luca.weiss@fairphone.com
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/soc/qcom/llcc-qcom.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/soc/qcom/llcc-qcom.c b/drivers/soc/qcom/llcc-qcom.c
-index 19039f19af97..69abc99b812d 100644
---- a/drivers/soc/qcom/llcc-qcom.c
-+++ b/drivers/soc/qcom/llcc-qcom.c
-@@ -415,7 +415,7 @@ static int qcom_llcc_probe(struct platform_device *pdev,
- if (ret)
- goto err;
-
-- drv_data->ecc_irq = platform_get_irq(pdev, 0);
-+ drv_data->ecc_irq = platform_get_irq_optional(pdev, 0);
- if (drv_data->ecc_irq >= 0) {
- llcc_edac = platform_device_register_data(&pdev->dev,
- "qcom_llcc_edac", -1, drv_data,
---
-2.35.1
-
+++ /dev/null
-From 135b3b022829c5a0fc6695beced956d316477c04 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 18 Jul 2019 18:32:37 +0530
-Subject: soc: qcom: Rename llcc-slice to llcc-qcom
-
-From: Vivek Gautam <vivek.gautam@codeaurora.org>
-
-[ Upstream commit a0e72a5ba48ae9c6449a32130d74506a854b79d2 ]
-
-The cleaning up was done without changing the driver file name
-to ensure a cleaner bisect. Change the file name now to facilitate
-making the driver generic in subsequent patch.
-
-Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
-Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
-Stable-dep-of: c882c899ead3 ("soc: qcom: llcc: make irq truly optional")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/soc/qcom/Makefile | 2 +-
- drivers/soc/qcom/{llcc-slice.c => llcc-qcom.c} | 0
- 2 files changed, 1 insertion(+), 1 deletion(-)
- rename drivers/soc/qcom/{llcc-slice.c => llcc-qcom.c} (100%)
-
-diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile
-index 28d45b2e87e8..2559fe948ce0 100644
---- a/drivers/soc/qcom/Makefile
-+++ b/drivers/soc/qcom/Makefile
-@@ -21,6 +21,6 @@ obj-$(CONFIG_QCOM_SMSM) += smsm.o
- obj-$(CONFIG_QCOM_SOCINFO) += socinfo.o
- obj-$(CONFIG_QCOM_WCNSS_CTRL) += wcnss_ctrl.o
- obj-$(CONFIG_QCOM_APR) += apr.o
--obj-$(CONFIG_QCOM_LLCC) += llcc-slice.o
-+obj-$(CONFIG_QCOM_LLCC) += llcc-qcom.o
- obj-$(CONFIG_QCOM_RPMHPD) += rpmhpd.o
- obj-$(CONFIG_QCOM_RPMPD) += rpmpd.o
-diff --git a/drivers/soc/qcom/llcc-slice.c b/drivers/soc/qcom/llcc-qcom.c
-similarity index 100%
-rename from drivers/soc/qcom/llcc-slice.c
-rename to drivers/soc/qcom/llcc-qcom.c
---
-2.35.1
-