void *filter_iobuf_get(struct filter_obd *filter, struct obd_trans_info *oti)
{
int thread_id = oti ? oti->oti_thread_id : -1;
- struct filter_iobuf **pool = &filter->fo_iobuf_pool[thread_id];
+ struct filter_iobuf *pool_local;
+ struct filter_iobuf **pool;
+ if (thread_id >= 0) {
LASSERT(thread_id < filter->fo_iobuf_count);
+ pool = &filter->fo_iobuf_pool[thread_id];
+ } else
+ pool = &pool_local;
+
if (unlikely(thread_id < 0 || *pool == NULL))
filter_alloc_iobuf(filter, OBD_BRW_WRITE,
PTLRPC_MAX_BRW_PAGES, pool);
GOTO(out, ret = -ENOMEM);
for (i = 0; i < oa_bufs; i++) {
+ lnb[i].page = pga[i].pg;
rnb[i].offset = pga[i].off;
rnb[i].len = pga[i].count;
}
if (ret != 0)
GOTO(out, ret);
- for (i = 0; i < oa_bufs; i++) {
- void *virt;
- obd_off off;
- void *addr;
-
- if (lnb[i].page == NULL)
- break;
-
- off = pga[i].off & ~PAGE_MASK;
- virt = kmap(pga[i].pg);
- addr = kmap(lnb[i].page);
-
- /* 2 kmaps == vanishingly small deadlock opportunity */
-
- if (cmd & OBD_BRW_WRITE)
- memcpy(addr + off, virt + off, pga[i].count);
- else
- memcpy(virt + off, addr + off, pga[i].count);
-
- kunmap(lnb[i].page);
- kunmap(pga[i].pg);
- }
-
ret = filter_commitrw(cmd, exp, oa, 1, &ioo, oa_bufs, lnb, oti, ret);
out: