Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: target: Add helper to set up atomic values from block_device

Add a helper function that sets up the atomic value based on a
block_device similar to what we do for unmap.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
jpg: Set atomic alignment, drop atomic_supported reference
Signed-off-by: John Garry <john.g.garry@oracle.com>
Link: https://patch.msgid.link/20251020103820.2917593-4-john.g.garry@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Mike Christie and committed by
Martin K. Petersen
c486634f d505447b

+19
+17
drivers/target/target_core_device.c
··· 840 840 return NULL; 841 841 } 842 842 843 + void target_configure_write_atomic_from_bdev(struct se_dev_attrib *attrib, 844 + struct block_device *bdev) 845 + { 846 + struct request_queue *q = bdev_get_queue(bdev); 847 + int block_size = bdev_logical_block_size(bdev); 848 + 849 + if (!bdev_can_atomic_write(bdev)) 850 + return; 851 + 852 + attrib->atomic_max_len = queue_atomic_write_max_bytes(q) / block_size; 853 + attrib->atomic_granularity = attrib->atomic_alignment = 854 + queue_atomic_write_unit_min_bytes(q) / block_size; 855 + attrib->atomic_max_with_boundary = 0; 856 + attrib->atomic_max_boundary = 0; 857 + } 858 + EXPORT_SYMBOL_GPL(target_configure_write_atomic_from_bdev); 859 + 843 860 /* 844 861 * Check if the underlying struct block_device supports discard and if yes 845 862 * configure the UNMAP parameters.
+2
include/target/target_core_backend.h
··· 123 123 sector_t target_to_linux_sector(struct se_device *dev, sector_t lb); 124 124 bool target_configure_unmap_from_bdev(struct se_dev_attrib *attrib, 125 125 struct block_device *bdev); 126 + void target_configure_write_atomic_from_bdev(struct se_dev_attrib *attrib, 127 + struct block_device *bdev); 126 128 127 129 static inline bool target_dev_configured(struct se_device *se_dev) 128 130 {