blk-map.c (066ff571011d8416e903d3d4f1f41e0b5eb91e1d) blk-map.c (7ab89db979017255c2163880de5c63d8c9726aef)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Functions related to mapping data to requests
4 */
5#include <linux/kernel.h>
6#include <linux/sched/task_stack.h>
7#include <linux/module.h>
8#include <linux/bio.h>

--- 248 unchanged lines hidden (view full) ---

257 bytes = iov_iter_get_pages_alloc(iter, &pages, LONG_MAX, &offs);
258 if (unlikely(bytes <= 0)) {
259 ret = bytes ? bytes : -EFAULT;
260 goto out_unmap;
261 }
262
263 npages = DIV_ROUND_UP(offs + bytes, PAGE_SIZE);
264
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Functions related to mapping data to requests
4 */
5#include <linux/kernel.h>
6#include <linux/sched/task_stack.h>
7#include <linux/module.h>
8#include <linux/bio.h>

--- 248 unchanged lines hidden (view full) ---

257 bytes = iov_iter_get_pages_alloc(iter, &pages, LONG_MAX, &offs);
258 if (unlikely(bytes <= 0)) {
259 ret = bytes ? bytes : -EFAULT;
260 goto out_unmap;
261 }
262
263 npages = DIV_ROUND_UP(offs + bytes, PAGE_SIZE);
264
265 if (unlikely(offs & queue_dma_alignment(rq->q))) {
266 ret = -EINVAL;
265 if (unlikely(offs & queue_dma_alignment(rq->q)))
267 j = 0;
266 j = 0;
268 } else {
267 else {
269 for (j = 0; j < npages; j++) {
270 struct page *page = pages[j];
271 unsigned int n = PAGE_SIZE - offs;
272 bool same_page = false;
273
274 if (n > bytes)
275 n = bytes;
276

--- 391 unchanged lines hidden ---
268 for (j = 0; j < npages; j++) {
269 struct page *page = pages[j];
270 unsigned int n = PAGE_SIZE - offs;
271 bool same_page = false;
272
273 if (n > bytes)
274 n = bytes;
275

--- 391 unchanged lines hidden ---