Re: [PATCH 11/20] block, blksnap: functions and structures for performing block I/O operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> +#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.



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux