* Attempt to initiate asynchronous I/O on read-ahead blocks. We must * clear BIO_ERROR and B_INVAL prior to initiating I/O . If B_CACHE is set, * the buffer is valid and we do not have to do anything. */
| 2089 | * the buffer is valid and we do not have to do anything. |
| 2090 | */ |
| 2091 | static void |
| 2092 | breada(struct vnode * vp, daddr_t * rablkno, int * rabsize, int cnt, |
| 2093 | struct ucred * cred, int flags, void (*ckhashfunc)(struct buf *)) |
| 2094 | { |
| 2095 | struct buf *rabp; |
| 2096 | struct thread *td; |
| 2097 | int i; |
| 2098 | |
| 2099 | td = curthread; |
| 2100 | |
| 2101 | for (i = 0; i < cnt; i++, rablkno++, rabsize++) { |
| 2102 | if (inmem(vp, *rablkno)) |
| 2103 | continue; |
| 2104 | rabp = getblk(vp, *rablkno, *rabsize, 0, 0, 0); |
| 2105 | if ((rabp->b_flags & B_CACHE) != 0) { |
| 2106 | brelse(rabp); |
| 2107 | continue; |
| 2108 | } |
| 2109 | #ifdef RACCT |
| 2110 | if (racct_enable) { |
| 2111 | PROC_LOCK(curproc); |
| 2112 | racct_add_buf(curproc, rabp, 0); |
| 2113 | PROC_UNLOCK(curproc); |
| 2114 | } |
| 2115 | #endif /* RACCT */ |
| 2116 | td->td_ru.ru_inblock++; |
| 2117 | rabp->b_flags |= B_ASYNC; |
| 2118 | rabp->b_flags &= ~B_INVAL; |
| 2119 | if ((flags & GB_CKHASH) != 0) { |
| 2120 | rabp->b_flags |= B_CKHASH; |
| 2121 | rabp->b_ckhashcalc = ckhashfunc; |
| 2122 | } |
| 2123 | rabp->b_ioflags &= ~BIO_ERROR; |
| 2124 | rabp->b_iocmd = BIO_READ; |
| 2125 | if (rabp->b_rcred == NOCRED && cred != NOCRED) |
| 2126 | rabp->b_rcred = crhold(cred); |
| 2127 | vfs_busy_pages(rabp, 0); |
| 2128 | BUF_KERNPROC(rabp); |
| 2129 | rabp->b_iooffset = dbtob(rabp->b_blkno); |
| 2130 | bstrategy(rabp); |
| 2131 | } |
| 2132 | } |
| 2133 | |
| 2134 | /* |
| 2135 | * Entry point for bread() and breadn() via #defines in sys/buf.h. |
no test coverage detected