diff mbox series

[3/3] vfs: move __sb_{start,end}_write* to fs.h

Message ID 160494582399.772573.10836748188202532335.stgit@magnolia (mailing list archive)
State New, archived
Headers show
Series vfs: remove lockdep fs freeze weirdness | expand

Commit Message

Darrick J. Wong Nov. 9, 2020, 6:17 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Now that we've straightened out the callers, move these three functions
to fs.h since they're fairly trivial.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/super.c         |   30 ------------------------------
 include/linux/fs.h |   21 ++++++++++++++++++---
 2 files changed, 18 insertions(+), 33 deletions(-)

Comments

Jan Kara Nov. 10, 2020, 11:36 a.m. UTC | #1
On Mon 09-11-20 10:17:04, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Now that we've straightened out the callers, move these three functions
> to fs.h since they're fairly trivial.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Looks good to me. You can add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/super.c         |   30 ------------------------------
>  include/linux/fs.h |   21 ++++++++++++++++++---
>  2 files changed, 18 insertions(+), 33 deletions(-)
> 
> 
> diff --git a/fs/super.c b/fs/super.c
> index 59aa59279133..98bb0629ee10 100644
> --- a/fs/super.c
> +++ b/fs/super.c
> @@ -1631,36 +1631,6 @@ int super_setup_bdi(struct super_block *sb)
>  }
>  EXPORT_SYMBOL(super_setup_bdi);
>  
> -/*
> - * This is an internal function, please use sb_end_{write,pagefault,intwrite}
> - * instead.
> - */
> -void __sb_end_write(struct super_block *sb, int level)
> -{
> -	percpu_up_read(sb->s_writers.rw_sem + level-1);
> -}
> -EXPORT_SYMBOL(__sb_end_write);
> -
> -/*
> - * This is an internal function, please use sb_start_{write,pagefault,intwrite}
> - * instead.
> - */
> -void __sb_start_write(struct super_block *sb, int level)
> -{
> -	percpu_down_read(sb->s_writers.rw_sem + level - 1);
> -}
> -EXPORT_SYMBOL(__sb_start_write);
> -
> -/*
> - * This is an internal function, please use sb_start_{write,pagefault,intwrite}
> - * instead.
> - */
> -bool __sb_start_write_trylock(struct super_block *sb, int level)
> -{
> -	return percpu_down_read_trylock(sb->s_writers.rw_sem + level - 1);
> -}
> -EXPORT_SYMBOL_GPL(__sb_start_write_trylock);
> -
>  /**
>   * sb_wait_write - wait until all writers to given file system finish
>   * @sb: the super for which we wait
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 305989afd49c..6dabd019cab0 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -1580,9 +1580,24 @@ extern struct timespec64 current_time(struct inode *inode);
>   * Snapshotting support.
>   */
>  
> -void __sb_end_write(struct super_block *sb, int level);
> -void __sb_start_write(struct super_block *sb, int level);
> -bool __sb_start_write_trylock(struct super_block *sb, int level);
> +/*
> + * These are internal functions, please use sb_start_{write,pagefault,intwrite}
> + * instead.
> + */
> +static inline void __sb_end_write(struct super_block *sb, int level)
> +{
> +	percpu_up_read(sb->s_writers.rw_sem + level-1);
> +}
> +
> +static inline void __sb_start_write(struct super_block *sb, int level)
> +{
> +	percpu_down_read(sb->s_writers.rw_sem + level - 1);
> +}
> +
> +static inline bool __sb_start_write_trylock(struct super_block *sb, int level)
> +{
> +	return percpu_down_read_trylock(sb->s_writers.rw_sem + level - 1);
> +}
>  
>  #define __sb_writers_acquired(sb, lev)	\
>  	percpu_rwsem_acquire(&(sb)->s_writers.rw_sem[(lev)-1], 1, _THIS_IP_)
>
Christoph Hellwig Nov. 10, 2020, 6:32 p.m. UTC | #2
On Mon, Nov 09, 2020 at 10:17:04AM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Now that we've straightened out the callers, move these three functions
> to fs.h since they're fairly trivial.

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/fs/super.c b/fs/super.c
index 59aa59279133..98bb0629ee10 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1631,36 +1631,6 @@  int super_setup_bdi(struct super_block *sb)
 }
 EXPORT_SYMBOL(super_setup_bdi);
 
-/*
- * This is an internal function, please use sb_end_{write,pagefault,intwrite}
- * instead.
- */
-void __sb_end_write(struct super_block *sb, int level)
-{
-	percpu_up_read(sb->s_writers.rw_sem + level-1);
-}
-EXPORT_SYMBOL(__sb_end_write);
-
-/*
- * This is an internal function, please use sb_start_{write,pagefault,intwrite}
- * instead.
- */
-void __sb_start_write(struct super_block *sb, int level)
-{
-	percpu_down_read(sb->s_writers.rw_sem + level - 1);
-}
-EXPORT_SYMBOL(__sb_start_write);
-
-/*
- * This is an internal function, please use sb_start_{write,pagefault,intwrite}
- * instead.
- */
-bool __sb_start_write_trylock(struct super_block *sb, int level)
-{
-	return percpu_down_read_trylock(sb->s_writers.rw_sem + level - 1);
-}
-EXPORT_SYMBOL_GPL(__sb_start_write_trylock);
-
 /**
  * sb_wait_write - wait until all writers to given file system finish
  * @sb: the super for which we wait
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 305989afd49c..6dabd019cab0 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1580,9 +1580,24 @@  extern struct timespec64 current_time(struct inode *inode);
  * Snapshotting support.
  */
 
-void __sb_end_write(struct super_block *sb, int level);
-void __sb_start_write(struct super_block *sb, int level);
-bool __sb_start_write_trylock(struct super_block *sb, int level);
+/*
+ * These are internal functions, please use sb_start_{write,pagefault,intwrite}
+ * instead.
+ */
+static inline void __sb_end_write(struct super_block *sb, int level)
+{
+	percpu_up_read(sb->s_writers.rw_sem + level-1);
+}
+
+static inline void __sb_start_write(struct super_block *sb, int level)
+{
+	percpu_down_read(sb->s_writers.rw_sem + level - 1);
+}
+
+static inline bool __sb_start_write_trylock(struct super_block *sb, int level)
+{
+	return percpu_down_read_trylock(sb->s_writers.rw_sem + level - 1);
+}
 
 #define __sb_writers_acquired(sb, lev)	\
 	percpu_rwsem_acquire(&(sb)->s_writers.rw_sem[(lev)-1], 1, _THIS_IP_)