diff mbox series

[50/51] fs/xfs: Use the enum req_op and blk_opf_t types

Message ID 20220623180528.3595304-51-bvanassche@acm.org (mailing list archive)
State New, archived
Headers show
Series Improve static type checking for request flags | expand

Commit Message

Bart Van Assche June 23, 2022, 6:05 p.m. UTC
Improve static type checking by using the enum req_op type for variables
that represent a request operation and the new blk_opf_t type for the
combination of a request operation with request flags.

Cc: Darrick J. Wong <djwong@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 fs/xfs/xfs_bio_io.c      | 2 +-
 fs/xfs/xfs_buf.c         | 4 ++--
 fs/xfs/xfs_linux.h       | 2 +-
 fs/xfs/xfs_log_recover.c | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

Comments

Darrick J. Wong June 25, 2022, 3:23 a.m. UTC | #1
[+linux-xfs]

On Thu, Jun 23, 2022 at 11:05:27AM -0700, Bart Van Assche wrote:
> Improve static type checking by using the enum req_op type for variables
> that represent a request operation and the new blk_opf_t type for the
> combination of a request operation with request flags.
> 
> Cc: Darrick J. Wong <djwong@kernel.org>
> Cc: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>

Looks good to me, though I had to dig around to find out what these new
types were.

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

--D

> ---
>  fs/xfs/xfs_bio_io.c      | 2 +-
>  fs/xfs/xfs_buf.c         | 4 ++--
>  fs/xfs/xfs_linux.h       | 2 +-
>  fs/xfs/xfs_log_recover.c | 2 +-
>  4 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/xfs/xfs_bio_io.c b/fs/xfs/xfs_bio_io.c
> index ae4345b37621..fe21c76f75b8 100644
> --- a/fs/xfs/xfs_bio_io.c
> +++ b/fs/xfs/xfs_bio_io.c
> @@ -15,7 +15,7 @@ xfs_rw_bdev(
>  	sector_t		sector,
>  	unsigned int		count,
>  	char			*data,
> -	unsigned int		op)
> +	enum req_op		op)
>  
>  {
>  	unsigned int		is_vmalloc = is_vmalloc_addr(data);
> diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> index bf4e60871068..5e8f40d8c052 100644
> --- a/fs/xfs/xfs_buf.c
> +++ b/fs/xfs/xfs_buf.c
> @@ -1416,7 +1416,7 @@ xfs_buf_ioapply_map(
>  	int		map,
>  	int		*buf_offset,
>  	int		*count,
> -	int		op)
> +	blk_opf_t	op)
>  {
>  	int		page_index;
>  	unsigned int	total_nr_pages = bp->b_page_count;
> @@ -1493,7 +1493,7 @@ _xfs_buf_ioapply(
>  	struct xfs_buf	*bp)
>  {
>  	struct blk_plug	plug;
> -	int		op;
> +	blk_opf_t	op;
>  	int		offset;
>  	int		size;
>  	int		i;
> diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
> index cb9105d667db..f9878021e7d0 100644
> --- a/fs/xfs/xfs_linux.h
> +++ b/fs/xfs/xfs_linux.h
> @@ -196,7 +196,7 @@ static inline uint64_t howmany_64(uint64_t x, uint32_t y)
>  }
>  
>  int xfs_rw_bdev(struct block_device *bdev, sector_t sector, unsigned int count,
> -		char *data, unsigned int op);
> +		char *data, enum req_op op);
>  
>  #define ASSERT_ALWAYS(expr)	\
>  	(likely(expr) ? (void)0 : assfail(NULL, #expr, __FILE__, __LINE__))
> diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
> index 5f7e4e6e33ce..940c8107cbd4 100644
> --- a/fs/xfs/xfs_log_recover.c
> +++ b/fs/xfs/xfs_log_recover.c
> @@ -122,7 +122,7 @@ xlog_do_io(
>  	xfs_daddr_t		blk_no,
>  	unsigned int		nbblks,
>  	char			*data,
> -	unsigned int		op)
> +	enum req_op		op)
>  {
>  	int			error;
>
diff mbox series

Patch

diff --git a/fs/xfs/xfs_bio_io.c b/fs/xfs/xfs_bio_io.c
index ae4345b37621..fe21c76f75b8 100644
--- a/fs/xfs/xfs_bio_io.c
+++ b/fs/xfs/xfs_bio_io.c
@@ -15,7 +15,7 @@  xfs_rw_bdev(
 	sector_t		sector,
 	unsigned int		count,
 	char			*data,
-	unsigned int		op)
+	enum req_op		op)
 
 {
 	unsigned int		is_vmalloc = is_vmalloc_addr(data);
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index bf4e60871068..5e8f40d8c052 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -1416,7 +1416,7 @@  xfs_buf_ioapply_map(
 	int		map,
 	int		*buf_offset,
 	int		*count,
-	int		op)
+	blk_opf_t	op)
 {
 	int		page_index;
 	unsigned int	total_nr_pages = bp->b_page_count;
@@ -1493,7 +1493,7 @@  _xfs_buf_ioapply(
 	struct xfs_buf	*bp)
 {
 	struct blk_plug	plug;
-	int		op;
+	blk_opf_t	op;
 	int		offset;
 	int		size;
 	int		i;
diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
index cb9105d667db..f9878021e7d0 100644
--- a/fs/xfs/xfs_linux.h
+++ b/fs/xfs/xfs_linux.h
@@ -196,7 +196,7 @@  static inline uint64_t howmany_64(uint64_t x, uint32_t y)
 }
 
 int xfs_rw_bdev(struct block_device *bdev, sector_t sector, unsigned int count,
-		char *data, unsigned int op);
+		char *data, enum req_op op);
 
 #define ASSERT_ALWAYS(expr)	\
 	(likely(expr) ? (void)0 : assfail(NULL, #expr, __FILE__, __LINE__))
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 5f7e4e6e33ce..940c8107cbd4 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -122,7 +122,7 @@  xlog_do_io(
 	xfs_daddr_t		blk_no,
 	unsigned int		nbblks,
 	char			*data,
-	unsigned int		op)
+	enum req_op		op)
 {
 	int			error;