lkml.org 
[lkml]   [2022]   [Jul]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 11/20] block, blksnap: functions and structures for performing block I/O operations
    > +#define SECTORS_IN_PAGE (PAGE_SIZE / SECTOR_SIZE)

    This can use PAGE_SECTORS from blk_types.h

    > +
    > +struct bio_set diff_io_bioset = { 0 };

    No need to initialize global variables to 0.

    > + // Allocate both bios
    > + opf = diff_io->is_write ? REQ_OP_WRITE : REQ_OP_READ;
    > + gfp = GFP_NOIO | (is_nowait ? GFP_NOWAIT : 0);
    > +
    > + bio = bio_alloc_bioset(diff_region->bdev, nr_iovecs,
    > + opf | REQ_SYNC | REQ_IDLE | REQ_FUA,

    REQ_FUA on reads does not make sense.

    > + submit_bio_noacct(bio);
    > +
    > + // Submit flush bio
    > + bio_set_flag(flush_bio, BIO_FILTERED);
    > + flush_bio->bi_end_io = diff_io_endio;
    > + flush_bio->bi_private = diff_io;
    > + flush_bio->bi_iter.bi_sector = 0;
    > + submit_bio_noacct(flush_bio);

    And a separate flush for reads seems odd and probably wrong here.
    And for writes REQ_FUA already ensuresyour write went to disk.
    Do you also need to flush all previous data? In which case you
    probably want a single bio with REQ_PREFLUSH and REQ_FUA instead
    of submitting two separate bios here.

    \
     
     \ /
      Last update: 2022-07-07 19:35    [W:4.879 / U:0.108 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site