# Patch to add reiser4 to 2.6.7-ck1

## Calchan

I made a small patch to add reiser4 to kernel 2.6.7-ck1. Here's how to use it.

Download and apply (on top of 2.6.7-ck1) the june 17th auto-snapshot from namesys here:

http://www.namesys.com/auto-snapshots/reiser4-2004.06.17-19.36-linux-2.6.7-rc3-mm1.diff.gz

There will be 5 failed hunks and a compile error if you try and compile it blindly. That's OK, that's what the patch below is for.

```
diff -Nadurp linux-2.6.7-ck1+reiser4-unfixed/arch/i386/kernel/entry.S linux-2.6.7-ck1+reiser4-fixed/arch/i386/kernel/entry.S

--- linux-2.6.7-ck1+reiser4-unfixed/arch/i386/kernel/entry.S   2004-06-18 15:28:26.268807608 +0000

+++ linux-2.6.7-ck1+reiser4-fixed/arch/i386/kernel/entry.S   2004-06-18 16:35:06.709648160 +0000

@@ -886,5 +886,10 @@ ENTRY(sys_call_table)

    .long sys_mq_notify

    .long sys_mq_getsetattr

    .long sys_ni_syscall      /* reserved for kexec */

+#ifdef CONFIG_REISER4_FS

+   .long sys_reiser4

+#else

+   .long sys_ni_syscall

+#endif

 

 syscall_table_size=(.-sys_call_table)

diff -Nadurp linux-2.6.7-ck1+reiser4-unfixed/fs/reiser4/plugin/object.c linux-2.6.7-ck1+reiser4-fixed/fs/reiser4/plugin/object.c

--- linux-2.6.7-ck1+reiser4-unfixed/fs/reiser4/plugin/object.c   2004-06-18 15:28:27.270655304 +0000

+++ linux-2.6.7-ck1+reiser4-fixed/fs/reiser4/plugin/object.c   2004-06-18 16:37:56.076900424 +0000

@@ -976,7 +976,6 @@ static void delete_inode_common(struct i

     * FIXME: this resembles generic_delete_inode

     */

    list_del_init(&object->i_list);

-   list_del_init(&object->i_sb_list);

    object->i_state |= I_FREEING;

    inodes_stat.nr_inodes--;

    spin_unlock(&inode_lock);

diff -Nadurp linux-2.6.7-ck1+reiser4-unfixed/include/asm-i386/unistd.h linux-2.6.7-ck1+reiser4-fixed/include/asm-i386/unistd.h

--- linux-2.6.7-ck1+reiser4-unfixed/include/asm-i386/unistd.h   2004-06-18 15:28:27.672594200 +0000

+++ linux-2.6.7-ck1+reiser4-fixed/include/asm-i386/unistd.h   2004-06-18 16:35:06.715647248 +0000

@@ -289,8 +289,9 @@

 #define __NR_mq_notify      (__NR_mq_open+4)

 #define __NR_mq_getsetattr   (__NR_mq_open+5)

 #define __NR_sys_kexec_load   283

-

-#define NR_syscalls 284

+#define __NR_reiser4      284

+  

+#define NR_syscalls       291

 

 /* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */

 

diff -Nadurp linux-2.6.7-ck1+reiser4-unfixed/include/linux/fs.h linux-2.6.7-ck1+reiser4-fixed/include/linux/fs.h

--- linux-2.6.7-ck1+reiser4-unfixed/include/linux/fs.h   2004-06-18 15:28:27.705589184 +0000

+++ linux-2.6.7-ck1+reiser4-fixed/include/linux/fs.h   2004-06-18 16:35:06.716647096 +0000

@@ -799,8 +799,52 @@ struct super_block {

        atomic_t s_media_changed;

 #endif

 

+   struct list_head s_entries;             /* list of

+                   * sb_entries. Protected

+                   * by ->s_umount. */

+};

+

+/*

+ * file system kobject.

+ *

+ * fs_kobject is used to export per-super-block information in sysfs

+ * while providing synchronization against concurrent umount. To this

+ * end it includes struct sb_entry that is attached to the super block

+ * by fs_kobject_register() and detached by fs_kobject_unregister().

+ *

+ * We need these wrappers (see fs/super.c:fs_kattr_{show,store}()),

+ * because it's impossible to handle module unloading races properly

+ * from within file-system code. Viz get_sb_entry() avoids umount races

+ * by acquiring reference to the super block (through sget()), but this

+ * may very well be the _last_ reference to the file-system, and

+ * put_sb_entry() will trigger module unload, which means that

+ * put_sb_entry() should be called from the generic code rather than

+ * from file-system module.

+ */

+struct fs_kobject {

+   struct sb_entry entry;

+   struct kobject  kobj; /* it should be kobj for compatibility

+                * with silly kobject.h macros */

+};

+

+/*

+ * file system kattr. See struct fs_kobject.

+ */

+struct fs_kattr {

+   struct attribute kattr;

+   ssize_t (*show) (struct super_block *,

+          struct fs_kobject *, struct fs_kattr *, char *);

+   ssize_t (*store) (struct super_block *, struct fs_kobject *,

+           struct fs_kattr *, const char *, size_t);

 };

 

+/* in fs/super.c */

+

+int fs_kobject_register(struct super_block *s, struct fs_kobject * fskobj);

+void fs_kobject_unregister(struct fs_kobject * fskobj);

+

+extern struct sysfs_ops fs_attr_ops;

+

 /*

  * Snapshotting support.

  */

diff -Nadurp linux-2.6.7-ck1+reiser4-unfixed/kernel/sched.c linux-2.6.7-ck1+reiser4-fixed/kernel/sched.c

--- linux-2.6.7-ck1+reiser4-unfixed/kernel/sched.c   2004-06-18 15:28:27.752582040 +0000

+++ linux-2.6.7-ck1+reiser4-fixed/kernel/sched.c   2004-06-18 16:35:06.718646792 +0000

@@ -3578,6 +3578,7 @@ void __init sched_init(void)

    for (i = 0; i < NR_CPUS; i++) {

       rq = cpu_rq(i);

       spin_lock_init(&rq->lock);

+      spin_lock_dont_check(&rq->lock);

       

       rq->cache_ticks = 0;

       rq->preempted = 0;

diff -Nadurp linux-2.6.7-ck1+reiser4-unfixed/mm/truncate.c linux-2.6.7-ck1+reiser4-fixed/mm/truncate.c

--- linux-2.6.7-ck1+reiser4-unfixed/mm/truncate.c   2004-06-18 15:28:27.759580976 +0000

+++ linux-2.6.7-ck1+reiser4-fixed/mm/truncate.c   2004-06-18 16:35:06.719646640 +0000

@@ -74,6 +74,9 @@ invalidate_complete_page(struct address_

    if (PagePrivate(page) && !try_to_release_page(page, 0))

       return 0;

 

+   if (page->mapping != mapping)

+      return 0;

+

    spin_lock_irq(&mapping->tree_lock);

    if (PageDirty(page)) {

       spin_unlock_irq(&mapping->tree_lock);

```

----------

## PrakashP

Warning: Doing copy and paste from above won't work. Do a quoted reply and then a copy and paste from the edit window...

----------

## borkdox

I hope it works with http://www.namesys.com/auto-snapshots/reiser4-2004.06.18-19.37-linux-2.6.7-rc3-mm1.diff.gz.

----------

## borkdox

yes it does,   :Cool: 

----------

## galah

Hey,

I applied the reiser4 patch but ended up with 7 chunk errors not 5. Your patch (thx) fixed the five you mentioned.

Perhaps I'm missing something!

Would you mind posting the patch commands you used t apply both patches?

Regards, 

Galah

----------

