diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2012-11-15 10:34:22 +0000 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2012-11-15 10:34:22 +0000 |
commit | da63d20bfb12827dd7747a841ea27348af3abc0a (patch) | |
tree | ba275a74d068f91b453c08b9bacf8afe9577db9b /drivers/target/target_core_device.c | |
parent | of: Add vendor prefix for ON Semiconductor Corp. (diff) | |
parent | Linux 3.7-rc5 (diff) | |
download | linux-dev-da63d20bfb12827dd7747a841ea27348af3abc0a.tar.xz linux-dev-da63d20bfb12827dd7747a841ea27348af3abc0a.zip |
Merge tag 'v3.7-rc5' into devicetree/next
Linux 3.7-rc5
Diffstat (limited to 'drivers/target/target_core_device.c')
-rw-r--r-- | drivers/target/target_core_device.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 8d774da16320..9abef9f8eb76 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -850,20 +850,20 @@ int se_dev_check_shutdown(struct se_device *dev) static u32 se_dev_align_max_sectors(u32 max_sectors, u32 block_size) { - u32 tmp, aligned_max_sectors; + u32 aligned_max_sectors; + u32 alignment; /* * Limit max_sectors to a PAGE_SIZE aligned value for modern * transport_allocate_data_tasks() operation. */ - tmp = rounddown((max_sectors * block_size), PAGE_SIZE); - aligned_max_sectors = (tmp / block_size); - if (max_sectors != aligned_max_sectors) { - printk(KERN_INFO "Rounding down aligned max_sectors from %u" - " to %u\n", max_sectors, aligned_max_sectors); - return aligned_max_sectors; - } + alignment = max(1ul, PAGE_SIZE / block_size); + aligned_max_sectors = rounddown(max_sectors, alignment); + + if (max_sectors != aligned_max_sectors) + pr_info("Rounding down aligned max_sectors from %u to %u\n", + max_sectors, aligned_max_sectors); - return max_sectors; + return aligned_max_sectors; } void se_dev_set_default_attribs( |