[1/5] fs/buffer: export __clear_page_buffers
diff mbox series

Message ID 20200418225123.31850-2-guoqing.jiang@cloud.ionos.com
State New
Headers show
Series
  • export __clear_page_buffers to cleanup code
Related show

Commit Message

Guoqing Jiang April 18, 2020, 10:51 p.m. UTC
Export the function so others (such as md, btrfs and iomap) can reuse it.

Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
---
 fs/buffer.c                 | 4 ++--
 include/linux/buffer_head.h | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

Comments

Nikolay Borisov April 19, 2020, 7:56 a.m. UTC | #1
On 19.04.20 г. 1:51 ч., Guoqing Jiang wrote:
> Export the function so others (such as md, btrfs and iomap) can reuse it.
> 
> Cc: Alexander Viro <viro@zeniv.linux.org.uk>
> Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
> ---
>  fs/buffer.c                 | 4 ++--
>  include/linux/buffer_head.h | 1 +
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/buffer.c b/fs/buffer.c
> index f73276d746bb..05b7489d9aa3 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -123,13 +123,13 @@ void __wait_on_buffer(struct buffer_head * bh)
>  }
>  EXPORT_SYMBOL(__wait_on_buffer);
>  
> -static void
> -__clear_page_buffers(struct page *page)
> +void __clear_page_buffers(struct page *page)
>  {
>  	ClearPagePrivate(page);
>  	set_page_private(page, 0);
>  	put_page(page);
>  }
> +EXPORT_SYMBOL(__clear_page_buffers);

Since this is being exported there is no reason to have __ prefix.
Rename the function as well, also why are you exporting it EXPORT_SYMBOL
and not EXPORT_SYMBOL_GPL just for the sake of consistency with other
functions in this file or some other reason?

>  
>  static void buffer_io_error(struct buffer_head *bh, char *msg)
>  {
> diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
> index e0b020eaf32e..735b094d89e1 100644
> --- a/include/linux/buffer_head.h
> +++ b/include/linux/buffer_head.h
> @@ -181,6 +181,7 @@ static inline void clean_bdev_bh_alias(struct buffer_head *bh)
>  
>  void mark_buffer_async_write(struct buffer_head *bh);
>  void __wait_on_buffer(struct buffer_head *);
> +void __clear_page_buffers(struct page *page);
>  wait_queue_head_t *bh_waitq_head(struct buffer_head *bh);
>  struct buffer_head *__find_get_block(struct block_device *bdev, sector_t block,
>  			unsigned size);
>
Guoqing Jiang April 19, 2020, 1:20 p.m. UTC | #2
On 19.04.20 09:56, Nikolay Borisov wrote:
>
> On 19.04.20 г. 1:51 ч., Guoqing Jiang wrote:
>> Export the function so others (such as md, btrfs and iomap) can reuse it.
>>
>> Cc: Alexander Viro <viro@zeniv.linux.org.uk>
>> Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
>> ---
>>   fs/buffer.c                 | 4 ++--
>>   include/linux/buffer_head.h | 1 +
>>   2 files changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/buffer.c b/fs/buffer.c
>> index f73276d746bb..05b7489d9aa3 100644
>> --- a/fs/buffer.c
>> +++ b/fs/buffer.c
>> @@ -123,13 +123,13 @@ void __wait_on_buffer(struct buffer_head * bh)
>>   }
>>   EXPORT_SYMBOL(__wait_on_buffer);
>>   
>> -static void
>> -__clear_page_buffers(struct page *page)
>> +void __clear_page_buffers(struct page *page)
>>   {
>>   	ClearPagePrivate(page);
>>   	set_page_private(page, 0);
>>   	put_page(page);
>>   }
>> +EXPORT_SYMBOL(__clear_page_buffers);
> Since this is being exported there is no reason to have __ prefix.
> Rename the function as well,

Yes, it need to be renamed.

>   also why are you exporting it EXPORT_SYMBOL
> and not EXPORT_SYMBOL_GPL just for the sake of consistency with other
> functions in this file or some other reason?

Because I followed EXPORT_SYMBOL(__wait_on_buffer).

Thanks,
Guoqing

Patch
diff mbox series

diff --git a/fs/buffer.c b/fs/buffer.c
index f73276d746bb..05b7489d9aa3 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -123,13 +123,13 @@  void __wait_on_buffer(struct buffer_head * bh)
 }
 EXPORT_SYMBOL(__wait_on_buffer);
 
-static void
-__clear_page_buffers(struct page *page)
+void __clear_page_buffers(struct page *page)
 {
 	ClearPagePrivate(page);
 	set_page_private(page, 0);
 	put_page(page);
 }
+EXPORT_SYMBOL(__clear_page_buffers);
 
 static void buffer_io_error(struct buffer_head *bh, char *msg)
 {
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index e0b020eaf32e..735b094d89e1 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -181,6 +181,7 @@  static inline void clean_bdev_bh_alias(struct buffer_head *bh)
 
 void mark_buffer_async_write(struct buffer_head *bh);
 void __wait_on_buffer(struct buffer_head *);
+void __clear_page_buffers(struct page *page);
 wait_queue_head_t *bh_waitq_head(struct buffer_head *bh);
 struct buffer_head *__find_get_block(struct block_device *bdev, sector_t block,
 			unsigned size);