* Re: [PATCH 06/10] ext4: dedpulicate the code to wait on inode that's being committed
@ 2020-11-01 17:54 kernel test robot
0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2020-11-01 17:54 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 6351 bytes --]
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20201031200518.4178786-7-harshadshirwadkar@gmail.com>
References: <20201031200518.4178786-7-harshadshirwadkar@gmail.com>
TO: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
TO: linux-ext4(a)vger.kernel.org
CC: tytso(a)mit.edu
CC: jack(a)suse.cz
CC: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Hi Harshad,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on ext4/dev]
[also build test WARNING on linus/master next-20201030]
[cannot apply to tip/perf/core v5.10-rc1]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Harshad-Shirwadkar/Ext4-fast-commit-fixes/20201101-040720
base: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev
:::::: branch date: 22 hours ago
:::::: commit date: 22 hours ago
config: h8300-randconfig-s031-20201101 (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-76-gf680124b-dirty
# https://github.com/0day-ci/linux/commit/03936f406da8e26f13136a56129d2ffb6bccb2ba
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Harshad-Shirwadkar/Ext4-fast-commit-fixes/20201101-040720
git checkout 03936f406da8e26f13136a56129d2ffb6bccb2ba
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=h8300
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
"sparse warnings: (new ones prefixed by >>)"
fs/ext4/fast_commit.c:2091:12: sparse: sparse: symbol 'fc_ineligible_reasons' was not declared. Should it be static?
fs/ext4/fast_commit.c: note: in included file (through include/linux/wait.h, include/linux/pid.h, include/linux/sched.h, include/linux/blkdev.h, ...):
>> include/linux/spinlock.h:394:9: sparse: sparse: context imbalance in 'ext4_fc_wait_committing_inode' - unexpected unlock
>> include/linux/spinlock.h:354:9: sparse: sparse: context imbalance in 'ext4_fc_start_update' - different lock contexts for basic block
>> include/linux/spinlock.h:354:9: sparse: sparse: context imbalance in 'ext4_fc_del' - different lock contexts for basic block
include/linux/spinlock.h:394:9: sparse: sparse: context imbalance in 'ext4_fc_commit_dentry_updates' - unexpected unlock
vim +/ext4_fc_wait_committing_inode +394 include/linux/spinlock.h
de8f5e4f2dc1f03 Peter Zijlstra 2020-03-21 351
3490565b633c705 Denys Vlasenko 2015-07-13 352 static __always_inline void spin_lock(spinlock_t *lock)
c2f21ce2e31286a Thomas Gleixner 2009-12-02 353 {
c2f21ce2e31286a Thomas Gleixner 2009-12-02 @354 raw_spin_lock(&lock->rlock);
c2f21ce2e31286a Thomas Gleixner 2009-12-02 355 }
c2f21ce2e31286a Thomas Gleixner 2009-12-02 356
3490565b633c705 Denys Vlasenko 2015-07-13 357 static __always_inline void spin_lock_bh(spinlock_t *lock)
c2f21ce2e31286a Thomas Gleixner 2009-12-02 358 {
c2f21ce2e31286a Thomas Gleixner 2009-12-02 359 raw_spin_lock_bh(&lock->rlock);
c2f21ce2e31286a Thomas Gleixner 2009-12-02 360 }
c2f21ce2e31286a Thomas Gleixner 2009-12-02 361
3490565b633c705 Denys Vlasenko 2015-07-13 362 static __always_inline int spin_trylock(spinlock_t *lock)
c2f21ce2e31286a Thomas Gleixner 2009-12-02 363 {
c2f21ce2e31286a Thomas Gleixner 2009-12-02 364 return raw_spin_trylock(&lock->rlock);
c2f21ce2e31286a Thomas Gleixner 2009-12-02 365 }
c2f21ce2e31286a Thomas Gleixner 2009-12-02 366
c2f21ce2e31286a Thomas Gleixner 2009-12-02 367 #define spin_lock_nested(lock, subclass) \
c2f21ce2e31286a Thomas Gleixner 2009-12-02 368 do { \
c2f21ce2e31286a Thomas Gleixner 2009-12-02 369 raw_spin_lock_nested(spinlock_check(lock), subclass); \
c2f21ce2e31286a Thomas Gleixner 2009-12-02 370 } while (0)
c2f21ce2e31286a Thomas Gleixner 2009-12-02 371
c2f21ce2e31286a Thomas Gleixner 2009-12-02 372 #define spin_lock_nest_lock(lock, nest_lock) \
c2f21ce2e31286a Thomas Gleixner 2009-12-02 373 do { \
c2f21ce2e31286a Thomas Gleixner 2009-12-02 374 raw_spin_lock_nest_lock(spinlock_check(lock), nest_lock); \
c2f21ce2e31286a Thomas Gleixner 2009-12-02 375 } while (0)
c2f21ce2e31286a Thomas Gleixner 2009-12-02 376
3490565b633c705 Denys Vlasenko 2015-07-13 377 static __always_inline void spin_lock_irq(spinlock_t *lock)
c2f21ce2e31286a Thomas Gleixner 2009-12-02 378 {
c2f21ce2e31286a Thomas Gleixner 2009-12-02 379 raw_spin_lock_irq(&lock->rlock);
c2f21ce2e31286a Thomas Gleixner 2009-12-02 380 }
c2f21ce2e31286a Thomas Gleixner 2009-12-02 381
c2f21ce2e31286a Thomas Gleixner 2009-12-02 382 #define spin_lock_irqsave(lock, flags) \
c2f21ce2e31286a Thomas Gleixner 2009-12-02 383 do { \
c2f21ce2e31286a Thomas Gleixner 2009-12-02 384 raw_spin_lock_irqsave(spinlock_check(lock), flags); \
c2f21ce2e31286a Thomas Gleixner 2009-12-02 385 } while (0)
c2f21ce2e31286a Thomas Gleixner 2009-12-02 386
c2f21ce2e31286a Thomas Gleixner 2009-12-02 387 #define spin_lock_irqsave_nested(lock, flags, subclass) \
c2f21ce2e31286a Thomas Gleixner 2009-12-02 388 do { \
c2f21ce2e31286a Thomas Gleixner 2009-12-02 389 raw_spin_lock_irqsave_nested(spinlock_check(lock), flags, subclass); \
c2f21ce2e31286a Thomas Gleixner 2009-12-02 390 } while (0)
c2f21ce2e31286a Thomas Gleixner 2009-12-02 391
3490565b633c705 Denys Vlasenko 2015-07-13 392 static __always_inline void spin_unlock(spinlock_t *lock)
c2f21ce2e31286a Thomas Gleixner 2009-12-02 393 {
c2f21ce2e31286a Thomas Gleixner 2009-12-02 @394 raw_spin_unlock(&lock->rlock);
c2f21ce2e31286a Thomas Gleixner 2009-12-02 395 }
c2f21ce2e31286a Thomas Gleixner 2009-12-02 396
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 29616 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 06/10] ext4: dedpulicate the code to wait on inode that's being committed
2020-11-03 16:42 ` Jan Kara
@ 2020-11-04 21:35 ` harshad shirwadkar
0 siblings, 0 replies; 4+ messages in thread
From: harshad shirwadkar @ 2020-11-04 21:35 UTC (permalink / raw)
To: Jan Kara; +Cc: Ext4 Developers List, Theodore Y. Ts'o
On Tue, Nov 3, 2020 at 8:42 AM Jan Kara <jack@suse.cz> wrote:
>
> On Sat 31-10-20 13:05:14, Harshad Shirwadkar wrote:
> > This patch removes the deduplicates the code that implements waiting
> > on inode that's being committed. That code is moved into a new
> > function.
> >
> > Suggested-by: Jan Kara <jack@suse.cz>
> > Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
>
> Looks good to me. Just one nit below:
>
> > diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c
> > index b1ca55c7d32a..0f2543220d1d 100644
> > --- a/fs/ext4/fast_commit.c
> > +++ b/fs/ext4/fast_commit.c
> > @@ -155,6 +155,28 @@ void ext4_fc_init_inode(struct inode *inode)
> > ei->i_fc_committed_subtid = 0;
> > }
> >
> > +static void ext4_fc_wait_committing_inode(struct inode *inode)
> > +{
> > + wait_queue_head_t *wq;
> > + struct ext4_inode_info *ei = EXT4_I(inode);
> > +
>
> Maybe add lockdep_assert_held(&EXT4_SB(inode->i_sb)->s_fc_lock) here to
> make sure the function is called properly? It's kind of unobvious
> requirement (but hard to avoid)...
Sounds good. I had to add it after the #ifdef and before the
"prepare_to_wait()" call in order to avoid "ISO C90 forbids mixed
declarations and code [-Wd
eclaration-after-statement]" warning.
Thanks,
Harshad
>
> > +#if (BITS_PER_LONG < 64)
> > + DEFINE_WAIT_BIT(wait, &ei->i_state_flags,
> > + EXT4_STATE_FC_COMMITTING);
> > + wq = bit_waitqueue(&ei->i_state_flags,
> > + EXT4_STATE_FC_COMMITTING);
> > +#else
> > + DEFINE_WAIT_BIT(wait, &ei->i_flags,
> > + EXT4_STATE_FC_COMMITTING);
> > + wq = bit_waitqueue(&ei->i_flags,
> > + EXT4_STATE_FC_COMMITTING);
> > +#endif
> > + prepare_to_wait(wq, &wait.wq_entry, TASK_UNINTERRUPTIBLE);
> > + spin_unlock(&EXT4_SB(inode->i_sb)->s_fc_lock);
> > + schedule();
> > + finish_wait(wq, &wait.wq_entry);
> > +}
> > +
>
> Honza
> --
> Jan Kara <jack@suse.com>
> SUSE Labs, CR
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 06/10] ext4: dedpulicate the code to wait on inode that's being committed
2020-10-31 20:05 ` [PATCH 06/10] ext4: dedpulicate the code to wait on inode that's being committed Harshad Shirwadkar
@ 2020-11-03 16:42 ` Jan Kara
2020-11-04 21:35 ` harshad shirwadkar
0 siblings, 1 reply; 4+ messages in thread
From: Jan Kara @ 2020-11-03 16:42 UTC (permalink / raw)
To: Harshad Shirwadkar; +Cc: linux-ext4, tytso, jack
On Sat 31-10-20 13:05:14, Harshad Shirwadkar wrote:
> This patch removes the deduplicates the code that implements waiting
> on inode that's being committed. That code is moved into a new
> function.
>
> Suggested-by: Jan Kara <jack@suse.cz>
> Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Looks good to me. Just one nit below:
> diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c
> index b1ca55c7d32a..0f2543220d1d 100644
> --- a/fs/ext4/fast_commit.c
> +++ b/fs/ext4/fast_commit.c
> @@ -155,6 +155,28 @@ void ext4_fc_init_inode(struct inode *inode)
> ei->i_fc_committed_subtid = 0;
> }
>
> +static void ext4_fc_wait_committing_inode(struct inode *inode)
> +{
> + wait_queue_head_t *wq;
> + struct ext4_inode_info *ei = EXT4_I(inode);
> +
Maybe add lockdep_assert_held(&EXT4_SB(inode->i_sb)->s_fc_lock) here to
make sure the function is called properly? It's kind of unobvious
requirement (but hard to avoid)...
> +#if (BITS_PER_LONG < 64)
> + DEFINE_WAIT_BIT(wait, &ei->i_state_flags,
> + EXT4_STATE_FC_COMMITTING);
> + wq = bit_waitqueue(&ei->i_state_flags,
> + EXT4_STATE_FC_COMMITTING);
> +#else
> + DEFINE_WAIT_BIT(wait, &ei->i_flags,
> + EXT4_STATE_FC_COMMITTING);
> + wq = bit_waitqueue(&ei->i_flags,
> + EXT4_STATE_FC_COMMITTING);
> +#endif
> + prepare_to_wait(wq, &wait.wq_entry, TASK_UNINTERRUPTIBLE);
> + spin_unlock(&EXT4_SB(inode->i_sb)->s_fc_lock);
> + schedule();
> + finish_wait(wq, &wait.wq_entry);
> +}
> +
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 06/10] ext4: dedpulicate the code to wait on inode that's being committed
2020-10-31 20:05 [PATCH 00/10] Ext4 fast commit fixes Harshad Shirwadkar
@ 2020-10-31 20:05 ` Harshad Shirwadkar
2020-11-03 16:42 ` Jan Kara
0 siblings, 1 reply; 4+ messages in thread
From: Harshad Shirwadkar @ 2020-10-31 20:05 UTC (permalink / raw)
To: linux-ext4; +Cc: tytso, jack, Harshad Shirwadkar
This patch removes the deduplicates the code that implements waiting
on inode that's being committed. That code is moved into a new
function.
Suggested-by: Jan Kara <jack@suse.cz>
Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
---
fs/ext4/fast_commit.c | 59 ++++++++++++++++++-------------------------
1 file changed, 25 insertions(+), 34 deletions(-)
diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c
index b1ca55c7d32a..0f2543220d1d 100644
--- a/fs/ext4/fast_commit.c
+++ b/fs/ext4/fast_commit.c
@@ -155,6 +155,28 @@ void ext4_fc_init_inode(struct inode *inode)
ei->i_fc_committed_subtid = 0;
}
+static void ext4_fc_wait_committing_inode(struct inode *inode)
+{
+ wait_queue_head_t *wq;
+ struct ext4_inode_info *ei = EXT4_I(inode);
+
+#if (BITS_PER_LONG < 64)
+ DEFINE_WAIT_BIT(wait, &ei->i_state_flags,
+ EXT4_STATE_FC_COMMITTING);
+ wq = bit_waitqueue(&ei->i_state_flags,
+ EXT4_STATE_FC_COMMITTING);
+#else
+ DEFINE_WAIT_BIT(wait, &ei->i_flags,
+ EXT4_STATE_FC_COMMITTING);
+ wq = bit_waitqueue(&ei->i_flags,
+ EXT4_STATE_FC_COMMITTING);
+#endif
+ prepare_to_wait(wq, &wait.wq_entry, TASK_UNINTERRUPTIBLE);
+ spin_unlock(&EXT4_SB(inode->i_sb)->s_fc_lock);
+ schedule();
+ finish_wait(wq, &wait.wq_entry);
+}
+
/*
* Inform Ext4's fast about start of an inode update
*
@@ -176,22 +198,7 @@ void ext4_fc_start_update(struct inode *inode)
goto out;
if (ext4_test_inode_state(inode, EXT4_STATE_FC_COMMITTING)) {
- wait_queue_head_t *wq;
-#if (BITS_PER_LONG < 64)
- DEFINE_WAIT_BIT(wait, &ei->i_state_flags,
- EXT4_STATE_FC_COMMITTING);
- wq = bit_waitqueue(&ei->i_state_flags,
- EXT4_STATE_FC_COMMITTING);
-#else
- DEFINE_WAIT_BIT(wait, &ei->i_flags,
- EXT4_STATE_FC_COMMITTING);
- wq = bit_waitqueue(&ei->i_flags,
- EXT4_STATE_FC_COMMITTING);
-#endif
- prepare_to_wait(wq, &wait.wq_entry, TASK_UNINTERRUPTIBLE);
- spin_unlock(&EXT4_SB(inode->i_sb)->s_fc_lock);
- schedule();
- finish_wait(wq, &wait.wq_entry);
+ ext4_fc_wait_committing_inode(inode);
goto restart;
}
out:
@@ -234,26 +241,10 @@ void ext4_fc_del(struct inode *inode)
}
if (ext4_test_inode_state(inode, EXT4_STATE_FC_COMMITTING)) {
- wait_queue_head_t *wq;
-#if (BITS_PER_LONG < 64)
- DEFINE_WAIT_BIT(wait, &ei->i_state_flags,
- EXT4_STATE_FC_COMMITTING);
- wq = bit_waitqueue(&ei->i_state_flags,
- EXT4_STATE_FC_COMMITTING);
-#else
- DEFINE_WAIT_BIT(wait, &ei->i_flags,
- EXT4_STATE_FC_COMMITTING);
- wq = bit_waitqueue(&ei->i_flags,
- EXT4_STATE_FC_COMMITTING);
-#endif
- prepare_to_wait(wq, &wait.wq_entry, TASK_UNINTERRUPTIBLE);
- spin_unlock(&EXT4_SB(inode->i_sb)->s_fc_lock);
- schedule();
- finish_wait(wq, &wait.wq_entry);
+ ext4_fc_wait_committing_inode(inode);
goto restart;
}
- if (!list_empty(&ei->i_fc_list))
- list_del_init(&ei->i_fc_list);
+ list_del_init(&ei->i_fc_list);
spin_unlock(&EXT4_SB(inode->i_sb)->s_fc_lock);
}
--
2.29.1.341.ge80a0c044ae-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-11-04 21:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-01 17:54 [PATCH 06/10] ext4: dedpulicate the code to wait on inode that's being committed kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2020-10-31 20:05 [PATCH 00/10] Ext4 fast commit fixes Harshad Shirwadkar
2020-10-31 20:05 ` [PATCH 06/10] ext4: dedpulicate the code to wait on inode that's being committed Harshad Shirwadkar
2020-11-03 16:42 ` Jan Kara
2020-11-04 21:35 ` harshad shirwadkar
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.