Re: GSOC: Device mapper mirror target

看板DFBSD_kernel作者時間14年前 (2011/05/17 02:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串8/16 (看更多)
On Sun, 10 Apr 2011 18:08:33 -0400 Venkatesh Srinivas <me@endeavour.zapto.org> wrote: > static int > dmirror_strategy(dm_table_entry_t *table_en, struct buf *bp) > { > struct bio *bio; > struct dmirror_pdev *pdev; > struct dmirror_dev *dmcfg; > struct dmirror_write_group *wg; > struct dmirror_write_tx *tx; > int ndevs; > int i; > > dmcfg = table_en->target_config; > > switch (bp->b_cmd) { > case (BUF_CMD_READ): > pdev = dmirror_read_pick(dmcfg, &bp->b_bio1); > if (pdev == NULL) { > bp->b_flags |= B_ERROR | B_INVAL; > bp->b_resid = 0; > biodone(&bp->b_bio1); > break; > } > > disk_issue_read(dmcfg, pdev, &bp->b_bio1); > break; > case (BUF_CMD_WRITE): > /* Allocate a write group */ > wg = kmalloc(sizeof(struct dmirror_write_group), M_DMIRROR_WG, > M_WAITOK); > dmirror_wg_ctor(dmcfg, &bp->b_bio1, wg); > > /* Allocate one transaction per device */ > for (i = 0; i < ndevs; i++) { > tx = kmalloc(sizeof(struct dmirror_write_tx), > M_DMIRROR_TX, M_WAITOK); > dmirror_write_tx_ctor(wg, tx); > > } > > /* Setup transactions */ > > /* Issue requests */ > // do some stuff, then call vn_strategy() on each tx->bio > > break; > case (BUF_CMD_FLUSH): > default: > break; > } > } > A bit off topic, but I dont think its a good idea to allocate memory during I/O. :-) -- Adam Hoka <adam.hoka@gmail.com>
文章代碼(AID): #1DqMsk9Z (DFBSD_kernel)
討論串 (同標題文章)
文章代碼(AID): #1DqMsk9Z (DFBSD_kernel)