Re: [PATCH v2 48/63] fs/direct-io: Reduce the size of struct dio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed 29-06-22 16:31:30, Bart Van Assche wrote:
> Reduce the size of struct dio by combining the 'op' and 'op_flags' into
> the new 'opf' member. Use the new blk_opf_t type to improve static type
> checking. This patch does not change any functionality.
> 
> Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> Cc: Christoph Hellwig <hch@xxxxxx>
> Cc: Darrick J. Wong <djwong@xxxxxxxxxx>
> Cc: Jan Kara <jack@xxxxxxx>
> Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>

Just one nit below.

> diff --git a/fs/direct-io.c b/fs/direct-io.c
> index 840752006f60..b72706d163f5 100644
> --- a/fs/direct-io.c
> +++ b/fs/direct-io.c
> @@ -117,8 +117,7 @@ struct dio_submit {
>  /* dio_state communicated between submission path and end_io */
>  struct dio {
>  	int flags;			/* doesn't change */
> -	int op;
> -	int op_flags;
> +	blk_opf_t opf;			/* request operation type and flags */
>  	struct gendisk *bio_disk;
>  	struct inode *inode;
>  	loff_t i_size;			/* i_size when submitted */
> @@ -154,6 +153,11 @@ struct dio {
>  
>  static struct kmem_cache *dio_cache __read_mostly;
>  
> +static inline bool op_is_read(blk_opf_t opf)
> +{
> +	return !op_is_write(opf);
> +}
> +

This is a bit dangerous although currently OK for direct IO code. I'm just
afraid someone will extend direct IO code (unlikely) or copy-paste this to
a place where there can be more operations than read & write... Maybe just
add here a comment like /* Direct IO code does only reads or writes */.

Otherwise feel free to add:

Reviewed-by: Jan Kara <jack@xxxxxxx>

								Honza
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux