Function report |
Source Code:fs\direct-io.c |
Create Date:2022-07-28 20:15:13 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:This is a library function for use by filesystem drivers
Proto:static inline ssize_t do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, struct block_device *bdev, struct iov_iter *iter, get_block_t get_block, dio_iodone_t end_io, dio_submit_t submit_io, int flags)
Type:ssize_t
Parameter:
Type | Parameter | Name |
---|---|---|
struct kiocb * | iocb | |
struct inode * | inode | |
struct block_device * | bdev | |
struct iov_iter * | iter | |
get_block_t | get_block | |
dio_iodone_t | end_io | |
dio_submit_t | submit_io | |
int | flags |
1152 | blocksize_mask = (1 << blkbits) - 1 |
1154 | count = iov_iter_count(iter) |
1158 | struct dio_submit sdio = {0, } |
1159 | struct buffer_head map_bh = {0, } |
1161 | align = offset | iov_iter_alignment(iter) |
1168 | If align & blocksize_mask Then |
1169 | If bdev Then blkbits = assumes size > 256 |
1171 | blocksize_mask = (1 << blkbits) - 1 |
1172 | If align & blocksize_mask Then Go to out |
1177 | If iov_iter_rw(iter) == generic data direction definitions && Not count Then Return 0 |
1180 | dio = kmem_cache_alloc(dio_cache, GFP_KERNEL) |
1191 | doesn't change = flags |
1192 | If doesn't change & DIO_LOCKING Then |
1193 | If iov_iter_rw(iter) == generic data direction definitions Then |
1212 | If iov_iter_rw(iter) == generic data direction definitions && offset >= _size when submitted Then |
1213 | If doesn't change & DIO_LOCKING Then inode_unlock(inode) |
1215 | kmem_cache_free(dio_cache, dio) |
1216 | retval = 0 |
1217 | Go to out |
1226 | If is_sync_kiocb(iocb) Then s IO async ? = false |
1230 | Else s IO async ? = true |
1234 | If iov_iter_rw(iter) == WRITE Then |
1235 | op = REQ_OP_WRITE |
1237 | If ki_flags & IOCB_NOWAIT Then op_flags |= REQ_NOWAIT |
1239 | Else |
1240 | op = REQ_OP_READ |
1242 | If ki_flags & IOCB_HIPRI Then op_flags |= REQ_HIPRI |
1249 | If s IO async ? && iov_iter_rw(iter) == WRITE Then |
1250 | retval = 0 |
1251 | If ki_flags & IOCB_DSYNC Then retval = dio_set_defer_completion(dio) |
1253 | Else if Not s_dio_done_wq Then |
1261 | If retval Then |
1266 | kmem_cache_free(dio_cache, dio) |
1267 | Go to out |
1276 | retval = 0 |
1277 | doesn't change = blkbits |
1278 | When we're using an alignment whichis finer than the filesystem's softblocksize, this specifies how muchfiner. blkfactor=2 means 1/4-blockalignment. Does not change = i_blkbits - blkbits |
1281 | lock mapping function = get_block |
1282 | IO completion function = end_io |
1283 | IO submition function = submit_io |
1284 | current final block in bio + 1 = -1 |
1290 | direct_io_worker() and bios = 1 |
1292 | pages should be dirtied = iter_is_iovec(iter) && iov_iter_rw(iter) == generic data direction definitions |
1294 | doesn't change = end >> blkbits |
1303 | approximate total IO pages += iov_iter_npages(iter, INT_MAX) |
1305 | blk_start_plug( & plug) |
1308 | If retval Then Release any resources in case of a failure |
1316 | retval = 0 |
1324 | If The page Then |
1327 | ret2 = Put cur_page under IO |
1331 | The page = NULL |
1336 | blk_finish_plug( & plug) |
1349 | If iov_iter_rw(iter) == generic data direction definitions && doesn't change & DIO_LOCKING Then inode_unlock(inode) |
1359 | BUG_ON(retval == - cb queued, will get completion event ) |
1360 | If s IO async ? && retval == 0 && IO result && ( iov_iter_rw(iter) == generic data direction definitions || IO result == count ) Then retval = -cb queued, will get completion event |
1363 | Else Wait on and process all in-flight BIOs |
1366 | If drop_refcount(dio) == 0 Then |
1368 | Else BUG_ON(retval != - cb queued, will get completion event ) |
1371 | out : |
1372 | Return retval |
Name | Describe |
---|---|
__blockdev_direct_IO |
Source code conversion tool public plug-in interface | X |
---|---|
Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |