Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 277c5f27 authored by Nicholas Bellinger's avatar Nicholas Bellinger
Browse files

target: Convert to DIV_ROUND_UP_SECTOR_T usage for sectors / dev_max_sectors



This patch adds the new macro usage of include/linux/kernel.h:DIV_ROUND_UP_SECTOR_T
for the new DIV_ROUND_UP_ULL() usage for 32-bit architectures with unsigned long long
sector_t division in transport_allocate_data_tasks() usage for target_core_mod v4.1

Reported-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarNicholas A. Bellinger <nab@linux-iscsi.org>
parent 36a26c69
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -4052,16 +4052,15 @@ static int transport_allocate_data_tasks(
	struct se_task *task;
	struct se_device *dev = cmd->se_dev;
	unsigned long flags;
	sector_t sectors;
	int task_count, i, ret;
	sector_t dev_max_sectors = dev->se_sub_dev->se_dev_attrib.max_sectors;
	sector_t sectors, dev_max_sectors = dev->se_sub_dev->se_dev_attrib.max_sectors;
	u32 sector_size = dev->se_sub_dev->se_dev_attrib.block_size;
	struct scatterlist *sg;
	struct scatterlist *cmd_sg;

	WARN_ON(cmd->data_length % sector_size);
	sectors = DIV_ROUND_UP(cmd->data_length, sector_size);
	task_count = DIV_ROUND_UP(sectors, dev_max_sectors);
	task_count = DIV_ROUND_UP_SECTOR_T(sectors, dev_max_sectors);
	
	cmd_sg = sgl;
	for (i = 0; i < task_count; i++) {