Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bunge committed Oct 12, 2017
1 parent 00f5ba8 commit 5fc01c1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
6 changes: 5 additions & 1 deletion include/sys/compress_auto.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@

size_t compress_auto(zio_t *zio, abd_t *src, void *dst,
size_t s_len, enum zio_compress *c);
void compress_auto_calc_avg_without_zero(uint64_t act, uint64_t *res, int n);

void compress_calc_avg_without_zero(uint64_t act, uint64_t *res, int n);

uint64_t compress_calc_Bps(uint64_t byte, hrtime_t delay);


#endif /* _SYS_AUTO_COMPRESS_H */
4 changes: 2 additions & 2 deletions module/zfs/compress_auto.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ uint64_t compress_calc_Bps(uint64_t byte, hrtime_t delay)
return ((byte * transform) / delay);
}

void compress_auto_calc_avg_without_zero(uint64_t act, uint64_t *res, int n)
void compress_calc_avg_without_zero(uint64_t act, uint64_t *res, int n)
{
uint64_t prev = *res;
if (act) {
Expand Down Expand Up @@ -120,7 +120,7 @@ void compress_update_pio(uint64_t compressBps, uint8_t compress_level,
zio_t *pio)
{
int n = 10;
compress_auto_calc_avg_without_zero(compressBps,
compress_calc_avg_without_zero(compressBps,
&pio->io_compress_auto_Bps[compress_level], n);

if (pio->io_compress_auto_exploring) {
Expand Down
9 changes: 6 additions & 3 deletions module/zfs/vdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -3140,9 +3140,12 @@ vdev_stat_update(zio_t *zio, uint64_t psize)

if (zio->io_delta && zio->io_delay) {
int n = 1000; // average over 1000 zios
compress_auto_calc_avg_without_zero(
(trans * psize) / zio->io_delay,
&vsx->vsx_diskBps[type], n);

uint64_t bps = compress_calc_Bps(
psize, zio->io_delay);

compress_calc_avg_without_zero(
bps,&vsx->vsx_diskBps[type], n);

vsx->vsx_queue_histo[zio->io_priority]
[L_HISTO(zio->io_delta - zio->io_delay)]++;
Expand Down

0 comments on commit 5fc01c1

Please sign in to comment.