blk-map.c (3310eebafe6f9a872c1f757b3d822dafae9c0cd8) blk-map.c (0385971754f0aa0507ecd7f0a0f4a48781906eda)
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>

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

143 return -ENOMEM;
144
145 /*
146 * We need to do a deep copy of the iov_iter including the iovecs.
147 * The caller provided iov might point to an on-stack or otherwise
148 * shortlived one.
149 */
150 bmd->is_our_pages = !map_data;
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>

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

143 return -ENOMEM;
144
145 /*
146 * We need to do a deep copy of the iov_iter including the iovecs.
147 * The caller provided iov might point to an on-stack or otherwise
148 * shortlived one.
149 */
150 bmd->is_our_pages = !map_data;
151 bmd->is_null_mapped = (map_data && map_data->null_mapped);
151
152 nr_pages = DIV_ROUND_UP(offset + len, PAGE_SIZE);
153 if (nr_pages > BIO_MAX_PAGES)
154 nr_pages = BIO_MAX_PAGES;
155
156 ret = -ENOMEM;
157 bio = bio_kmalloc(gfp_mask, nr_pages);
158 if (!bio)

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

213 goto cleanup;
214 } else {
215 if (bmd->is_our_pages)
216 zero_fill_bio(bio);
217 iov_iter_advance(iter, bio->bi_iter.bi_size);
218 }
219
220 bio->bi_private = bmd;
152
153 nr_pages = DIV_ROUND_UP(offset + len, PAGE_SIZE);
154 if (nr_pages > BIO_MAX_PAGES)
155 nr_pages = BIO_MAX_PAGES;
156
157 ret = -ENOMEM;
158 bio = bio_kmalloc(gfp_mask, nr_pages);
159 if (!bio)

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

214 goto cleanup;
215 } else {
216 if (bmd->is_our_pages)
217 zero_fill_bio(bio);
218 iov_iter_advance(iter, bio->bi_iter.bi_size);
219 }
220
221 bio->bi_private = bmd;
221 if (map_data && map_data->null_mapped)
222 bmd->is_null_mapped = true;
223
224 bounce_bio = bio;
225 ret = blk_rq_append_bio(rq, &bounce_bio);
226 if (ret)
227 goto cleanup;
228
229 /*
230 * We link the bounce buffer in and could have to traverse it later, so

--- 489 unchanged lines hidden ---
222
223 bounce_bio = bio;
224 ret = blk_rq_append_bio(rq, &bounce_bio);
225 if (ret)
226 goto cleanup;
227
228 /*
229 * We link the bounce buffer in and could have to traverse it later, so

--- 489 unchanged lines hidden ---