[ENBD] ENBD on 2.4.x

Peter T. Breuer ptb@it.uc3m.es
Thu, 15 Mar 2001 13:42:54 +0100 (MET)


Is this a bug (a sudden doubt crosses my mind) ...

"Peter T. Breuer wrote:"
>   static int
>   nbd_front_merge_fn(request_queue_t *q, struct request *req,
>     struct buffer_head *bh, int max_segments)
>   {
>     if (!merge_requests)
>       return 0;
>     if (req->nr_sectors + (bh->b_size >> 9) > buf_sectors)

bh->b_size is the blocksize, not the size of the data pointed to by the
buffer head, according to the notes in fs.h.

         unsigned short b_size;          /* block size */ 

Is it the size? Most of the normal code I can see treats it as such and
here I count how many sectors it has, so I treat it that way too. But
as far as I can see, the merge code in ll_rw_blk.c never changes it.
So all of us seem to be assuming that buffer_heads point at buffer of
size the device blocksize. Is that still so?

I hope that is true! But then why don't I just put the real blocksize
here. Someone should run a test with

  int nbd = MINOR(bh->b_rdev) >> NBD_SHIFT;
  if (bh->b_size != blksize_size[NBD_MAJOR][nbd])
    NBD_ALERT ...

Peter