Loading drivers/block/loop.c +14 −4 Original line number Diff line number Diff line Loading @@ -337,6 +337,19 @@ static void lo_rw_aio_complete(struct kiocb *iocb, long ret) lo_rw_aio_do_completion(cmd); } static inline unsigned lo_cmd_nr_bvec(struct loop_cmd *cmd) { struct request *rq = blk_mq_rq_from_pdu(cmd); struct req_iterator rq_iter; struct bio_vec tmp; int nr_bvec = 0; rq_for_each_bvec(tmp, rq, rq_iter) nr_bvec++; return nr_bvec; } static int lo_rw_aio(struct loop_device *lo, struct loop_cmd *cmd, loff_t pos, int rw) { Loading @@ -348,12 +361,9 @@ static int lo_rw_aio(struct loop_device *lo, struct loop_cmd *cmd, struct file *file = lo->lo_backing_file; struct bio_vec tmp; unsigned int offset; int nr_bvec = 0; int nr_bvec = lo_cmd_nr_bvec(cmd); int ret; rq_for_each_bvec(tmp, rq, rq_iter) nr_bvec++; if (rq->bio != rq->biotail) { bvec = kmalloc_array(nr_bvec, sizeof(struct bio_vec), Loading Loading
drivers/block/loop.c +14 −4 Original line number Diff line number Diff line Loading @@ -337,6 +337,19 @@ static void lo_rw_aio_complete(struct kiocb *iocb, long ret) lo_rw_aio_do_completion(cmd); } static inline unsigned lo_cmd_nr_bvec(struct loop_cmd *cmd) { struct request *rq = blk_mq_rq_from_pdu(cmd); struct req_iterator rq_iter; struct bio_vec tmp; int nr_bvec = 0; rq_for_each_bvec(tmp, rq, rq_iter) nr_bvec++; return nr_bvec; } static int lo_rw_aio(struct loop_device *lo, struct loop_cmd *cmd, loff_t pos, int rw) { Loading @@ -348,12 +361,9 @@ static int lo_rw_aio(struct loop_device *lo, struct loop_cmd *cmd, struct file *file = lo->lo_backing_file; struct bio_vec tmp; unsigned int offset; int nr_bvec = 0; int nr_bvec = lo_cmd_nr_bvec(cmd); int ret; rq_for_each_bvec(tmp, rq, rq_iter) nr_bvec++; if (rq->bio != rq->biotail) { bvec = kmalloc_array(nr_bvec, sizeof(struct bio_vec), Loading