Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

um: ubd: Introduce submit_request()

Just a clean-up patch to remove the open coded
variants and to ensure that all requests are submitted the
same way.

Signed-off-by: Richard Weinberger <richard@nod.at>

+19 -13
+19 -13
arch/um/drivers/ubd_kern.c
··· 1252 1252 io_req->op = UBD_FLUSH; 1253 1253 } 1254 1254 1255 + static bool submit_request(struct io_thread_req *io_req, struct ubd *dev) 1256 + { 1257 + int n = os_write_file(thread_fd, &io_req, 1258 + sizeof(io_req)); 1259 + if (n != sizeof(io_req)) { 1260 + if (n != -EAGAIN) 1261 + printk("write to io thread failed, " 1262 + "errno = %d\n", -n); 1263 + else if (list_empty(&dev->restart)) 1264 + list_add(&dev->restart, &restart); 1265 + 1266 + kfree(io_req); 1267 + return false; 1268 + } 1269 + return true; 1270 + } 1271 + 1255 1272 /* Called with dev->lock held */ 1256 1273 static void do_ubd_request(struct request_queue *q) 1257 1274 { 1258 1275 struct io_thread_req *io_req; 1259 1276 struct request *req; 1260 - int n; 1261 1277 1262 1278 while(1){ 1263 1279 struct ubd *dev = q->queuedata; ··· 1299 1283 return; 1300 1284 } 1301 1285 prepare_flush_request(req, io_req); 1302 - os_write_file(thread_fd, &io_req, 1303 - sizeof(struct io_thread_req *)); 1286 + submit_request(io_req, dev); 1304 1287 } 1305 1288 1306 1289 while(dev->start_sg < dev->end_sg){ ··· 1316 1301 (unsigned long long)dev->rq_pos << 9, 1317 1302 sg->offset, sg->length, sg_page(sg)); 1318 1303 1319 - n = os_write_file(thread_fd, &io_req, 1320 - sizeof(struct io_thread_req *)); 1321 - if(n != sizeof(struct io_thread_req *)){ 1322 - if(n != -EAGAIN) 1323 - printk("write to io thread failed, " 1324 - "errno = %d\n", -n); 1325 - else if(list_empty(&dev->restart)) 1326 - list_add(&dev->restart, &restart); 1327 - kfree(io_req); 1304 + if (submit_request(io_req, dev) == false) 1328 1305 return; 1329 - } 1330 1306 1331 1307 dev->rq_pos += sg->length >> 9; 1332 1308 dev->start_sg++;