1 1.27 oster /* $NetBSD: rf_reconbuffer.c,v 1.27 2021/07/23 00:54:45 oster Exp $ */ 2 1.1 oster /* 3 1.1 oster * Copyright (c) 1995 Carnegie-Mellon University. 4 1.1 oster * All rights reserved. 5 1.1 oster * 6 1.1 oster * Author: Mark Holland 7 1.1 oster * 8 1.1 oster * Permission to use, copy, modify and distribute this software and 9 1.1 oster * its documentation is hereby granted, provided that both the copyright 10 1.1 oster * notice and this permission notice appear in all copies of the 11 1.1 oster * software, derivative works or modified versions, and any portions 12 1.1 oster * thereof, and that both notices appear in supporting documentation. 13 1.1 oster * 14 1.1 oster * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 15 1.1 oster * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 16 1.1 oster * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 17 1.1 oster * 18 1.1 oster * Carnegie Mellon requests users of this software to return to 19 1.1 oster * 20 1.1 oster * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU 21 1.1 oster * School of Computer Science 22 1.1 oster * Carnegie Mellon University 23 1.1 oster * Pittsburgh PA 15213-3890 24 1.1 oster * 25 1.1 oster * any improvements or extensions that they make and grant Carnegie the 26 1.1 oster * rights to redistribute these changes. 27 1.1 oster */ 28 1.1 oster 29 1.1 oster /*************************************************** 30 1.1 oster * 31 1.1 oster * rf_reconbuffer.c -- reconstruction buffer manager 32 1.1 oster * 33 1.1 oster ***************************************************/ 34 1.6 lukem 35 1.6 lukem #include <sys/cdefs.h> 36 1.27 oster __KERNEL_RCSID(0, "$NetBSD: rf_reconbuffer.c,v 1.27 2021/07/23 00:54:45 oster Exp $"); 37 1.1 oster 38 1.1 oster #include "rf_raid.h" 39 1.1 oster #include "rf_reconbuffer.h" 40 1.1 oster #include "rf_acctrace.h" 41 1.1 oster #include "rf_etimer.h" 42 1.1 oster #include "rf_general.h" 43 1.1 oster #include "rf_revent.h" 44 1.1 oster #include "rf_reconutil.h" 45 1.1 oster #include "rf_nwayxor.h" 46 1.1 oster 47 1.7 oster #ifdef DEBUG 48 1.7 oster 49 1.1 oster #define Dprintf1(s,a) if (rf_reconbufferDebug) printf(s,a) 50 1.1 oster #define Dprintf2(s,a,b) if (rf_reconbufferDebug) printf(s,a,b) 51 1.1 oster #define Dprintf3(s,a,b,c) if (rf_reconbufferDebug) printf(s,a,b,c) 52 1.1 oster #define Dprintf4(s,a,b,c,d) if (rf_reconbufferDebug) printf(s,a,b,c,d) 53 1.1 oster #define Dprintf5(s,a,b,c,d,e) if (rf_reconbufferDebug) printf(s,a,b,c,d,e) 54 1.7 oster 55 1.7 oster #else /* DEBUG */ 56 1.7 oster 57 1.7 oster #define Dprintf1(s,a) {} 58 1.7 oster #define Dprintf2(s,a,b) {} 59 1.7 oster #define Dprintf3(s,a,b,c) {} 60 1.7 oster #define Dprintf4(s,a,b,c,d) {} 61 1.7 oster #define Dprintf5(s,a,b,c,d,e) {} 62 1.7 oster 63 1.7 oster #endif 64 1.1 oster 65 1.5 oster /***************************************************************************** 66 1.1 oster * 67 1.5 oster * Submit a reconstruction buffer to the manager for XOR. We can only 68 1.5 oster * submit a buffer if (1) we can xor into an existing buffer, which 69 1.5 oster * means we don't have to acquire a new one, (2) we can acquire a 70 1.5 oster * floating recon buffer, or (3) the caller has indicated that we are 71 1.5 oster * allowed to keep the submitted buffer. 72 1.1 oster * 73 1.1 oster * Returns non-zero if and only if we were not able to submit. 74 1.5 oster * In this case, we append the current disk ID to the wait list on the 75 1.22 perry * indicated RU, so that it will be re-enabled when we acquire a buffer 76 1.5 oster * for this RU. 77 1.1 oster * 78 1.5 oster ****************************************************************************/ 79 1.1 oster 80 1.1 oster /* 81 1.1 oster * nWayXorFuncs[i] is a pointer to a function that will xor "i" 82 1.1 oster * bufs into the accumulating sum. 83 1.1 oster */ 84 1.13 jdolecek static const RF_VoidFuncPtr nWayXorFuncs[] = { 85 1.3 oster NULL, 86 1.3 oster (RF_VoidFuncPtr) rf_nWayXor1, 87 1.3 oster (RF_VoidFuncPtr) rf_nWayXor2, 88 1.3 oster (RF_VoidFuncPtr) rf_nWayXor3, 89 1.3 oster (RF_VoidFuncPtr) rf_nWayXor4, 90 1.3 oster (RF_VoidFuncPtr) rf_nWayXor5, 91 1.3 oster (RF_VoidFuncPtr) rf_nWayXor6, 92 1.3 oster (RF_VoidFuncPtr) rf_nWayXor7, 93 1.3 oster (RF_VoidFuncPtr) rf_nWayXor8, 94 1.3 oster (RF_VoidFuncPtr) rf_nWayXor9 95 1.1 oster }; 96 1.3 oster 97 1.15 oster /* 98 1.15 oster * rbuf - the recon buffer to submit 99 1.15 oster * keep_it - whether we can keep this buffer or we have to return it 100 1.15 oster * use_committed - whether to use a committed or an available recon buffer 101 1.15 oster */ 102 1.22 perry int 103 1.15 oster rf_SubmitReconBuffer(RF_ReconBuffer_t *rbuf, int keep_it, int use_committed) 104 1.1 oster { 105 1.13 jdolecek const RF_LayoutSW_t *lp; 106 1.3 oster int rc; 107 1.1 oster 108 1.3 oster lp = rbuf->raidPtr->Layout.map; 109 1.3 oster rc = lp->SubmitReconBuffer(rbuf, keep_it, use_committed); 110 1.3 oster return (rc); 111 1.1 oster } 112 1.1 oster 113 1.15 oster /* 114 1.15 oster * rbuf - the recon buffer to submit 115 1.15 oster * keep_it - whether we can keep this buffer or we have to return it 116 1.15 oster * use_committed - whether to use a committed or an available recon buffer 117 1.15 oster */ 118 1.22 perry int 119 1.22 perry rf_SubmitReconBufferBasic(RF_ReconBuffer_t *rbuf, int keep_it, 120 1.15 oster int use_committed) 121 1.1 oster { 122 1.3 oster RF_Raid_t *raidPtr = rbuf->raidPtr; 123 1.3 oster RF_RaidLayout_t *layoutPtr = &raidPtr->Layout; 124 1.14 oster RF_ReconCtrl_t *reconCtrlPtr = raidPtr->reconControl; 125 1.3 oster RF_ReconParityStripeStatus_t *pssPtr; 126 1.3 oster RF_ReconBuffer_t *targetRbuf, *t = NULL; /* temporary rbuf 127 1.3 oster * pointers */ 128 1.24 christos void *ta; /* temporary data buffer pointer */ 129 1.26 christos RF_CallbackValueDesc_t *cb, *p; 130 1.19 oster int retcode = 0; 131 1.3 oster 132 1.3 oster RF_Etimer_t timer; 133 1.3 oster 134 1.3 oster /* makes no sense to have a submission from the failed disk */ 135 1.3 oster RF_ASSERT(rbuf); 136 1.3 oster RF_ASSERT(rbuf->col != reconCtrlPtr->fcol); 137 1.3 oster 138 1.14 oster Dprintf4("RECON: submission by col %d for psid %ld ru %d (failed offset %ld)\n", 139 1.14 oster rbuf->col, (long) rbuf->parityStripeID, rbuf->which_ru, (long) rbuf->failedDiskSectorOffset); 140 1.3 oster 141 1.14 oster RF_LOCK_PSS_MUTEX(raidPtr, rbuf->parityStripeID); 142 1.3 oster 143 1.25 mrg rf_lock_mutex2(reconCtrlPtr->rb_mutex); 144 1.21 oster while(reconCtrlPtr->rb_lock) { 145 1.25 mrg rf_wait_cond2(reconCtrlPtr->rb_cv, reconCtrlPtr->rb_mutex); 146 1.21 oster } 147 1.21 oster reconCtrlPtr->rb_lock = 1; 148 1.25 mrg rf_unlock_mutex2(reconCtrlPtr->rb_mutex); 149 1.3 oster 150 1.19 oster pssPtr = rf_LookupRUStatus(raidPtr, reconCtrlPtr->pssTable, rbuf->parityStripeID, rbuf->which_ru, RF_PSS_NONE, NULL); 151 1.3 oster RF_ASSERT(pssPtr); /* if it didn't exist, we wouldn't have gotten 152 1.3 oster * an rbuf for it */ 153 1.3 oster 154 1.3 oster /* check to see if enough buffers have accumulated to do an XOR. If 155 1.3 oster * so, there's no need to acquire a floating rbuf. Before we can do 156 1.3 oster * any XORing, we must have acquired a destination buffer. If we 157 1.3 oster * have, then we can go ahead and do the XOR if (1) including this 158 1.3 oster * buffer, enough bufs have accumulated, or (2) this is the last 159 1.3 oster * submission for this stripe. Otherwise, we have to go acquire a 160 1.3 oster * floating rbuf. */ 161 1.3 oster 162 1.3 oster targetRbuf = (RF_ReconBuffer_t *) pssPtr->rbuf; 163 1.3 oster if ((targetRbuf != NULL) && 164 1.3 oster ((pssPtr->xorBufCount == rf_numBufsToAccumulate - 1) || (targetRbuf->count + pssPtr->xorBufCount + 1 == layoutPtr->numDataCol))) { 165 1.3 oster pssPtr->rbufsForXor[pssPtr->xorBufCount++] = rbuf; /* install this buffer */ 166 1.14 oster Dprintf2("RECON: col %d invoking a %d-way XOR\n", rbuf->col, pssPtr->xorBufCount); 167 1.3 oster RF_ETIMER_START(timer); 168 1.3 oster rf_MultiWayReconXor(raidPtr, pssPtr); 169 1.3 oster RF_ETIMER_STOP(timer); 170 1.3 oster RF_ETIMER_EVAL(timer); 171 1.3 oster raidPtr->accumXorTimeUs += RF_ETIMER_VAL_US(timer); 172 1.3 oster if (!keep_it) { 173 1.18 oster #if RF_ACC_TRACE > 0 174 1.3 oster raidPtr->recon_tracerecs[rbuf->col].xor_us = RF_ETIMER_VAL_US(timer); 175 1.3 oster RF_ETIMER_STOP(raidPtr->recon_tracerecs[rbuf->col].recon_timer); 176 1.3 oster RF_ETIMER_EVAL(raidPtr->recon_tracerecs[rbuf->col].recon_timer); 177 1.3 oster raidPtr->recon_tracerecs[rbuf->col].specific.recon.recon_return_to_submit_us += 178 1.3 oster RF_ETIMER_VAL_US(raidPtr->recon_tracerecs[rbuf->col].recon_timer); 179 1.3 oster RF_ETIMER_START(raidPtr->recon_tracerecs[rbuf->col].recon_timer); 180 1.3 oster 181 1.3 oster rf_LogTraceRec(raidPtr, &raidPtr->recon_tracerecs[rbuf->col]); 182 1.18 oster #endif 183 1.3 oster } 184 1.3 oster rf_CheckForFullRbuf(raidPtr, reconCtrlPtr, pssPtr, layoutPtr->numDataCol); 185 1.3 oster 186 1.3 oster /* if use_committed is on, we _must_ consume a buffer off the 187 1.3 oster * committed list. */ 188 1.3 oster if (use_committed) { 189 1.3 oster t = reconCtrlPtr->committedRbufs; 190 1.3 oster RF_ASSERT(t); 191 1.3 oster reconCtrlPtr->committedRbufs = t->next; 192 1.14 oster rf_ReleaseFloatingReconBuffer(raidPtr, t); 193 1.3 oster } 194 1.3 oster if (keep_it) { 195 1.14 oster RF_UNLOCK_PSS_MUTEX(raidPtr, rbuf->parityStripeID); 196 1.25 mrg rf_lock_mutex2(reconCtrlPtr->rb_mutex); 197 1.21 oster reconCtrlPtr->rb_lock = 0; 198 1.25 mrg rf_broadcast_cond2(reconCtrlPtr->rb_cv); 199 1.25 mrg rf_unlock_mutex2(reconCtrlPtr->rb_mutex); 200 1.3 oster rf_FreeReconBuffer(rbuf); 201 1.3 oster return (retcode); 202 1.3 oster } 203 1.3 oster goto out; 204 1.3 oster } 205 1.3 oster /* set the value of "t", which we'll use as the rbuf from here on */ 206 1.3 oster if (keep_it) { 207 1.3 oster t = rbuf; 208 1.3 oster } else { 209 1.3 oster if (use_committed) { /* if a buffer has been committed to 210 1.3 oster * us, use it */ 211 1.3 oster t = reconCtrlPtr->committedRbufs; 212 1.3 oster RF_ASSERT(t); 213 1.3 oster reconCtrlPtr->committedRbufs = t->next; 214 1.3 oster t->next = NULL; 215 1.3 oster } else 216 1.3 oster if (reconCtrlPtr->floatingRbufs) { 217 1.3 oster t = reconCtrlPtr->floatingRbufs; 218 1.3 oster reconCtrlPtr->floatingRbufs = t->next; 219 1.3 oster t->next = NULL; 220 1.3 oster } 221 1.3 oster } 222 1.3 oster 223 1.3 oster /* If we weren't able to acquire a buffer, append to the end of the 224 1.3 oster * buf list in the recon ctrl struct. */ 225 1.3 oster if (!t) { 226 1.3 oster RF_ASSERT(!keep_it && !use_committed); 227 1.17 hannken Dprintf1("RECON: col %d failed to acquire floating rbuf\n", rbuf->col); 228 1.3 oster 229 1.3 oster raidPtr->procsInBufWait++; 230 1.3 oster if ((raidPtr->procsInBufWait == raidPtr->numCol - 1) && (raidPtr->numFullReconBuffers == 0)) { 231 1.3 oster printf("Buffer wait deadlock detected. Exiting.\n"); 232 1.14 oster rf_PrintPSStatusTable(raidPtr); 233 1.3 oster RF_PANIC(); 234 1.3 oster } 235 1.3 oster pssPtr->flags |= RF_PSS_BUFFERWAIT; 236 1.27 oster cb = rf_AllocCallbackValueDesc(raidPtr); /* append to buf wait list in 237 1.27 oster * recon ctrl structure */ 238 1.3 oster cb->col = rbuf->col; 239 1.26 christos cb->v = rbuf->parityStripeID; 240 1.3 oster cb->next = NULL; 241 1.3 oster if (!reconCtrlPtr->bufferWaitList) 242 1.3 oster reconCtrlPtr->bufferWaitList = cb; 243 1.3 oster else { /* might want to maintain head/tail pointers 244 1.3 oster * here rather than search for end of list */ 245 1.3 oster for (p = reconCtrlPtr->bufferWaitList; p->next; p = p->next); 246 1.3 oster p->next = cb; 247 1.3 oster } 248 1.3 oster retcode = 1; 249 1.3 oster goto out; 250 1.3 oster } 251 1.17 hannken Dprintf1("RECON: col %d acquired rbuf\n", rbuf->col); 252 1.18 oster #if RF_ACC_TRACE > 0 253 1.3 oster RF_ETIMER_STOP(raidPtr->recon_tracerecs[rbuf->col].recon_timer); 254 1.3 oster RF_ETIMER_EVAL(raidPtr->recon_tracerecs[rbuf->col].recon_timer); 255 1.3 oster raidPtr->recon_tracerecs[rbuf->col].specific.recon.recon_return_to_submit_us += 256 1.3 oster RF_ETIMER_VAL_US(raidPtr->recon_tracerecs[rbuf->col].recon_timer); 257 1.3 oster RF_ETIMER_START(raidPtr->recon_tracerecs[rbuf->col].recon_timer); 258 1.3 oster 259 1.3 oster rf_LogTraceRec(raidPtr, &raidPtr->recon_tracerecs[rbuf->col]); 260 1.18 oster #endif 261 1.3 oster 262 1.3 oster /* initialize the buffer */ 263 1.3 oster if (t != rbuf) { 264 1.3 oster t->col = reconCtrlPtr->fcol; 265 1.3 oster t->parityStripeID = rbuf->parityStripeID; 266 1.3 oster t->which_ru = rbuf->which_ru; 267 1.3 oster t->failedDiskSectorOffset = rbuf->failedDiskSectorOffset; 268 1.3 oster t->spCol = rbuf->spCol; 269 1.3 oster t->spOffset = rbuf->spOffset; 270 1.3 oster 271 1.3 oster ta = t->buffer; 272 1.3 oster t->buffer = rbuf->buffer; 273 1.3 oster rbuf->buffer = ta; /* swap buffers */ 274 1.3 oster } 275 1.3 oster /* the first installation always gets installed as the destination 276 1.3 oster * buffer. subsequent installations get stacked up to allow for 277 1.3 oster * multi-way XOR */ 278 1.3 oster if (!pssPtr->rbuf) { 279 1.3 oster pssPtr->rbuf = t; 280 1.3 oster t->count = 1; 281 1.3 oster } else 282 1.3 oster pssPtr->rbufsForXor[pssPtr->xorBufCount++] = t; /* install this buffer */ 283 1.3 oster 284 1.3 oster rf_CheckForFullRbuf(raidPtr, reconCtrlPtr, pssPtr, layoutPtr->numDataCol); /* the buffer is full if 285 1.3 oster * G=2 */ 286 1.3 oster 287 1.3 oster out: 288 1.14 oster RF_UNLOCK_PSS_MUTEX(raidPtr, rbuf->parityStripeID); 289 1.25 mrg rf_lock_mutex2(reconCtrlPtr->rb_mutex); 290 1.21 oster reconCtrlPtr->rb_lock = 0; 291 1.25 mrg rf_broadcast_cond2(reconCtrlPtr->rb_cv); 292 1.25 mrg rf_unlock_mutex2(reconCtrlPtr->rb_mutex); 293 1.3 oster return (retcode); 294 1.1 oster } 295 1.15 oster /* pssPtr - the pss descriptor for this parity stripe */ 296 1.22 perry int 297 1.15 oster rf_MultiWayReconXor(RF_Raid_t *raidPtr, RF_ReconParityStripeStatus_t *pssPtr) 298 1.1 oster { 299 1.3 oster int i, numBufs = pssPtr->xorBufCount; 300 1.3 oster int numBytes = rf_RaidAddressToByte(raidPtr, raidPtr->Layout.sectorsPerStripeUnit * raidPtr->Layout.SUsPerRU); 301 1.3 oster RF_ReconBuffer_t **rbufs = (RF_ReconBuffer_t **) pssPtr->rbufsForXor; 302 1.3 oster RF_ReconBuffer_t *targetRbuf = (RF_ReconBuffer_t *) pssPtr->rbuf; 303 1.3 oster 304 1.3 oster RF_ASSERT(pssPtr->rbuf != NULL); 305 1.3 oster RF_ASSERT(numBufs > 0 && numBufs < RF_PS_MAX_BUFS); 306 1.2 oster #ifdef _KERNEL 307 1.1 oster #ifndef __NetBSD__ 308 1.3 oster thread_block(); /* yield the processor before doing a big XOR */ 309 1.1 oster #endif 310 1.3 oster #endif /* _KERNEL */ 311 1.3 oster /* 312 1.3 oster * XXX 313 1.3 oster * 314 1.3 oster * What if more than 9 bufs? 315 1.3 oster */ 316 1.3 oster nWayXorFuncs[numBufs] (pssPtr->rbufsForXor, targetRbuf, numBytes / sizeof(long)); 317 1.3 oster 318 1.3 oster /* release all the reconstruction buffers except the last one, which 319 1.4 soren * belongs to the disk whose submission caused this XOR to take place */ 320 1.3 oster for (i = 0; i < numBufs - 1; i++) { 321 1.3 oster if (rbufs[i]->type == RF_RBUF_TYPE_FLOATING) 322 1.14 oster rf_ReleaseFloatingReconBuffer(raidPtr, rbufs[i]); 323 1.3 oster else 324 1.3 oster if (rbufs[i]->type == RF_RBUF_TYPE_FORCED) 325 1.3 oster rf_FreeReconBuffer(rbufs[i]); 326 1.3 oster else 327 1.3 oster RF_ASSERT(0); 328 1.3 oster } 329 1.3 oster targetRbuf->count += pssPtr->xorBufCount; 330 1.3 oster pssPtr->xorBufCount = 0; 331 1.3 oster return (0); 332 1.1 oster } 333 1.1 oster /* removes one full buffer from one of the full-buffer lists and returns it. 334 1.1 oster * 335 1.1 oster * ASSUMES THE RB_MUTEX IS UNLOCKED AT ENTRY. 336 1.1 oster */ 337 1.3 oster RF_ReconBuffer_t * 338 1.15 oster rf_GetFullReconBuffer(RF_ReconCtrl_t *reconCtrlPtr) 339 1.1 oster { 340 1.3 oster RF_ReconBuffer_t *p; 341 1.1 oster 342 1.25 mrg rf_lock_mutex2(reconCtrlPtr->rb_mutex); 343 1.21 oster while(reconCtrlPtr->rb_lock) { 344 1.25 mrg rf_wait_cond2(reconCtrlPtr->rb_cv, reconCtrlPtr->rb_mutex); 345 1.21 oster } 346 1.21 oster reconCtrlPtr->rb_lock = 1; 347 1.25 mrg rf_unlock_mutex2(reconCtrlPtr->rb_mutex); 348 1.1 oster 349 1.3 oster if ((p = reconCtrlPtr->fullBufferList) != NULL) { 350 1.3 oster reconCtrlPtr->fullBufferList = p->next; 351 1.3 oster p->next = NULL; 352 1.3 oster } 353 1.25 mrg rf_lock_mutex2(reconCtrlPtr->rb_mutex); 354 1.21 oster reconCtrlPtr->rb_lock = 0; 355 1.25 mrg rf_broadcast_cond2(reconCtrlPtr->rb_cv); 356 1.25 mrg rf_unlock_mutex2(reconCtrlPtr->rb_mutex); 357 1.3 oster return (p); 358 1.1 oster } 359 1.1 oster 360 1.1 oster 361 1.5 oster /* if the reconstruction buffer is full, move it to the full list, 362 1.5 oster * which is maintained sorted by failed disk sector offset 363 1.1 oster * 364 1.5 oster * ASSUMES THE RB_MUTEX IS LOCKED AT ENTRY. */ 365 1.22 perry int 366 1.22 perry rf_CheckForFullRbuf(RF_Raid_t *raidPtr, RF_ReconCtrl_t *reconCtrl, 367 1.15 oster RF_ReconParityStripeStatus_t *pssPtr, int numDataCol) 368 1.1 oster { 369 1.3 oster RF_ReconBuffer_t *p, *pt, *rbuf = (RF_ReconBuffer_t *) pssPtr->rbuf; 370 1.1 oster 371 1.3 oster if (rbuf->count == numDataCol) { 372 1.3 oster raidPtr->numFullReconBuffers++; 373 1.3 oster Dprintf2("RECON: rbuf for psid %ld ru %d has filled\n", 374 1.3 oster (long) rbuf->parityStripeID, rbuf->which_ru); 375 1.3 oster if (!reconCtrl->fullBufferList || (rbuf->failedDiskSectorOffset < reconCtrl->fullBufferList->failedDiskSectorOffset)) { 376 1.3 oster Dprintf2("RECON: rbuf for psid %ld ru %d is head of list\n", 377 1.3 oster (long) rbuf->parityStripeID, rbuf->which_ru); 378 1.3 oster rbuf->next = reconCtrl->fullBufferList; 379 1.3 oster reconCtrl->fullBufferList = rbuf; 380 1.3 oster } else { 381 1.3 oster for (pt = reconCtrl->fullBufferList, p = pt->next; p && p->failedDiskSectorOffset < rbuf->failedDiskSectorOffset; pt = p, p = p->next); 382 1.3 oster rbuf->next = p; 383 1.3 oster pt->next = rbuf; 384 1.3 oster Dprintf2("RECON: rbuf for psid %ld ru %d is in list\n", 385 1.3 oster (long) rbuf->parityStripeID, rbuf->which_ru); 386 1.3 oster } 387 1.3 oster rbuf->pssPtr = pssPtr; 388 1.3 oster pssPtr->rbuf = NULL; 389 1.14 oster rf_CauseReconEvent(raidPtr, rbuf->col, NULL, RF_REVENT_BUFREADY); 390 1.3 oster } 391 1.3 oster return (0); 392 1.1 oster } 393 1.1 oster 394 1.1 oster 395 1.1 oster /* release a floating recon buffer for someone else to use. 396 1.1 oster * assumes the rb_mutex is LOCKED at entry 397 1.1 oster */ 398 1.22 perry void 399 1.15 oster rf_ReleaseFloatingReconBuffer(RF_Raid_t *raidPtr, RF_ReconBuffer_t *rbuf) 400 1.1 oster { 401 1.14 oster RF_ReconCtrl_t *rcPtr = raidPtr->reconControl; 402 1.26 christos RF_CallbackValueDesc_t *cb; 403 1.3 oster 404 1.3 oster Dprintf2("RECON: releasing rbuf for psid %ld ru %d\n", 405 1.3 oster (long) rbuf->parityStripeID, rbuf->which_ru); 406 1.1 oster 407 1.3 oster /* if anyone is waiting on buffers, wake one of them up. They will 408 1.3 oster * subsequently wake up anyone else waiting on their RU */ 409 1.3 oster if (rcPtr->bufferWaitList) { 410 1.3 oster rbuf->next = rcPtr->committedRbufs; 411 1.3 oster rcPtr->committedRbufs = rbuf; 412 1.3 oster cb = rcPtr->bufferWaitList; 413 1.3 oster rcPtr->bufferWaitList = cb->next; 414 1.14 oster rf_CauseReconEvent(raidPtr, cb->col, (void *) 1, RF_REVENT_BUFCLEAR); /* arg==1 => we've 415 1.3 oster * committed a buffer */ 416 1.27 oster rf_FreeCallbackValueDesc(raidPtr, cb); 417 1.3 oster raidPtr->procsInBufWait--; 418 1.3 oster } else { 419 1.3 oster rbuf->next = rcPtr->floatingRbufs; 420 1.3 oster rcPtr->floatingRbufs = rbuf; 421 1.3 oster } 422 1.1 oster } 423