linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: Optimize memory usage in xattr
@ 2023-04-28 18:55 JunChao Sun
  2023-05-02  9:41 ` Jan Kara
  0 siblings, 1 reply; 3+ messages in thread
From: JunChao Sun @ 2023-04-28 18:55 UTC (permalink / raw)
  To: linux-ext4; +Cc: tytso, jack, JunChao Sun

Currently struct ext4_attr_info->in_inode use int, but the
value is only 0 or 1, so replace int with bool.

Signed-off-by: JunChao Sun <sunjunchao2870@gmail.com>
---
 fs/ext4/xattr.c | 8 ++++----
 fs/ext4/xattr.h | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 767454d..d57408c 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -1639,7 +1639,7 @@ static int ext4_xattr_set_entry(struct ext4_xattr_info *i,
 	struct ext4_xattr_entry *last, *next;
 	struct ext4_xattr_entry *here = s->here;
 	size_t min_offs = s->end - s->base, name_len = strlen(i->name);
-	int in_inode = i->in_inode;
+	bool in_inode = i->in_inode;
 	struct inode *old_ea_inode = NULL;
 	struct inode *new_ea_inode = NULL;
 	size_t old_size, new_size;
@@ -2354,7 +2354,7 @@ static struct buffer_head *ext4_xattr_get_block(struct inode *inode)
 		.name = name,
 		.value = value,
 		.value_len = value_len,
-		.in_inode = 0,
+		.in_inode = false,
 	};
 	struct ext4_xattr_ibody_find is = {
 		.s = { .not_found = -ENODATA, },
@@ -2441,7 +2441,7 @@ static struct buffer_head *ext4_xattr_get_block(struct inode *inode)
 		if (ext4_has_feature_ea_inode(inode->i_sb) &&
 		    (EXT4_XATTR_SIZE(i.value_len) >
 			EXT4_XATTR_MIN_LARGE_EA_SIZE(inode->i_sb->s_blocksize)))
-			i.in_inode = 1;
+			i.in_inode = true;
 retry_inode:
 		error = ext4_xattr_ibody_set(handle, inode, &i, &is);
 		if (!error && !bs.s.not_found) {
@@ -2467,7 +2467,7 @@ static struct buffer_head *ext4_xattr_get_block(struct inode *inode)
 				 */
 				if (ext4_has_feature_ea_inode(inode->i_sb) &&
 				    i.value_len && !i.in_inode) {
-					i.in_inode = 1;
+					i.in_inode = true;
 					goto retry_inode;
 				}
 			}
diff --git a/fs/ext4/xattr.h b/fs/ext4/xattr.h
index 824faf0..355d373 100644
--- a/fs/ext4/xattr.h
+++ b/fs/ext4/xattr.h
@@ -113,7 +113,7 @@ struct ext4_xattr_info {
 	const void *value;
 	size_t value_len;
 	int name_index;
-	int in_inode;
+	bool in_inode;
 };
 
 struct ext4_xattr_search {
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: Optimize memory usage in xattr
  2023-04-28 18:55 [PATCH] ext4: Optimize memory usage in xattr JunChao Sun
@ 2023-05-02  9:41 ` Jan Kara
  2023-05-15 12:06   ` JunChao Sun
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2023-05-02  9:41 UTC (permalink / raw)
  To: JunChao Sun; +Cc: linux-ext4, tytso, jack

On Fri 28-04-23 11:55:17, JunChao Sun wrote:
> Currently struct ext4_attr_info->in_inode use int, but the
> value is only 0 or 1, so replace int with bool.
> 
> Signed-off-by: JunChao Sun <sunjunchao2870@gmail.com>

Looks fine. Feel free to add:

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

								Honza

> ---
>  fs/ext4/xattr.c | 8 ++++----
>  fs/ext4/xattr.h | 2 +-
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
> index 767454d..d57408c 100644
> --- a/fs/ext4/xattr.c
> +++ b/fs/ext4/xattr.c
> @@ -1639,7 +1639,7 @@ static int ext4_xattr_set_entry(struct ext4_xattr_info *i,
>  	struct ext4_xattr_entry *last, *next;
>  	struct ext4_xattr_entry *here = s->here;
>  	size_t min_offs = s->end - s->base, name_len = strlen(i->name);
> -	int in_inode = i->in_inode;
> +	bool in_inode = i->in_inode;
>  	struct inode *old_ea_inode = NULL;
>  	struct inode *new_ea_inode = NULL;
>  	size_t old_size, new_size;
> @@ -2354,7 +2354,7 @@ static struct buffer_head *ext4_xattr_get_block(struct inode *inode)
>  		.name = name,
>  		.value = value,
>  		.value_len = value_len,
> -		.in_inode = 0,
> +		.in_inode = false,
>  	};
>  	struct ext4_xattr_ibody_find is = {
>  		.s = { .not_found = -ENODATA, },
> @@ -2441,7 +2441,7 @@ static struct buffer_head *ext4_xattr_get_block(struct inode *inode)
>  		if (ext4_has_feature_ea_inode(inode->i_sb) &&
>  		    (EXT4_XATTR_SIZE(i.value_len) >
>  			EXT4_XATTR_MIN_LARGE_EA_SIZE(inode->i_sb->s_blocksize)))
> -			i.in_inode = 1;
> +			i.in_inode = true;
>  retry_inode:
>  		error = ext4_xattr_ibody_set(handle, inode, &i, &is);
>  		if (!error && !bs.s.not_found) {
> @@ -2467,7 +2467,7 @@ static struct buffer_head *ext4_xattr_get_block(struct inode *inode)
>  				 */
>  				if (ext4_has_feature_ea_inode(inode->i_sb) &&
>  				    i.value_len && !i.in_inode) {
> -					i.in_inode = 1;
> +					i.in_inode = true;
>  					goto retry_inode;
>  				}
>  			}
> diff --git a/fs/ext4/xattr.h b/fs/ext4/xattr.h
> index 824faf0..355d373 100644
> --- a/fs/ext4/xattr.h
> +++ b/fs/ext4/xattr.h
> @@ -113,7 +113,7 @@ struct ext4_xattr_info {
>  	const void *value;
>  	size_t value_len;
>  	int name_index;
> -	int in_inode;
> +	bool in_inode;
>  };
>  
>  struct ext4_xattr_search {
> -- 
> 1.8.3.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: Optimize memory usage in xattr
  2023-05-02  9:41 ` Jan Kara
@ 2023-05-15 12:06   ` JunChao Sun
  0 siblings, 0 replies; 3+ messages in thread
From: JunChao Sun @ 2023-05-15 12:06 UTC (permalink / raw)
  To: Jan Kara; +Cc: linux-ext4, tytso

Friendly ping...

Jan Kara <jack@suse.cz> 于2023年5月2日周二 17:41写道:
>
> On Fri 28-04-23 11:55:17, JunChao Sun wrote:
> > Currently struct ext4_attr_info->in_inode use int, but the
> > value is only 0 or 1, so replace int with bool.
> >
> > Signed-off-by: JunChao Sun <sunjunchao2870@gmail.com>
>
> Looks fine. Feel free to add:
>
> Reviewed-by: Jan Kara <jack@suse.cz>
>
>                                                                 Honza
>
> > ---
> >  fs/ext4/xattr.c | 8 ++++----
> >  fs/ext4/xattr.h | 2 +-
> >  2 files changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
> > index 767454d..d57408c 100644
> > --- a/fs/ext4/xattr.c
> > +++ b/fs/ext4/xattr.c
> > @@ -1639,7 +1639,7 @@ static int ext4_xattr_set_entry(struct ext4_xattr_info *i,
> >       struct ext4_xattr_entry *last, *next;
> >       struct ext4_xattr_entry *here = s->here;
> >       size_t min_offs = s->end - s->base, name_len = strlen(i->name);
> > -     int in_inode = i->in_inode;
> > +     bool in_inode = i->in_inode;
> >       struct inode *old_ea_inode = NULL;
> >       struct inode *new_ea_inode = NULL;
> >       size_t old_size, new_size;
> > @@ -2354,7 +2354,7 @@ static struct buffer_head *ext4_xattr_get_block(struct inode *inode)
> >               .name = name,
> >               .value = value,
> >               .value_len = value_len,
> > -             .in_inode = 0,
> > +             .in_inode = false,
> >       };
> >       struct ext4_xattr_ibody_find is = {
> >               .s = { .not_found = -ENODATA, },
> > @@ -2441,7 +2441,7 @@ static struct buffer_head *ext4_xattr_get_block(struct inode *inode)
> >               if (ext4_has_feature_ea_inode(inode->i_sb) &&
> >                   (EXT4_XATTR_SIZE(i.value_len) >
> >                       EXT4_XATTR_MIN_LARGE_EA_SIZE(inode->i_sb->s_blocksize)))
> > -                     i.in_inode = 1;
> > +                     i.in_inode = true;
> >  retry_inode:
> >               error = ext4_xattr_ibody_set(handle, inode, &i, &is);
> >               if (!error && !bs.s.not_found) {
> > @@ -2467,7 +2467,7 @@ static struct buffer_head *ext4_xattr_get_block(struct inode *inode)
> >                                */
> >                               if (ext4_has_feature_ea_inode(inode->i_sb) &&
> >                                   i.value_len && !i.in_inode) {
> > -                                     i.in_inode = 1;
> > +                                     i.in_inode = true;
> >                                       goto retry_inode;
> >                               }
> >                       }
> > diff --git a/fs/ext4/xattr.h b/fs/ext4/xattr.h
> > index 824faf0..355d373 100644
> > --- a/fs/ext4/xattr.h
> > +++ b/fs/ext4/xattr.h
> > @@ -113,7 +113,7 @@ struct ext4_xattr_info {
> >       const void *value;
> >       size_t value_len;
> >       int name_index;
> > -     int in_inode;
> > +     bool in_inode;
> >  };
> >
> >  struct ext4_xattr_search {
> > --
> > 1.8.3.1
> >
> --
> Jan Kara <jack@suse.com>
> SUSE Labs, CR

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-05-15 12:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-28 18:55 [PATCH] ext4: Optimize memory usage in xattr JunChao Sun
2023-05-02  9:41 ` Jan Kara
2023-05-15 12:06   ` JunChao Sun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).