[pso] [Tema5][Linux]End Request

Bogdan Ceptureanu bogdan.cep at gmail.com
Wed Aug 8 17:38:17 EEST 2007


Salutare,

Lucrez si eu la tema asta si as avea niste intrebari:

"Faci acest lucru in partea de initializare a discului in felul urmator:"
Despre ce disc este vorba? Eu am inteles ca ar fi discul (bdev->bd_disk) al
block-device-ului intors de open_bdev_excl(). Totusi, imi da eroarea "Module
is in use" la rmmod cand incerc sa asignez operatiile la acest disc
(bdev->bd_disk->fops = &block_ops). Partea aceasta in schimb merge:
---
         dev->queue = blk_alloc_queue (GFP_KERNEL);
         if (dev->queue == NULL) {
                 printk (KERN_ERR "cannot allocate block device queue\n");
                 return -ENOMEM;
         }
         blk_queue_make_request (dev->queue, my_bio_request_fun);
---

Any ideas?

P.S. Sper ca nu e toata lumea in vacanta :P

On 6/24/07, Razvan Deaconescu <razvand at cs.pub.ro> wrote:
>
> sorin gsmcreation wrote:
> > Salut!
> >
> > In functia de transfer a requesturilor, as vrea sa nu
> > completez imediat requestul venit din userspace,
> > deoarece as vrea sa o prelucrez cu ajutorul schedule
> > work:
> >
> > if (write)
> > {
> > INIT_WORK (&write_work, write_work_handler, info);
> > schedule_work (&write_work);
> > }
> > else
> > {
> > INIT_WORK (&read_work, read_work_handler, info);
> > schedule_work (&read_work);
> > }
> >
> > Info este de tipul unei structuri care incapsuleaza si
> > request-ul curent.
> > Daca pun end_request(req, 1) in write_work_handler sau
> > read_work_handler, se ajunge la deadlock. Singura
> > varianta care merge este end_request(req, 1) chiar
> > dupa acest if-else. Care ar fi solutia sa pot apela
> > end_request(req, 1) mai tarziu totusi?
>
> De ce nu faci prelucrare la nivel de bio? Nu trebuie sa inregistrezi o
> rutina de tratare a unei cereri (request), ci poti inregistra o rutina
> de tratare a unui bio. In felul acesta, driver-ul tau va opera, prin
> intermediul rutinei propuse, asupra unui singur bio (pe rand).
>
> Faci acest lucru in partea de initializare a discului in felul urmator:
>
> ---
>          dev->queue = blk_alloc_queue (GFP_KERNEL);
>          if (dev->queue == NULL) {
>                  printk (KERN_ERR "cannot allocate block device queue\n");
>                  return -ENOMEM;
>          }
>          blk_queue_make_request (dev->queue, my_bio_request_fun);
> ---
>
> unde my_bio_request_fun are signatura:
> int my_bio_request_fun (request_queue_t *q, struct bio *bio);
>
> Gasesti informatii suplimentare in LDD 3rd Edition
> (http://lwn.net/Kernel/LDD3/) capitolul 16 (Block Drivers), pagina 489,
> sectiunea 'Doing without a request queue'
>
> Am adaugat si in sectiunea temei aceasta precizare:
>
> http://cs.pub.ro/~pso/index.php?section=Teme&file=05.%20Software%20RAID#Precizari_Linux
>
> Razvan
> _______________________________________________
> pso mailing list
> pso at cursuri.cs.pub.ro
> http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/pso
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cursuri.cs.pub.ro/pipermail/pso/attachments/20070808/132347fc/attachment.html


More information about the pso mailing list