All of lore.kernel.org
 help / color / mirror / Atom feed
* trivial cleanups
@ 2025-01-06  9:50 Christoph Hellwig
  2025-01-06  9:50 ` [PATCH 1/3] xfs: mark xfs_dir_isempty static Christoph Hellwig
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Christoph Hellwig @ 2025-01-06  9:50 UTC (permalink / raw)
  To: Carlos Maiolino; +Cc: Darrick J. Wong, linux-xfs

Hi all,

this series has a few very trivial cleanups.

Diffstt:
 libxfs/xfs_dir2.c       |    6 +++---
 libxfs/xfs_dir2.h       |    1 -
 libxfs/xfs_log_format.h |    6 ------
 xfs_trans.c             |    2 --
 xfs_trans.h             |    1 -
 5 files changed, 3 insertions(+), 13 deletions(-)

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

* [PATCH 1/3] xfs: mark xfs_dir_isempty static
  2025-01-06  9:50 trivial cleanups Christoph Hellwig
@ 2025-01-06  9:50 ` Christoph Hellwig
  2025-01-06 17:07   ` Darrick J. Wong
  2025-01-06  9:50 ` [PATCH 2/3] xfs: remove XFS_ILOG_NONCORE Christoph Hellwig
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2025-01-06  9:50 UTC (permalink / raw)
  To: Carlos Maiolino; +Cc: Darrick J. Wong, linux-xfs

And return bool instead of a boolean condition as int.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/libxfs/xfs_dir2.c | 6 +++---
 fs/xfs/libxfs/xfs_dir2.h | 1 -
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/xfs/libxfs/xfs_dir2.c b/fs/xfs/libxfs/xfs_dir2.c
index 202468223bf9..81aaef2f495e 100644
--- a/fs/xfs/libxfs/xfs_dir2.c
+++ b/fs/xfs/libxfs/xfs_dir2.c
@@ -197,7 +197,7 @@ xfs_da_unmount(
 /*
  * Return 1 if directory contains only "." and "..".
  */
-int
+static bool
 xfs_dir_isempty(
 	xfs_inode_t	*dp)
 {
@@ -205,9 +205,9 @@ xfs_dir_isempty(
 
 	ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
 	if (dp->i_disk_size == 0)	/* might happen during shutdown. */
-		return 1;
+		return true;
 	if (dp->i_disk_size > xfs_inode_data_fork_size(dp))
-		return 0;
+		return false;
 	sfp = dp->i_df.if_data;
 	return !sfp->count;
 }
diff --git a/fs/xfs/libxfs/xfs_dir2.h b/fs/xfs/libxfs/xfs_dir2.h
index 576068ed81fa..a6594a5a941d 100644
--- a/fs/xfs/libxfs/xfs_dir2.h
+++ b/fs/xfs/libxfs/xfs_dir2.h
@@ -58,7 +58,6 @@ extern void xfs_dir_startup(void);
 extern int xfs_da_mount(struct xfs_mount *mp);
 extern void xfs_da_unmount(struct xfs_mount *mp);
 
-extern int xfs_dir_isempty(struct xfs_inode *dp);
 extern int xfs_dir_init(struct xfs_trans *tp, struct xfs_inode *dp,
 				struct xfs_inode *pdp);
 extern int xfs_dir_createname(struct xfs_trans *tp, struct xfs_inode *dp,
-- 
2.45.2


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

* [PATCH 2/3] xfs: remove XFS_ILOG_NONCORE
  2025-01-06  9:50 trivial cleanups Christoph Hellwig
  2025-01-06  9:50 ` [PATCH 1/3] xfs: mark xfs_dir_isempty static Christoph Hellwig
@ 2025-01-06  9:50 ` Christoph Hellwig
  2025-01-06 17:09   ` Darrick J. Wong
  2025-01-06  9:50 ` [PATCH 3/3] xfs: remove the t_magic field in struct xfs_trans Christoph Hellwig
  2025-01-14 10:30 ` trivial cleanups Carlos Maiolino
  3 siblings, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2025-01-06  9:50 UTC (permalink / raw)
  To: Carlos Maiolino; +Cc: Darrick J. Wong, linux-xfs

XFS_ILOG_NONCORE is not used in the kernel code or xfsprogs, remove it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/libxfs/xfs_log_format.h | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/fs/xfs/libxfs/xfs_log_format.h b/fs/xfs/libxfs/xfs_log_format.h
index 15dec19b6c32..41e974d17ce2 100644
--- a/fs/xfs/libxfs/xfs_log_format.h
+++ b/fs/xfs/libxfs/xfs_log_format.h
@@ -351,12 +351,6 @@ struct xfs_inode_log_format_32 {
  */
 #define XFS_ILOG_IVERSION	0x8000
 
-#define	XFS_ILOG_NONCORE	(XFS_ILOG_DDATA | XFS_ILOG_DEXT | \
-				 XFS_ILOG_DBROOT | XFS_ILOG_DEV | \
-				 XFS_ILOG_ADATA | XFS_ILOG_AEXT | \
-				 XFS_ILOG_ABROOT | XFS_ILOG_DOWNER | \
-				 XFS_ILOG_AOWNER)
-
 #define	XFS_ILOG_DFORK		(XFS_ILOG_DDATA | XFS_ILOG_DEXT | \
 				 XFS_ILOG_DBROOT)
 
-- 
2.45.2


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

* [PATCH 3/3] xfs: remove the t_magic field in struct xfs_trans
  2025-01-06  9:50 trivial cleanups Christoph Hellwig
  2025-01-06  9:50 ` [PATCH 1/3] xfs: mark xfs_dir_isempty static Christoph Hellwig
  2025-01-06  9:50 ` [PATCH 2/3] xfs: remove XFS_ILOG_NONCORE Christoph Hellwig
@ 2025-01-06  9:50 ` Christoph Hellwig
  2025-01-06 17:11   ` Darrick J. Wong
  2025-01-14 10:30 ` trivial cleanups Carlos Maiolino
  3 siblings, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2025-01-06  9:50 UTC (permalink / raw)
  To: Carlos Maiolino; +Cc: Darrick J. Wong, linux-xfs

The t_magic field is only ever assigned to, but never read.  Remove it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_trans.c | 2 --
 fs/xfs/xfs_trans.h | 1 -
 2 files changed, 3 deletions(-)

diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index 4cd25717c9d1..786fb659ee3f 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -100,7 +100,6 @@ xfs_trans_dup(
 	/*
 	 * Initialize the new transaction structure.
 	 */
-	ntp->t_magic = XFS_TRANS_HEADER_MAGIC;
 	ntp->t_mountp = tp->t_mountp;
 	INIT_LIST_HEAD(&ntp->t_items);
 	INIT_LIST_HEAD(&ntp->t_busy);
@@ -275,7 +274,6 @@ xfs_trans_alloc(
 	ASSERT(!(flags & XFS_TRANS_RES_FDBLKS) ||
 	       xfs_has_lazysbcount(mp));
 
-	tp->t_magic = XFS_TRANS_HEADER_MAGIC;
 	tp->t_flags = flags;
 	tp->t_mountp = mp;
 	INIT_LIST_HEAD(&tp->t_items);
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
index 71c2e82e4dad..2b366851e9a4 100644
--- a/fs/xfs/xfs_trans.h
+++ b/fs/xfs/xfs_trans.h
@@ -122,7 +122,6 @@ void	xfs_log_item_init(struct xfs_mount *mp, struct xfs_log_item *item,
  * This is the structure maintained for every active transaction.
  */
 typedef struct xfs_trans {
-	unsigned int		t_magic;	/* magic number */
 	unsigned int		t_log_res;	/* amt of log space resvd */
 	unsigned int		t_log_count;	/* count for perm log res */
 	unsigned int		t_blk_res;	/* # of blocks resvd */
-- 
2.45.2


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

* Re: [PATCH 1/3] xfs: mark xfs_dir_isempty static
  2025-01-06  9:50 ` [PATCH 1/3] xfs: mark xfs_dir_isempty static Christoph Hellwig
@ 2025-01-06 17:07   ` Darrick J. Wong
  0 siblings, 0 replies; 9+ messages in thread
From: Darrick J. Wong @ 2025-01-06 17:07 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Carlos Maiolino, linux-xfs

On Mon, Jan 06, 2025 at 10:50:29AM +0100, Christoph Hellwig wrote:
> And return bool instead of a boolean condition as int.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Nice and straightfoward, so
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  fs/xfs/libxfs/xfs_dir2.c | 6 +++---
>  fs/xfs/libxfs/xfs_dir2.h | 1 -
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_dir2.c b/fs/xfs/libxfs/xfs_dir2.c
> index 202468223bf9..81aaef2f495e 100644
> --- a/fs/xfs/libxfs/xfs_dir2.c
> +++ b/fs/xfs/libxfs/xfs_dir2.c
> @@ -197,7 +197,7 @@ xfs_da_unmount(
>  /*
>   * Return 1 if directory contains only "." and "..".
>   */
> -int
> +static bool
>  xfs_dir_isempty(
>  	xfs_inode_t	*dp)
>  {
> @@ -205,9 +205,9 @@ xfs_dir_isempty(
>  
>  	ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
>  	if (dp->i_disk_size == 0)	/* might happen during shutdown. */
> -		return 1;
> +		return true;
>  	if (dp->i_disk_size > xfs_inode_data_fork_size(dp))
> -		return 0;
> +		return false;
>  	sfp = dp->i_df.if_data;
>  	return !sfp->count;
>  }
> diff --git a/fs/xfs/libxfs/xfs_dir2.h b/fs/xfs/libxfs/xfs_dir2.h
> index 576068ed81fa..a6594a5a941d 100644
> --- a/fs/xfs/libxfs/xfs_dir2.h
> +++ b/fs/xfs/libxfs/xfs_dir2.h
> @@ -58,7 +58,6 @@ extern void xfs_dir_startup(void);
>  extern int xfs_da_mount(struct xfs_mount *mp);
>  extern void xfs_da_unmount(struct xfs_mount *mp);
>  
> -extern int xfs_dir_isempty(struct xfs_inode *dp);
>  extern int xfs_dir_init(struct xfs_trans *tp, struct xfs_inode *dp,
>  				struct xfs_inode *pdp);
>  extern int xfs_dir_createname(struct xfs_trans *tp, struct xfs_inode *dp,
> -- 
> 2.45.2
> 
> 

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

* Re: [PATCH 2/3] xfs: remove XFS_ILOG_NONCORE
  2025-01-06  9:50 ` [PATCH 2/3] xfs: remove XFS_ILOG_NONCORE Christoph Hellwig
@ 2025-01-06 17:09   ` Darrick J. Wong
  2025-01-06 18:10     ` Christoph Hellwig
  0 siblings, 1 reply; 9+ messages in thread
From: Darrick J. Wong @ 2025-01-06 17:09 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Carlos Maiolino, linux-xfs

On Mon, Jan 06, 2025 at 10:50:30AM +0100, Christoph Hellwig wrote:
> XFS_ILOG_NONCORE is not used in the kernel code or xfsprogs, remove it.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  fs/xfs/libxfs/xfs_log_format.h | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_log_format.h b/fs/xfs/libxfs/xfs_log_format.h
> index 15dec19b6c32..41e974d17ce2 100644
> --- a/fs/xfs/libxfs/xfs_log_format.h
> +++ b/fs/xfs/libxfs/xfs_log_format.h

Technically this is part of the userspace ABI:

$ grep NONCORE /usr/include/
/usr/include/xfs/xfs_log_format.h:362:#define   XFS_ILOG_NONCORE        (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \

But it makes no sense for userspace to try to use that symbol and
Debian codesearch says there are no users, so:

Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D


> @@ -351,12 +351,6 @@ struct xfs_inode_log_format_32 {
>   */
>  #define XFS_ILOG_IVERSION	0x8000
>  
> -#define	XFS_ILOG_NONCORE	(XFS_ILOG_DDATA | XFS_ILOG_DEXT | \
> -				 XFS_ILOG_DBROOT | XFS_ILOG_DEV | \
> -				 XFS_ILOG_ADATA | XFS_ILOG_AEXT | \
> -				 XFS_ILOG_ABROOT | XFS_ILOG_DOWNER | \
> -				 XFS_ILOG_AOWNER)
> -
>  #define	XFS_ILOG_DFORK		(XFS_ILOG_DDATA | XFS_ILOG_DEXT | \
>  				 XFS_ILOG_DBROOT)
>  
> -- 
> 2.45.2
> 
> 

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

* Re: [PATCH 3/3] xfs: remove the t_magic field in struct xfs_trans
  2025-01-06  9:50 ` [PATCH 3/3] xfs: remove the t_magic field in struct xfs_trans Christoph Hellwig
@ 2025-01-06 17:11   ` Darrick J. Wong
  0 siblings, 0 replies; 9+ messages in thread
From: Darrick J. Wong @ 2025-01-06 17:11 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Carlos Maiolino, linux-xfs

On Mon, Jan 06, 2025 at 10:50:31AM +0100, Christoph Hellwig wrote:
> The t_magic field is only ever assigned to, but never read.  Remove it.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

And it eliminates a 4-byte hole!

Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  fs/xfs/xfs_trans.c | 2 --
>  fs/xfs/xfs_trans.h | 1 -
>  2 files changed, 3 deletions(-)
> 
> diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
> index 4cd25717c9d1..786fb659ee3f 100644
> --- a/fs/xfs/xfs_trans.c
> +++ b/fs/xfs/xfs_trans.c
> @@ -100,7 +100,6 @@ xfs_trans_dup(
>  	/*
>  	 * Initialize the new transaction structure.
>  	 */
> -	ntp->t_magic = XFS_TRANS_HEADER_MAGIC;
>  	ntp->t_mountp = tp->t_mountp;
>  	INIT_LIST_HEAD(&ntp->t_items);
>  	INIT_LIST_HEAD(&ntp->t_busy);
> @@ -275,7 +274,6 @@ xfs_trans_alloc(
>  	ASSERT(!(flags & XFS_TRANS_RES_FDBLKS) ||
>  	       xfs_has_lazysbcount(mp));
>  
> -	tp->t_magic = XFS_TRANS_HEADER_MAGIC;
>  	tp->t_flags = flags;
>  	tp->t_mountp = mp;
>  	INIT_LIST_HEAD(&tp->t_items);
> diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
> index 71c2e82e4dad..2b366851e9a4 100644
> --- a/fs/xfs/xfs_trans.h
> +++ b/fs/xfs/xfs_trans.h
> @@ -122,7 +122,6 @@ void	xfs_log_item_init(struct xfs_mount *mp, struct xfs_log_item *item,
>   * This is the structure maintained for every active transaction.
>   */
>  typedef struct xfs_trans {
> -	unsigned int		t_magic;	/* magic number */
>  	unsigned int		t_log_res;	/* amt of log space resvd */
>  	unsigned int		t_log_count;	/* count for perm log res */
>  	unsigned int		t_blk_res;	/* # of blocks resvd */
> -- 
> 2.45.2
> 
> 

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

* Re: [PATCH 2/3] xfs: remove XFS_ILOG_NONCORE
  2025-01-06 17:09   ` Darrick J. Wong
@ 2025-01-06 18:10     ` Christoph Hellwig
  0 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2025-01-06 18:10 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Christoph Hellwig, Carlos Maiolino, linux-xfs

On Mon, Jan 06, 2025 at 09:09:53AM -0800, Darrick J. Wong wrote:
> > diff --git a/fs/xfs/libxfs/xfs_log_format.h b/fs/xfs/libxfs/xfs_log_format.h
> > index 15dec19b6c32..41e974d17ce2 100644
> > --- a/fs/xfs/libxfs/xfs_log_format.h
> > +++ b/fs/xfs/libxfs/xfs_log_format.h
> 
> Technically this is part of the userspace ABI:
> 
> $ grep NONCORE /usr/include/
> /usr/include/xfs/xfs_log_format.h:362:#define   XFS_ILOG_NONCORE        (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \
> 
> But it makes no sense for userspace to try to use that symbol and
> Debian codesearch says there are no users, so:

In the past we've done plenty of refactoring of the format headers.
Locking us out of that would be rather painful.


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

* Re: trivial cleanups
  2025-01-06  9:50 trivial cleanups Christoph Hellwig
                   ` (2 preceding siblings ...)
  2025-01-06  9:50 ` [PATCH 3/3] xfs: remove the t_magic field in struct xfs_trans Christoph Hellwig
@ 2025-01-14 10:30 ` Carlos Maiolino
  3 siblings, 0 replies; 9+ messages in thread
From: Carlos Maiolino @ 2025-01-14 10:30 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Darrick J. Wong, linux-xfs

On Mon, 06 Jan 2025 10:50:28 +0100, Christoph Hellwig wrote:
> this series has a few very trivial cleanups.
> 
> Diffstt:
>  libxfs/xfs_dir2.c       |    6 +++---
>  libxfs/xfs_dir2.h       |    1 -
>  libxfs/xfs_log_format.h |    6 ------
>  xfs_trans.c             |    2 --
>  xfs_trans.h             |    1 -
>  5 files changed, 3 insertions(+), 13 deletions(-)
> 
> [...]

Applied to for-next, thanks!

[1/3] xfs: mark xfs_dir_isempty static
      commit: 23ebf63925989adbe4c4277c8e9b04e0a37f6005
[2/3] xfs: remove XFS_ILOG_NONCORE
      commit: 415dee1e06da431f3d314641ceecb9018bb6fa53
[3/3] xfs: remove the t_magic field in struct xfs_trans
      commit: 471511d6ef7d00b40e65902ff47acfc194c6a952

Best regards,
-- 
Carlos Maiolino <cem@kernel.org>


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

end of thread, other threads:[~2025-01-14 10:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-06  9:50 trivial cleanups Christoph Hellwig
2025-01-06  9:50 ` [PATCH 1/3] xfs: mark xfs_dir_isempty static Christoph Hellwig
2025-01-06 17:07   ` Darrick J. Wong
2025-01-06  9:50 ` [PATCH 2/3] xfs: remove XFS_ILOG_NONCORE Christoph Hellwig
2025-01-06 17:09   ` Darrick J. Wong
2025-01-06 18:10     ` Christoph Hellwig
2025-01-06  9:50 ` [PATCH 3/3] xfs: remove the t_magic field in struct xfs_trans Christoph Hellwig
2025-01-06 17:11   ` Darrick J. Wong
2025-01-14 10:30 ` trivial cleanups Carlos Maiolino

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.