Block Device Help Please

Block Device Help Please

Post by rk.. » Tue, 03 Oct 2000 04:00:00



Hi ,

Can a device driver guru please help me with this.
I'm Writing a block device driver in linux,
A real simplified verison of the code is
//BLKSIZE = 1024
void request_block(void) // less kernel 2.2.32
{
    INIT_REQUEST; // and all that protection
    if (CURRENT->cmd = read)
        memcpy(CURRENT->buffer,my_input_buffer,BLKSIZE);
    if (CURRENT->cmd = write)
        memcpy(my_input_buffer,CURRENT->buffer,BLKSIZE);
    end_request(1);

Quote:}

CURRENT->current_no_sectors is 2.
I'm only putting 1024 bytes in the buffer.
When I read the device it gives me only every second 1024 bytes.
If I pump in more than 1024 eg 2048 ,
there are problems with stability.
Can Any on please Help me.
Thanks,
Richard.
 
 
 

Block Device Help Please

Post by Mark McDougal » Thu, 05 Oct 2000 10:21:56



> Can a device driver guru please help me with this.
> I'm Writing a block device driver in linux,
> A real simplified verison of the code is
> //BLKSIZE = 1024
> void request_block(void) // less kernel 2.2.32
> {
>     INIT_REQUEST; // and all that protection
>     if (CURRENT->cmd = read)
>         memcpy(CURRENT->buffer,my_input_buffer,BLKSIZE);
>     if (CURRENT->cmd = write)
>         memcpy(my_input_buffer,CURRENT->buffer,BLKSIZE);
>     end_request(1);
> }
> CURRENT->current_no_sectors is 2.
> I'm only putting 1024 bytes in the buffer.
> When I read the device it gives me only every second 1024 bytes.
> If I pump in more than 1024 eg 2048 ,
> there are problems with stability.

First of all, you *must* use the values passed with the CURRENT macro in
order to determine how many bytes to fill. Block devices will use the
readahead to grab more than a single sector at a time. Of course your
"input_buffer" will need to be large enough to handle all cases.

You also have to be aware that sectorsize and blocksize are 2 different
entities, and you need to be careful which of them you use and where.
The request function works in sectors - not blocks. Check what hardsect
size you've registered with your block device.

Regards,

--
|     Mark McDougall    |
|        Engineer       |
| Virtual Logic Pty Ltd |
| http://www.vl.com.au  |

 
 
 

1. Please help... mount: /dev/cdrom1 is not a valid block device

I can't figure out why linux won't acknowledge my second cd drive.

# mount /mnt/cdrom1/
mount: /dev/cdrom1 is not a valid block device

#mount -t iso9660 -r /dev/hdc /mnt/cdrom1
mount: /dev/hdc is not a valid block device

This cd drive still works fine in windows, and it worked fine during
the linux installation (red hat 7.3 installer). The drive is the slave
on the second ide bus.

Any suggestions would be very appreciated.

-Jeff

2. Need help, ftp setup

3. Please help - "CD not block device"

4. searching for matching pattern (only)

5. Help: character device vs. block device

6. High speed series on 5.4 X86

7. character device, block device , raw device?

8. DWL-650 wireless card won't work

9. Block device invalidate cached blocks

10. how to coordinate ioctl and block I/O requests in a block device driver

11. Does TRU-64 support devices with block sizes > 512 bytes/block ?

12. /////////////Please, Please Help !!! Tape Device Problem\\\\\\\\\\\\

13. /proc/devices for block devices