Commit cd598003 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

coredump: use bvec_set_page to initialize a bvec

Use the bvec_set_page helper to initialize a bvec.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20230203150634.3199647-15-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 220ae4a5
...@@ -840,11 +840,7 @@ static int __dump_skip(struct coredump_params *cprm, size_t nr) ...@@ -840,11 +840,7 @@ static int __dump_skip(struct coredump_params *cprm, size_t nr)
static int dump_emit_page(struct coredump_params *cprm, struct page *page) static int dump_emit_page(struct coredump_params *cprm, struct page *page)
{ {
struct bio_vec bvec = { struct bio_vec bvec;
.bv_page = page,
.bv_offset = 0,
.bv_len = PAGE_SIZE,
};
struct iov_iter iter; struct iov_iter iter;
struct file *file = cprm->file; struct file *file = cprm->file;
loff_t pos; loff_t pos;
...@@ -860,6 +856,7 @@ static int dump_emit_page(struct coredump_params *cprm, struct page *page) ...@@ -860,6 +856,7 @@ static int dump_emit_page(struct coredump_params *cprm, struct page *page)
if (dump_interrupted()) if (dump_interrupted())
return 0; return 0;
pos = file->f_pos; pos = file->f_pos;
bvec_set_page(&bvec, page, PAGE_SIZE, 0);
iov_iter_bvec(&iter, ITER_SOURCE, &bvec, 1, PAGE_SIZE); iov_iter_bvec(&iter, ITER_SOURCE, &bvec, 1, PAGE_SIZE);
n = __kernel_write_iter(cprm->file, &iter, &pos); n = __kernel_write_iter(cprm->file, &iter, &pos);
if (n != PAGE_SIZE) if (n != PAGE_SIZE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment