Re: [PATCH] btrfs: extent_buffer_uptodate() make it static and inline

2018-02-13 Thread David Sterba
On Tue, Feb 13, 2018 at 09:18:51AM +0200, Nikolay Borisov wrote:
> 
> 
> On 13.02.2018 06:35, Anand Jain wrote:
> > extent_buffer_uptodate() is a trivial wrapper around test_bit()
> > and nothing else. So make it static and inline, save on code
> > space and call indirection.
> > 
> > Before:
> >textdata bss dec hex filename
> > 1131257   82898   18992 1233147  12d0fb fs/btrfs/btrfs.ko
> > 
> > After:
> >textdata bss dec hex filename
> > 1131090   82898   18992 1232980  12d054 fs/btrfs/btrfs.ko
> > 
> > Signed-off-by: Anand Jain 
> 
> Reviewed-by: Nikolay Borisov  although there is one
> nit below
> 
> > ---
> >  fs/btrfs/extent_io.c | 5 -
> >  fs/btrfs/extent_io.h | 5 -
> >  2 files changed, 4 insertions(+), 6 deletions(-)
> > 
> > diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> > index bae57b408901..f300edae044b 100644
> > --- a/fs/btrfs/extent_io.c
> > +++ b/fs/btrfs/extent_io.c
> > @@ -5229,11 +5229,6 @@ void set_extent_buffer_uptodate(struct extent_buffer 
> > *eb)
> > }
> >  }
> >  
> > -int extent_buffer_uptodate(struct extent_buffer *eb)
> > -{
> > -   return test_bit(EXTENT_BUFFER_UPTODATE, >bflags);
> > -}
> > -
> >  int read_extent_buffer_pages(struct extent_io_tree *tree,
> >  struct extent_buffer *eb, int wait, int mirror_num)
> >  {
> > diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
> > index 72e5af2965a8..953d94662b8e 100644
> > --- a/fs/btrfs/extent_io.h
> > +++ b/fs/btrfs/extent_io.h
> > @@ -489,7 +489,10 @@ void clear_extent_buffer_dirty(struct extent_buffer 
> > *eb);
> >  int set_extent_buffer_dirty(struct extent_buffer *eb);
> >  void set_extent_buffer_uptodate(struct extent_buffer *eb);
> >  void clear_extent_buffer_uptodate(struct extent_buffer *eb);
> > -int extent_buffer_uptodate(struct extent_buffer *eb);
> > +static inline int extent_buffer_uptodate(struct extent_buffer *eb)
> > +{
> > +   return test_bit(EXTENT_BUFFER_UPTODATE, >bflags);
> > +}
> 
> nit: It just doesn't look good to have a static inline function
> definition among a list of function declarations. A quick look at
> extent_io.h shows that this function could have been put below the
> inline def of extent_buffer_get.

I will move it.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] btrfs: extent_buffer_uptodate() make it static and inline

2018-02-12 Thread Nikolay Borisov


On 13.02.2018 06:35, Anand Jain wrote:
> extent_buffer_uptodate() is a trivial wrapper around test_bit()
> and nothing else. So make it static and inline, save on code
> space and call indirection.
> 
> Before:
>text  data bss dec hex filename
> 1131257 82898   18992 1233147  12d0fb fs/btrfs/btrfs.ko
> 
> After:
>text  data bss dec hex filename
> 1131090 82898   18992 1232980  12d054 fs/btrfs/btrfs.ko
> 
> Signed-off-by: Anand Jain 

Reviewed-by: Nikolay Borisov  although there is one
nit below

> ---
>  fs/btrfs/extent_io.c | 5 -
>  fs/btrfs/extent_io.h | 5 -
>  2 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index bae57b408901..f300edae044b 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -5229,11 +5229,6 @@ void set_extent_buffer_uptodate(struct extent_buffer 
> *eb)
>   }
>  }
>  
> -int extent_buffer_uptodate(struct extent_buffer *eb)
> -{
> - return test_bit(EXTENT_BUFFER_UPTODATE, >bflags);
> -}
> -
>  int read_extent_buffer_pages(struct extent_io_tree *tree,
>struct extent_buffer *eb, int wait, int mirror_num)
>  {
> diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
> index 72e5af2965a8..953d94662b8e 100644
> --- a/fs/btrfs/extent_io.h
> +++ b/fs/btrfs/extent_io.h
> @@ -489,7 +489,10 @@ void clear_extent_buffer_dirty(struct extent_buffer *eb);
>  int set_extent_buffer_dirty(struct extent_buffer *eb);
>  void set_extent_buffer_uptodate(struct extent_buffer *eb);
>  void clear_extent_buffer_uptodate(struct extent_buffer *eb);
> -int extent_buffer_uptodate(struct extent_buffer *eb);
> +static inline int extent_buffer_uptodate(struct extent_buffer *eb)
> +{
> + return test_bit(EXTENT_BUFFER_UPTODATE, >bflags);
> +}

nit: It just doesn't look good to have a static inline function
definition among a list of function declarations. A quick look at
extent_io.h shows that this function could have been put below the
inline def of extent_buffer_get.


>  int extent_buffer_under_io(struct extent_buffer *eb);
>  int map_private_extent_buffer(const struct extent_buffer *eb,
> unsigned long offset, unsigned long min_len,
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] btrfs: extent_buffer_uptodate() make it static and inline

2018-02-12 Thread Anand Jain
extent_buffer_uptodate() is a trivial wrapper around test_bit()
and nothing else. So make it static and inline, save on code
space and call indirection.

Before:
   textdata bss dec hex filename
1131257   82898   18992 1233147  12d0fb fs/btrfs/btrfs.ko

After:
   textdata bss dec hex filename
1131090   82898   18992 1232980  12d054 fs/btrfs/btrfs.ko

Signed-off-by: Anand Jain 
---
 fs/btrfs/extent_io.c | 5 -
 fs/btrfs/extent_io.h | 5 -
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index bae57b408901..f300edae044b 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -5229,11 +5229,6 @@ void set_extent_buffer_uptodate(struct extent_buffer *eb)
}
 }
 
-int extent_buffer_uptodate(struct extent_buffer *eb)
-{
-   return test_bit(EXTENT_BUFFER_UPTODATE, >bflags);
-}
-
 int read_extent_buffer_pages(struct extent_io_tree *tree,
 struct extent_buffer *eb, int wait, int mirror_num)
 {
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index 72e5af2965a8..953d94662b8e 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -489,7 +489,10 @@ void clear_extent_buffer_dirty(struct extent_buffer *eb);
 int set_extent_buffer_dirty(struct extent_buffer *eb);
 void set_extent_buffer_uptodate(struct extent_buffer *eb);
 void clear_extent_buffer_uptodate(struct extent_buffer *eb);
-int extent_buffer_uptodate(struct extent_buffer *eb);
+static inline int extent_buffer_uptodate(struct extent_buffer *eb)
+{
+   return test_bit(EXTENT_BUFFER_UPTODATE, >bflags);
+}
 int extent_buffer_under_io(struct extent_buffer *eb);
 int map_private_extent_buffer(const struct extent_buffer *eb,
  unsigned long offset, unsigned long min_len,
-- 
2.15.0

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html