lkml.org 
[lkml]   [1999]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[patch] make minix work in 2.3.8
Date
Hi,

attached I have a patch against linux-2.3.8. It allows minixfs to compile. The
resulting kernel boots and seems to work. I have UP only, I'd be grateful for
SMP testers.
Please be careful with the patch !

Regards
Oliver

PS: Is there any documentation on locking in the buffer cache ?--- linux/fs/minix/file.c.alt Fri Jun 25 19:24:35 1999
+++ linux/fs/minix/file.c Fri Jun 25 19:57:11 1999
@@ -15,6 +15,7 @@
#include <linux/locks.h>
#include <linux/mm.h>
#include <linux/pagemap.h>
+#include <linux/smp_lock.h>

#include <asm/uaccess.h>
#include <asm/system.h>
@@ -36,6 +37,7 @@
int i, err, created;
struct buffer_head *bh;

+ lock_kernel();
i = PAGE_SIZE / BLOCK_SIZE;
block = page->offset / BLOCK_SIZE;
p = nr;
@@ -56,13 +58,14 @@

/* IO start */
brw_page(WRITE, page, inode->i_dev, nr, BLOCK_SIZE, 1);
+ unlock_kernel();
return 0;
}

static long minix_write_one_page(struct file *file, struct page *page, unsigned long offset, unsigned long bytes, const char *buf)
{
- return block_write_one_page(file, page, offset, bytes, buf, minix_getblk_block);
-}
+ return block_write_partial_page(file, page, offset, bytes, buf,
+minix_getblk_block); }

/*
* Write to a file (through the page cache).
@@ -104,12 +107,12 @@
NULL, /* rename */
NULL, /* readlink */
NULL, /* follow_link */
- generic_readpage, /* readpage */
- minix_writepage, /* writepage */
minix_bmap, /* bmap */
+ block_read_full_page, /* readpage */
+ minix_writepage, /* writepage */
+ block_flushpage, /* flushpage */
minix_truncate, /* truncate */
NULL, /* permission */
NULL, /* smap */
NULL, /* revalidate */
- block_flushpage, /* flushpage */
-};
+ };
--- linux/fs/minix/inode.c.alt Fri Jun 25 19:57:45 1999
+++ linux/fs/minix/inode.c Fri Jun 25 20:00:10 1999
@@ -19,6 +19,7 @@
#include <linux/stat.h>
#include <linux/locks.h>
#include <linux/init.h>
+#include <linux/smp_lock.h>

#include <asm/system.h>
#include <asm/uaccess.h>
@@ -456,10 +457,15 @@
*/
int minix_bmap(struct inode * inode, int block)
{
+ int ret;
+
+ lock_kernel();
if (INODE_VERSION(inode) == MINIX_V1)
- return V1_minix_bmap(inode, block);
+ ret = V1_minix_bmap(inode, block);
else
- return V2_minix_bmap(inode, block);
+ ret = V2_minix_bmap(inode, block);
+ unlock_kernel();
+ return ret;
}

/*
--- linux/fs/minix/symlink.c.alt Fri Jun 25 20:00:25 1999
+++ linux/fs/minix/symlink.c Fri Jun 25 20:07:27 1999
@@ -62,18 +62,16 @@
{
struct buffer_head * bh;
int i;
- char c;

if (buflen > 1023)
buflen = 1023;
bh = minix_bread(dentry->d_inode, 0, 0);
if (!bh)
return 0;
- i = 0;
- while (i<buflen && (c = bh->b_data[i])) {
- i++;
- put_user(c,buffer++);
- }
+
+ i = strnlen(bh->b_data, buflen);
+ copy_to_user(buffer, bh->b_data, i);
+
brelse(bh);
return i;
}
\
 
 \ /
  Last update: 2005-03-22 13:52    [W:0.094 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site