DragonFly BSD
DragonFly kernel List (threaded) for 2011-04
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: GSOC: Device mapper mirror target


From: Venkatesh Srinivas <me@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 11 Apr 2011 11:18:27 -0400

On Mon, Apr 11, 2011 at 9:22 AM, Adam Hoka <adam.hoka@gmail.com> wrote:
> 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. :-)

Heh, totally agree there.

We have an interface called MPIPE (very similar to NetBSD's pool(9))
that would allow us to reserve some transactions/groups for write-path
I/O. I believe that is what the dm crypt target does. I think that'd
be okay for this.

-- vs




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]