[axboe-block:nvme-passthru-wip 14/19] drivers/nvme/host/ioctl.c:158:5: warning: no previous prototype for function 'nvme_rq_map_user_fixedb'
From: kernel test robot
Date: Thu Oct 07 2021 - 21:07:19 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git nvme-passthru-wip
head: 9c18980ac90053bcdb21594eae48935d89bf389c
commit: 2e6a09df7c3f2f4161b9d6aa691f2801b2428eae [14/19] nvme: enable passthrough with fixed-buffer
config: hexagon-randconfig-r045-20211007 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 58b68e70ebf6308f982426a2618782f473218eed)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git/commit/?id=2e6a09df7c3f2f4161b9d6aa691f2801b2428eae
git remote add axboe-block https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git
git fetch --no-tags axboe-block nvme-passthru-wip
git checkout 2e6a09df7c3f2f4161b9d6aa691f2801b2428eae
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=hexagon
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
>> drivers/nvme/host/ioctl.c:158:5: warning: no previous prototype for function 'nvme_rq_map_user_fixedb' [-Wmissing-prototypes]
int nvme_rq_map_user_fixedb(struct request_queue *q, struct request *rq,
^
drivers/nvme/host/ioctl.c:158:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int nvme_rq_map_user_fixedb(struct request_queue *q, struct request *rq,
^
static
1 warning generated.
vim +/nvme_rq_map_user_fixedb +158 drivers/nvme/host/ioctl.c
108
109 static void *nvme_add_user_metadata(struct bio *bio, void __user *ubuf,
110 unsigned len, u32 seed, bool write)
111 {
112 struct bio_integrity_payload *bip;
113 int ret = -ENOMEM;
114 void *buf;
115
116 buf = kmalloc(len, GFP_KERNEL);
117 if (!buf)
118 goto out;
119
120 ret = -EFAULT;
121 if (write && copy_from_user(buf, ubuf, len))
122 goto out_free_meta;
123
124 bip = bio_integrity_alloc(bio, GFP_KERNEL, 1);
125 if (IS_ERR(bip)) {
126 ret = PTR_ERR(bip);
127 goto out_free_meta;
128 }
129
130 bip->bip_iter.bi_size = len;
131 bip->bip_iter.bi_sector = seed;
132 ret = bio_integrity_add_page(bio, virt_to_page(buf), len,
133 offset_in_page(buf));
134 if (ret == len)
135 return buf;
136 ret = -ENOMEM;
137 out_free_meta:
138 kfree(buf);
139 out:
140 return ERR_PTR(ret);
141 }
142 static inline bool nvme_is_fixedb_passthru(struct io_uring_cmd *ioucmd)
143 {
144 struct block_uring_cmd *bcmd;
145
146 if (!ioucmd)
147 return false;
148 bcmd = (struct block_uring_cmd *)&ioucmd->pdu;
149 if (bcmd && ((bcmd->ioctl_cmd == NVME_IOCTL_IO_CMD_FIXED) ||
150 (bcmd->ioctl_cmd == NVME_IOCTL_IO64_CMD_FIXED)))
151 return true;
152 return false;
153 }
154 /*
155 * Unlike blk_rq_map_user () this is only for fixed-buffer async passthrough.
156 * And hopefully faster as well.
157 */
> 158 int nvme_rq_map_user_fixedb(struct request_queue *q, struct request *rq,
159 void __user *ubuf, unsigned long len, gfp_t gfp_mask,
160 struct io_uring_cmd *ioucmd)
161 {
162 struct iov_iter iter;
163 size_t iter_count, nr_segs;
164 struct bio *bio;
165 int ret;
166
167 /*
168 * Talk to io_uring to obtain BVEC iterator for the buffer.
169 * And use that iterator to form bio/request.
170 */
171 ret = io_uring_cmd_import_fixed(ubuf, len, rq_data_dir(rq), &iter,
172 ioucmd);
173 if (unlikely(ret < 0))
174 return ret;
175 iter_count = iov_iter_count(&iter);
176 nr_segs = iter.nr_segs;
177
178 if (!iter_count || (iter_count >> 9) > queue_max_hw_sectors(q))
179 return -EINVAL;
180 if (nr_segs > queue_max_segments(q))
181 return -EINVAL;
182 /* no iovecs to alloc, as we already have a BVEC iterator */
183 bio = bio_kmalloc(gfp_mask, 0);
184 if (!bio)
185 return -ENOMEM;
186
187 bio->bi_opf |= req_op(rq);
188 ret = bio_iov_iter_get_pages(bio, &iter);
189 if (ret)
190 goto out_free;
191
192 blk_rq_bio_prep(rq, bio, nr_segs);
193 return 0;
194
195 out_free:
196 bio_release_pages(bio, false);
197 bio_put(bio);
198 return ret;
199 }
200
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip