All of lore.kernel.org
 help / color / mirror / Atom feed
* BUG in blkback? on bio generation
@ 2008-12-25  7:48 Y. D.
  0 siblings, 0 replies; 2+ messages in thread
From: Y. D. @ 2008-12-25  7:48 UTC (permalink / raw)
  To: xen-devel

Hi,

Merry Christmas.

I am reading code in blkback.c, while I find that the bio generation might be really bad. 
The bio_add_page() returns length of added bio vector, so if it fails it returns 0.
Therefore, should not bio_add_page() be negated in the while() loop condition??

        for (i = 0; i < nseg; i++) {           
                if (((int)preq.sector_number|(int)seg[i].nsec) &
                    ((bdev_hardsect_size(preq.bdev) >> 9) - 1)) {
                        DPRINTK("Misaligned I/O request from domain %d",
                                blkif->domid);         
                        goto fail_put_bio;     
                }             

                while ((bio == NULL) ||           
          -------->(bio_add_page(bio,                           
                                     virt_to_page(vaddr(pending_req, i)),
                                     seg[i].nsec << 9,              
                                     seg[i].buf & ~PAGE_MASK) == 0)) {
                        bio = biolist[nbio++] = bio_alloc(GFP_KERNEL, nseg-i);
                        if (unlikely(bio == NULL))             
                                goto fail_put_bio;                                                                                                             

                        bio->bi_bdev    = preq.bdev;   
                        bio->bi_private = pending_req; 
                        bio->bi_end_io  = end_block_io_op;
                        bio->bi_sector  = preq.sector_number;                                                                                                  
                }             

                preq.sector_number += seg[i].nsec;
        }

Cheers,
Shawn

^ permalink raw reply	[flat|nested] 2+ messages in thread
* BUG in blkback? on bio generation
@ 2008-12-25  7:44 Y. D.
  0 siblings, 0 replies; 2+ messages in thread
From: Y. D. @ 2008-12-25  7:44 UTC (permalink / raw)
  To: xen-devel; +Cc: Keir Fraser

Hi,

Merry Christmas.

I am reading code in blkback.c, while I find that the bio generation might be really bad. 
The bio_add_page() returns length of added bio vector, so if it fails it returns 0.
Therefore, should not bio_add_page() be negated in the while() loop condition??

        for (i = 0; i < nseg; i++) {           
                if (((int)preq.sector_number|(int)seg[i].nsec) &
                    ((bdev_hardsect_size(preq.bdev) >> 9) - 1)) {
                        DPRINTK("Misaligned I/O request from domain %d",
                                blkif->domid);         
                        goto fail_put_bio;     
                }             

                while ((bio == NULL) ||           
          -------->(bio_add_page(bio,                           
                                     virt_to_page(vaddr(pending_req, i)),
                                     seg[i].nsec << 9,              
                                     seg[i].buf & ~PAGE_MASK) == 0)) {
                        bio = biolist[nbio++] = bio_alloc(GFP_KERNEL, nseg-i);
                        if (unlikely(bio == NULL))             
                                goto fail_put_bio;                                                                                                             

                        bio->bi_bdev    = preq.bdev;   
                        bio->bi_private = pending_req; 
                        bio->bi_end_io  = end_block_io_op;
                        bio->bi_sector  = preq.sector_number;                                                                                                  
                }             

                preq.sector_number += seg[i].nsec;
        }

Cheers,
Shawn

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-12-25  7:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-25  7:48 BUG in blkback? on bio generation Y. D.
  -- strict thread matches above, loose matches on Subject: below --
2008-12-25  7:44 Y. D.

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.