diff options
author | Naohiro Aota <naohiro.aota@wdc.com> | 2022-03-29 15:55:59 +0900 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-05-16 17:03:10 +0200 |
commit | 7f8d12ea96352275c2850c24a1367166179392d2 (patch) | |
tree | a9b97f2d113cb47da1a0d276bfd8723fb942c26b /include/linux/fs.h | |
parent | d864546231e051e33e200025e4a6988b996f2654 (diff) | |
download | linux-stable-7f8d12ea96352275c2850c24a1367166179392d2.tar.gz linux-stable-7f8d12ea96352275c2850c24a1367166179392d2.tar.bz2 linux-stable-7f8d12ea96352275c2850c24a1367166179392d2.zip |
fs: add a lockdep check function for sb_start_write()
Add a function sb_write_started() to allow callers to verify if
sb_start_write() is properly called. It will be used for assertion in
btrfs.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index bbde95387a23..01d61984ce7a 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1708,6 +1708,11 @@ static inline bool __sb_start_write_trylock(struct super_block *sb, int level) #define __sb_writers_release(sb, lev) \ percpu_rwsem_release(&(sb)->s_writers.rw_sem[(lev)-1], 1, _THIS_IP_) +static inline bool sb_write_started(const struct super_block *sb) +{ + return lockdep_is_held_type(sb->s_writers.rw_sem + SB_FREEZE_WRITE - 1, 1); +} + /** * sb_end_write - drop write access to a superblock * @sb: the super we wrote to |