Yay! 😊 On Tue, Apr 8, 2025, 8:43 a.m. Stefan Hajnoczi <stefa...@redhat.com> wrote:
> On Mon, Apr 07, 2025 at 08:47:30AM -0700, Pinku Deb Nath wrote: > > Full Unit Access (FUA) is an optimization where a disk write with the > > flag set will be persisted to disk immediately instead of potentially > > remaining in the disk's write cache. > > > > This commit address the todo task > > for using pwritev2() with RWF_DSYNC in the thread pool section of > > raw_co_prw(), if pwritev2() with RWF_DSYNC is available in the host, > > which is always the case for Linux kernel >= 4.7. > > > > The intent for FUA is indicated with the BDRV_REQ_FUA flag. > > The old code paths are preserved in case BDRV_REQ_FUA is off > > or pwritev2() with RWF_DSYNC is not available. > > > > Support for disk writes with FUA is handled in qemu_pwritev_fua(), > > which uses pwritev2() with RWF_DSYNC if available, otherwise falls > > back to pwritev2() with no flags followed by flush using > > handle_aiocb_flush(). > > > > If pwritev2() is not implemented, then disk write in the linear FUA > > will fallback to pwrite() + handle_aiocb_flush(). > > > > Signed-off-by: Pinku Deb Nath <pranto...@gmail.com> > > > > --- > > > > v5: > > - Use pwritev for unsupported OSes > > > > v4: > > - Add fallback when qemu_pwritev_fua() returns ENOSYS > > - Similar fallback was not added for handle_aiocb_rw_vector() > > since there is a preadv_present check in handle_aiocb_rw() > > > > v3: > > - Changed signature to add fd, iov, nr_iov > > - Return -ENOSYS for non-Linux hosts > > > > v2: > > - Moved handle_aiocb_flush() into qemu_pwritev_fua() > > - In handle_aiocb_rw_linear(), iovec with iovcnt=1 is created > > based on the assumption that there will be only one buffer > > --- > > block/file-posix.c | 68 ++++++++++++++++++++++++++++++++++++++-------- > > 1 file changed, 56 insertions(+), 12 deletions(-) > > Reviewed-by: Stefan Hajnoczi <stefa...@redhat.com> >