From: ashwin chaugule <ashwin.chaugule@gmail.com>
To: LVM general discussion and development <linux-lvm@redhat.com>
Subject: Re: [linux-lvm] Re: raid 1 on a single disk
Date: Mon, 15 Nov 2004 11:39:20 +0530 [thread overview]
Message-ID: <89af10f904111422096bed519e@mail.gmail.com> (raw)
In-Reply-To: <qltk62-hg2.ln1@news.it.uc3m.es>
>Then I suggest you attempt to describe what you are doing. The above
>fails!
Its really simple .. dont know why you cant comprehend it.
Hope you understand from the code ...
in __do_rw_disk
if(MINOR(rq->rq_dev)==69 && rq->cmd==WRITE){
rq1 = duplicate_request(rq);
drive->rq=rq1;
}
where duplicate_request , is a simple kmalloc and memcpy of rq.
rq1 is going to be our duplicate request.
then ....
if(MINOR(rq->rq_dev)==69 && rq->cmd==WRITE)
{
block_copy = block;
get_address(drive,rq1,block);
}
else {
hwif->OUTB(0x00, IDE_FEATURE_REG);
hwif->OUTB(nsectors.b.low, IDE_NSECTOR_REG);
hwif->OUTB(block, IDE_SECTOR_REG);
hwif->OUTB(block>>=8, IDE_LCYL_REG);
hwif->OUTB(block>>=8, IDE_HCYL_REG);
hwif->OUTB(((block>>8)&0x0f)|drive->select.all,IDE_SELECT_REG);
}
where get_address will do a block=block + (drive->capacity / 2);
and refill all the above registers.
then
when its a (non DMA) WRITE ...
if(MINOR(rq->rq_dev)==69 && rq->cmd==WRITE)
hwgroup->wrq = *rq1; /* scratchpad */
else
hwgroup->wrq = *rq; /* scratchpad */
then ...
if(MINOR(rq->rq_dev)==69 && rq->cmd==WRITE){
rq1->q->queuedata=(void *)rq;
//queuedata is an unused ptr. so it stores the original rq.
ide_set_handler(drive,
&multwrite_intr_withoutend, WAIT_CMD, NULL);
}
else
ide_set_handler(drive, &multwrite_intr, WAIT_CMD, NULL);
where ... multiwrite_intr_withoutend is my custom handler ...
now in multiwrite_withoutend
if (rq->nr_sectors) {
if (ide_multwrite(drive, drive->mult_count))
return ide_stopped;
ide_set_handler(drive,
&multwrite_intr_withoutend, WAIT_CMD, NULL);
return ide_started;
else
ndelay(400);
HWGROUP(drive)->handler=0;
kfree(drive->rq);
drive->rq=(struct request
*)(drive->rq->q->queuedata);
hwgroup->wrq = *(drive->rq); /* scratchpad */
restore_original_condition(drive);
command = ((drive->mult_count) ?
((lba48) ? WIN_MULTWRITE_EXT : WIN_MULTWRITE) :
((lba48) ? WIN_WRITE_EXT : WIN_WRITE));
hwif->OUTB(command, IDE_COMMAND_REG);
-snip-
ide_set_handler(drive, &multwrite_intr,
WAIT_CMD, NULL);
etc etc
this is where , i reset the original condition , and set the handler back...
so the original request is completed.
... So you see that , when there's a write request coming to my disk ,
1) duplicate the req.
2) set the handler
3) perform the write
4) DO NOT call end_request ... so no end_io
5) after its done , restore original condition
6) let it do its thing
Why wont it unmount ?
Ashwin
prev parent reply other threads:[~2004-11-15 6:09 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-13 10:17 [linux-lvm] raid 1 on a single disk ashwin chaugule
2004-11-13 10:33 ` [linux-lvm] " Peter T. Breuer
2004-11-13 10:41 ` ashwin chaugule
2004-11-13 11:03 ` Piete Brooks
2004-11-13 12:59 ` Peter T. Breuer
2004-11-13 13:38 ` Piete Brooks
2004-11-13 15:04 ` Peter T. Breuer
2004-11-13 13:38 ` ashwin chaugule
2004-11-13 21:13 ` Graham Wood
2004-11-13 22:00 ` Greg Freemyer
2004-11-14 0:41 ` Måns Rullgård
2004-11-14 5:44 ` ashwin chaugule
2004-11-14 11:28 ` Peter T. Breuer
2004-11-14 17:41 ` ashwin chaugule
2004-11-14 18:04 ` Peter T. Breuer
2004-11-14 19:02 ` ashwin chaugule
2004-11-14 21:01 ` Peter T. Breuer
2004-11-15 6:09 ` ashwin chaugule [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=89af10f904111422096bed519e@mail.gmail.com \
--to=ashwin.chaugule@gmail.com \
--cc=linux-lvm@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox