> +static const unsigned int rwf_write_to_opf_flag[] = {
> +     0, REQ_WRITE_SHORT, REQ_WRITE_MEDIUM, REQ_WRITE_LONG, REQ_WRITE_EXTREME
> +};



> +
> +/*
> + * 'stream_flags' is one of RWF_WRITE_LIFE_* values
> + */
> +void bio_set_streamid(struct bio *bio, unsigned int rwf_flags)
> +{
> +     if (WARN_ON_ONCE(rwf_flags >= ARRAY_SIZE(rwf_write_to_opf_flag)))
> +             return;
> +
> +     bio->bi_opf |= rwf_write_to_opf_flag[rwf_flags];
> +}
> +EXPORT_SYMBOL_GPL(bio_set_streamid);

I'd move the bio->bi_opf assignment outş for a call like:

        bio->bi_opf |= bio_op_write_bucket(flags);

and preferably move the flags masking / shifting into the helper as
well.

>  };
>  
> +static inline bool blk_stream_valid(unsigned int opf)
> +{
> +     return (opf & REQ_WRITE_LIFE_MASK) != 0;
> +}

Replace the stream name here with lifetime or similar as well?

Reply via email to