lkml.org 
[lkml]   [2005]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectDeadlocked kernel when using brw_kiovec to do direct I/O
Date
From
	I'm using brw_kiovec() on a 2.4.28 kernel to write directly to a
hard drive from a kernel module that I wrote. I have a 64k buffer that I
pass to brw_kiovec() and it writes the data to the hard drive directly
like it's supposed to. However, I noticed that if I make more than one
call to brw_kiovec() to write more data, the second call will cause the
machine to freeze hard. I have to reboot via the reset button (SysRq
doesn't work). Below is the code from just the part that calls
brw_kiovec() (based on some of the code in the Linux Kernel Crash Dump):

void RC_file_writer(const char *buffer)
{
int return_value, i;
unsigned long *b = RC_dump_iobuf->blocks, blocknr, blocks;

if (RC_dump_offset & (RC_dump_block_size - 1))
{
printk(KERN_ERR "RapidCapture: RC_dump_offset wasn't
aligned properly.\n");
return;
}

/* Reset the block number values */
blocknr = RC_dump_offset >> RC_dump_block_shift;


/* Calculate the number of blocks */
blocks = RC_BUFFER_SIZE >> RC_dump_block_shift;
if (blocks > (KIO_MAX_SECTORS >> (RC_dump_block_shift - 9)))
blocks = KIO_MAX_SECTORS >> (RC_dump_block_shift - 9);

/* Map the block numbers */
for (i = 0; i < blocks; i++)
b[i] = blocknr++;

/* Write the data to the raw device bypassing any file caches.
*/
return_value = brw_kiovec(WRITE, 1, &RC_dump_iobuf,
RC_dump_device, b, RC_dump_block_size);
if (return_value != RC_BUFFER_SIZE)
printk(KERN_ERR "RapidCapture: Write was trucated!\n");
else
RC_dump_offset += return_value;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:11    [W:3.256 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site