Commit c6653a83 authored by Nick Piggin's avatar Nick Piggin

fs: rename vfsmount counter helpers

Suggested by Andreas, mnt_ prefix is clearer namespace, follows kernel
conventions better, and is easier for tab complete. I introduced these
names so I'll admit they were not good choices.
Signed-off-by: default avatarNick Piggin <npiggin@kernel.dk>
parent 9d55c369
...@@ -216,7 +216,7 @@ int __mnt_is_readonly(struct vfsmount *mnt) ...@@ -216,7 +216,7 @@ int __mnt_is_readonly(struct vfsmount *mnt)
} }
EXPORT_SYMBOL_GPL(__mnt_is_readonly); EXPORT_SYMBOL_GPL(__mnt_is_readonly);
static inline void inc_mnt_writers(struct vfsmount *mnt) static inline void mnt_inc_writers(struct vfsmount *mnt)
{ {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
(*per_cpu_ptr(mnt->mnt_writers, smp_processor_id()))++; (*per_cpu_ptr(mnt->mnt_writers, smp_processor_id()))++;
...@@ -225,7 +225,7 @@ static inline void inc_mnt_writers(struct vfsmount *mnt) ...@@ -225,7 +225,7 @@ static inline void inc_mnt_writers(struct vfsmount *mnt)
#endif #endif
} }
static inline void dec_mnt_writers(struct vfsmount *mnt) static inline void mnt_dec_writers(struct vfsmount *mnt)
{ {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
(*per_cpu_ptr(mnt->mnt_writers, smp_processor_id()))--; (*per_cpu_ptr(mnt->mnt_writers, smp_processor_id()))--;
...@@ -234,7 +234,7 @@ static inline void dec_mnt_writers(struct vfsmount *mnt) ...@@ -234,7 +234,7 @@ static inline void dec_mnt_writers(struct vfsmount *mnt)
#endif #endif
} }
static unsigned int count_mnt_writers(struct vfsmount *mnt) static unsigned int mnt_get_writers(struct vfsmount *mnt)
{ {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
unsigned int count = 0; unsigned int count = 0;
...@@ -273,9 +273,9 @@ int mnt_want_write(struct vfsmount *mnt) ...@@ -273,9 +273,9 @@ int mnt_want_write(struct vfsmount *mnt)
int ret = 0; int ret = 0;
preempt_disable(); preempt_disable();
inc_mnt_writers(mnt); mnt_inc_writers(mnt);
/* /*
* The store to inc_mnt_writers must be visible before we pass * The store to mnt_inc_writers must be visible before we pass
* MNT_WRITE_HOLD loop below, so that the slowpath can see our * MNT_WRITE_HOLD loop below, so that the slowpath can see our
* incremented count after it has set MNT_WRITE_HOLD. * incremented count after it has set MNT_WRITE_HOLD.
*/ */
...@@ -289,7 +289,7 @@ int mnt_want_write(struct vfsmount *mnt) ...@@ -289,7 +289,7 @@ int mnt_want_write(struct vfsmount *mnt)
*/ */
smp_rmb(); smp_rmb();
if (__mnt_is_readonly(mnt)) { if (__mnt_is_readonly(mnt)) {
dec_mnt_writers(mnt); mnt_dec_writers(mnt);
ret = -EROFS; ret = -EROFS;
goto out; goto out;
} }
...@@ -317,7 +317,7 @@ int mnt_clone_write(struct vfsmount *mnt) ...@@ -317,7 +317,7 @@ int mnt_clone_write(struct vfsmount *mnt)
if (__mnt_is_readonly(mnt)) if (__mnt_is_readonly(mnt))
return -EROFS; return -EROFS;
preempt_disable(); preempt_disable();
inc_mnt_writers(mnt); mnt_inc_writers(mnt);
preempt_enable(); preempt_enable();
return 0; return 0;
} }
...@@ -351,7 +351,7 @@ EXPORT_SYMBOL_GPL(mnt_want_write_file); ...@@ -351,7 +351,7 @@ EXPORT_SYMBOL_GPL(mnt_want_write_file);
void mnt_drop_write(struct vfsmount *mnt) void mnt_drop_write(struct vfsmount *mnt)
{ {
preempt_disable(); preempt_disable();
dec_mnt_writers(mnt); mnt_dec_writers(mnt);
preempt_enable(); preempt_enable();
} }
EXPORT_SYMBOL_GPL(mnt_drop_write); EXPORT_SYMBOL_GPL(mnt_drop_write);
...@@ -384,7 +384,7 @@ static int mnt_make_readonly(struct vfsmount *mnt) ...@@ -384,7 +384,7 @@ static int mnt_make_readonly(struct vfsmount *mnt)
* MNT_WRITE_HOLD, so it can't be decremented by another CPU while * MNT_WRITE_HOLD, so it can't be decremented by another CPU while
* we're counting up here. * we're counting up here.
*/ */
if (count_mnt_writers(mnt) > 0) if (mnt_get_writers(mnt) > 0)
ret = -EBUSY; ret = -EBUSY;
else else
mnt->mnt_flags |= MNT_READONLY; mnt->mnt_flags |= MNT_READONLY;
...@@ -663,9 +663,9 @@ static inline void __mntput(struct vfsmount *mnt) ...@@ -663,9 +663,9 @@ static inline void __mntput(struct vfsmount *mnt)
*/ */
/* /*
* atomic_dec_and_lock() used to deal with ->mnt_count decrements * atomic_dec_and_lock() used to deal with ->mnt_count decrements
* provides barriers, so count_mnt_writers() below is safe. AV * provides barriers, so mnt_get_writers() below is safe. AV
*/ */
WARN_ON(count_mnt_writers(mnt)); WARN_ON(mnt_get_writers(mnt));
fsnotify_vfsmount_delete(mnt); fsnotify_vfsmount_delete(mnt);
dput(mnt->mnt_root); dput(mnt->mnt_root);
free_vfsmnt(mnt); free_vfsmnt(mnt);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment