Skip to content

Commit d8ce82e

Browse files
committed
super: make locking naming consistent
Make the naming consistent with the earlier introduced super_lock_{read,write}() helpers. Reviewed-by: Jan Kara <[email protected]> Message-Id: <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 0ed3359 commit d8ce82e

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

fs/fs-writeback.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1953,9 +1953,9 @@ static long __writeback_inodes_wb(struct bdi_writeback *wb,
19531953
struct inode *inode = wb_inode(wb->b_io.prev);
19541954
struct super_block *sb = inode->i_sb;
19551955

1956-
if (!trylock_super(sb)) {
1956+
if (!super_trylock_shared(sb)) {
19571957
/*
1958-
* trylock_super() may fail consistently due to
1958+
* super_trylock_shared() may fail consistently due to
19591959
* s_umount being grabbed by someone else. Don't use
19601960
* requeue_io() to avoid busy retrying the inode/sb.
19611961
*/

fs/internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static inline void put_file_access(struct file *file)
115115
* super.c
116116
*/
117117
extern int reconfigure_super(struct fs_context *);
118-
extern bool trylock_super(struct super_block *sb);
118+
extern bool super_trylock_shared(struct super_block *sb);
119119
struct super_block *user_get_super(dev_t, bool excl);
120120
void put_super(struct super_block *sb);
121121
extern bool mount_capable(struct fs_context *);

fs/super.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static unsigned long super_cache_scan(struct shrinker *shrink,
112112
if (!(sc->gfp_mask & __GFP_FS))
113113
return SHRINK_STOP;
114114

115-
if (!trylock_super(sb))
115+
if (!super_trylock_shared(sb))
116116
return SHRINK_STOP;
117117

118118
if (sb->s_op->nr_cached_objects)
@@ -159,17 +159,17 @@ static unsigned long super_cache_count(struct shrinker *shrink,
159159
sb = container_of(shrink, struct super_block, s_shrink);
160160

161161
/*
162-
* We don't call trylock_super() here as it is a scalability bottleneck,
163-
* so we're exposed to partial setup state. The shrinker rwsem does not
164-
* protect filesystem operations backing list_lru_shrink_count() or
165-
* s_op->nr_cached_objects(). Counts can change between
166-
* super_cache_count and super_cache_scan, so we really don't need locks
167-
* here.
162+
* We don't call super_trylock_shared() here as it is a scalability
163+
* bottleneck, so we're exposed to partial setup state. The shrinker
164+
* rwsem does not protect filesystem operations backing
165+
* list_lru_shrink_count() or s_op->nr_cached_objects(). Counts can
166+
* change between super_cache_count and super_cache_scan, so we really
167+
* don't need locks here.
168168
*
169169
* However, if we are currently mounting the superblock, the underlying
170170
* filesystem might be in a state of partial construction and hence it
171-
* is dangerous to access it. trylock_super() uses a SB_BORN check to
172-
* avoid this situation, so do the same here. The memory barrier is
171+
* is dangerous to access it. super_trylock_shared() uses a SB_BORN check
172+
* to avoid this situation, so do the same here. The memory barrier is
173173
* matched with the one in mount_fs() as we don't hold locks here.
174174
*/
175175
if (!(sb->s_flags & SB_BORN))
@@ -428,7 +428,7 @@ static int grab_super(struct super_block *s) __releases(sb_lock)
428428
}
429429

430430
/*
431-
* trylock_super - try to grab ->s_umount shared
431+
* super_trylock_shared - try to grab ->s_umount shared
432432
* @sb: reference we are trying to grab
433433
*
434434
* Try to prevent fs shutdown. This is used in places where we
@@ -444,7 +444,7 @@ static int grab_super(struct super_block *s) __releases(sb_lock)
444444
* of down_read(). There's a couple of places that are OK with that, but
445445
* it's very much not a general-purpose interface.
446446
*/
447-
bool trylock_super(struct super_block *sb)
447+
bool super_trylock_shared(struct super_block *sb)
448448
{
449449
if (down_read_trylock(&sb->s_umount)) {
450450
if (!hlist_unhashed(&sb->s_instances) &&
@@ -1210,7 +1210,7 @@ EXPORT_SYMBOL(get_tree_keyed);
12101210
* and the place that clears the pointer to the superblock used by this function
12111211
* before freeing the superblock.
12121212
*/
1213-
static bool lock_active_super(struct super_block *sb)
1213+
static bool super_lock_shared_active(struct super_block *sb)
12141214
{
12151215
super_lock_shared(sb);
12161216
if (!sb->s_root ||
@@ -1228,7 +1228,7 @@ static void fs_bdev_mark_dead(struct block_device *bdev, bool surprise)
12281228
/* bd_holder_lock ensures that the sb isn't freed */
12291229
lockdep_assert_held(&bdev->bd_holder_lock);
12301230

1231-
if (!lock_active_super(sb))
1231+
if (!super_lock_shared_active(sb))
12321232
return;
12331233

12341234
if (!surprise)
@@ -1247,7 +1247,7 @@ static void fs_bdev_sync(struct block_device *bdev)
12471247

12481248
lockdep_assert_held(&bdev->bd_holder_lock);
12491249

1250-
if (!lock_active_super(sb))
1250+
if (!super_lock_shared_active(sb))
12511251
return;
12521252
sync_filesystem(sb);
12531253
super_unlock_shared(sb);

0 commit comments

Comments
 (0)