[dm-devel] [PATCH 1/3] block: add __bio_start_io_acct() to control start_time

Christoph Hellwig hch at infradead.org
Thu Jan 27 20:01:30 UTC 2022


> -static unsigned long __part_start_io_acct(struct block_device *part,
> -					  unsigned int sectors, unsigned int op)
> +static void __part_start_io_acct(struct block_device *part, unsigned int sectors,
> +				 unsigned int op, unsigned long start_time)

Please avoid the overly long line.

> +/**
> + * __bio_start_io_acct - start I/O accounting for bio based drivers
> + * @bio:	bio to start account for
> + * @start_time:	start time that should be passed back to bio_end_io_acct().
> + */
> +void __bio_start_io_acct(struct bio *bio, unsigned long start_time)

I'd name this something like bio_start_io_acct_time to be a little more
descriptive

> +	unsigned long now = READ_ONCE(jiffies);
> +	__bio_start_io_acct(bio, now);
> +	return now;

Plase add an empty line after the variable declaration.

>  }
>  EXPORT_SYMBOL_GPL(bio_start_io_acct);
>  
>  unsigned long disk_start_io_acct(struct gendisk *disk, unsigned int sectors,
>  				 unsigned int op)
>  {
> -	return __part_start_io_acct(disk->part0, sectors, op);
> +	unsigned long now = READ_ONCE(jiffies);
> +	__part_start_io_acct(disk->part0, sectors, op, now);
> +	return now;

I wonder if just returning the passed in time from __part_start_io_acct
wouldn't be a bit cleaner to avoid all the extra local variables.




More information about the dm-devel mailing list