c - Linux aio_write is very slow in btrfs, almost reduced by 60% rate. Do someone know the reason? -


here code:

// init int total; struct aiocb aio; bzero((char *)&aio, sizeof(struct aiocb)); aio.aio_buf = malloc(buf_max1+1); aio.aio_nbytes = buf_max1; aio.aio_fildes = write_file; aio.aio_offset = 0;  int ret; while (total <= 900008200){   // 858mb      ret = aio_write(&aio);     assert(ret >= 0);      while ((ret = aio_error(&aio)) == einprogress);     assert(ret == 0);      int n;     if ((n = aio_return(&aio)) > 0) {         total += n;         aio.aio_offset += n;     } else {         assert(0);     } } 

when run in ext4 filesystem, got results "total(900008200) time(12.63s)"

in btr filesystem result "total(900008200) time(27.42s)"


Comments