Re:[PATCH v3 10/15] block: Add fops atomic write support

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

 



>+static bool blkdev_atomic_write_valid(struct block_device *bdev, loff_t pos,
>+				      struct iov_iter *iter)
>+{
>+	struct request_queue *q = bdev_get_queue(bdev);
>+	unsigned int min_bytes = queue_atomic_write_unit_min_bytes(q);
>+	unsigned int max_bytes = queue_atomic_write_unit_max_bytes(q);
>+
>+	if (!iter_is_ubuf(iter))
>+		return false;
>+	if (iov_iter_count(iter) & (min_bytes - 1))
>+		return false;
>+	if (!is_power_of_2(iov_iter_count(iter)))
>+		return false;
>+	if (pos & (iov_iter_count(iter) - 1))
>+		return false;
>+	if (iov_iter_count(iter) > max_bytes)
>+		return false;
>+	return true;
>+}

Here do we need to also validate whether the IO doesn't straddle 
the atmic bondary limit (if it's non-zero)? We do check that IO 
doesn't straddle the atomic boundary limit but that happens very 
late in the IO code path either during blk-merge or in NVMe driver 
code.

Thanks,
--Nilay





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux