a new filesystem module for nilfs2
PATCH v3 1/1 a new filesystem module for nilfs2
Hi,
This is a revised patch to support nilfs2, a log file system. The patch is basically just a retrofit of the one I sent before against current tree.
I've checked it both on qemu and qemu-system-ppc with grub-fstest.
Thanks,
Regards,
Signature · 1 line
Jiro SEKIBA <[email protected]>
=== modified file 'conf/common.rmk'
common.rmk +10 -4
@@ -31,9 +31,9 @@ \ fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \ fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ - fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ - fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \ - fs/befs.c fs/befs_be.c fs/tar.c \ + fs/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c \ + fs/sfs.c fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c \ + fs/afs_be.c fs/befs.c fs/befs_be.c fs/tar.c \ \ partmap/msdos.c partmap/bsdlabel.c partmap/apple.c \ partmap/sun.c partmap/sunpc.c partmap/gpt.c \
@@ -69,7 +69,7 @@ \ fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \ fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ - fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ + fs/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c fs/befs.c \ fs/befs_be.c fs/tar.c \ \
@@ -298,6 +298,12 @@ minix_mod_CFLAGS = $(COMMON_CFLAGS) minix_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For nilfs2.mod. +pkglib_MODULES += nilfs2.mod +nilfs2_mod_SOURCES = fs/nilfs2.c +nilfs2_mod_CFLAGS = $(COMMON_CFLAGS) +nilfs2_mod_LDFLAGS = $(COMMON_LDFLAGS) + # For hfs.mod. hfs_mod_SOURCES = fs/hfs.c hfs_mod_CFLAGS = $(COMMON_CFLAGS)
=== modified file 'conf/i386-pc.rmk'
i386-pc.rmk +3 -3
@@ -82,9 +82,9 @@ \ fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \ fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ - fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ - fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \ - fs/befs.c fs/befs_be.c fs/tar.c \ + fs/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c \ + fs/sfs.c fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c \ + fs/afs_be.c fs/befs.c fs/befs_be.c fs/tar.c \ \ partmap/msdos.c partmap/bsdlabel.c partmap/sunpc.c \ partmap/gpt.c \
=== modified file 'conf/sparc64-ieee1275.rmk'
sparc64-ieee1275.rmk +3 -3
@@ -57,9 +57,9 @@ \ fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \ fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ - fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ - fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \ - fs/befs.c fs/befs_be.c fs/tar.c \ + fs/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c \ + fs/sfs.c fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c \ + fs/afs_be.c fs/befs.c fs/befs_be.c fs/tar.c \ \ partmap/amiga.c partmap/apple.c partmap/msdos.c \ partmap/bsdlabel.c partmap/sun.c partmap/acorn.c \
=== added file 'fs/nilfs2.c'
nilfs2.c +1125 -0
1,125 lines not on this page · raw message
Quoted 8 lines · Jiro SEKIBA
Hi,
This is a revised patch to support nilfs2, a log file system. The patch is basically just a retrofit of the one I sent before against current tree.
I've checked it both on qemu and qemu-system-ppc with grub-fstest.
Thanks for your effort.
I recommend running indent on all new files
+ * Copyright (C) 2010 Jiro SEKIBA <[email protected]>
+ */
This should go into
+ * Copyright (C) 2003,2004,2005,2007,2008,2010 Free Software Foundation, Inc.
Because of legal reason.
You can of course add a notion like:
/* Wrtitten by Jiro SEKIBA <[email protected]>. */
+/* nilfs btree node flag */
Please add a full stop. Some of th
+} __attribute__ ((packed));
Most structures in nilfs like in most modern FS need no __attribute__ ((packed)). And adding it inflicts performance penalty on RISC. +/** nilfs_fs.h **/
Your code doesn't look derived from any other nilfs implementation. I think these comments are only confusing.
+ {
+ s = 0;
+ goto out;
+ }
I think it would be slightly more clear by putting *indexp = index; return 1; here.
+ /* assume sizeof(struct grub_nilfs2_cpfile_header) <
+ sizeof(struct grub_nilfs2_checkpoint)
+ */
Capitalize and add a full stop please.
+ if(grub_errno)
+ {
+ grub_error(GRUB_ERR_BAD_FS,"disk read error\n");
+ return -1;
No need to run grub_error if grub_errno is already set
+ {
+ grub_error(GRUB_ERR_BAD_FS,"btree corruption\n");
+ return -1;
+ }
What do you think about possible fallback to iterate over all nodes in case of fs corruption?
+ grub_error(GRUB_ERR_BAD_FS,"btree lookup failure");
+ return GRUB_ERR_BAD_FS;
can be just done with:
return grub_error(GRUB_ERR_BAD_FS, "btree lookup failure");
Quoted 13 lines
Thanks,
Regards,
------------------------------------------------------------------------
------------------------------------------------------------------------
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 2 lines
Regards Vladimir 'φ-coder/phcoder' Serbinenko
Hi,
Thank you very much for the comments!
I revised the patch to reflect the comments.
Quoted 5 lines
(quoted diff) +4
-0+ { + grub_error(GRUB_ERR_BAD_FS,"btree corruption\n"); + return -1; + }What do you think about possible fallback to iterate over all nodes in case of fs corruption?
The case that btree is corrupted, it's very hard to take any action to recover because it is not possible to distinguish which block has meta data or which block has data without btree information.
nilfs2 has ability to mount old checkpoint by specifying checkpoint number. So using old checkpoint is one of the possible fallback if all the blocks belonging to the old checkpoint is healthy. But it requires some more work.
thanks,
regards
Signature · 1 line
Jiro SEKIBA <[email protected]>
=== modified file 'conf/common.rmk'
common.rmk +10 -4
@@ -31,9 +31,9 @@ \ fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \ fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ - fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ - fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \ - fs/befs.c fs/befs_be.c fs/tar.c \ + fs/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c \ + fs/sfs.c fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c \ + fs/afs_be.c fs/befs.c fs/befs_be.c fs/tar.c \ \ partmap/msdos.c partmap/bsdlabel.c partmap/apple.c \ partmap/sun.c partmap/sunpc.c partmap/gpt.c \
@@ -69,7 +69,7 @@ \ fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \ fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ - fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ + fs/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c fs/befs.c \ fs/befs_be.c fs/tar.c \ \
@@ -298,6 +298,12 @@ minix_mod_CFLAGS = $(COMMON_CFLAGS) minix_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For nilfs2.mod. +pkglib_MODULES += nilfs2.mod +nilfs2_mod_SOURCES = fs/nilfs2.c +nilfs2_mod_CFLAGS = $(COMMON_CFLAGS) +nilfs2_mod_LDFLAGS = $(COMMON_LDFLAGS) + # For hfs.mod. hfs_mod_SOURCES = fs/hfs.c hfs_mod_CFLAGS = $(COMMON_CFLAGS)
=== modified file 'conf/i386-pc.rmk'
i386-pc.rmk +3 -3
@@ -82,9 +82,9 @@ \ fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \ fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ - fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ - fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \ - fs/befs.c fs/befs_be.c fs/tar.c \ + fs/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c \ + fs/sfs.c fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c \ + fs/afs_be.c fs/befs.c fs/befs_be.c fs/tar.c \ \ partmap/msdos.c partmap/bsdlabel.c partmap/sunpc.c \ partmap/gpt.c \
=== modified file 'conf/sparc64-ieee1275.rmk'
sparc64-ieee1275.rmk +3 -3
@@ -57,9 +57,9 @@ \ fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \ fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ - fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ - fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \ - fs/befs.c fs/befs_be.c fs/tar.c \ + fs/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c \ + fs/sfs.c fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c \ + fs/afs_be.c fs/befs.c fs/befs_be.c fs/tar.c \ \ partmap/amiga.c partmap/apple.c partmap/msdos.c \ partmap/bsdlabel.c partmap/sun.c partmap/acorn.c \
=== added file 'fs/nilfs2.c'
nilfs2.c +1133 -0
1,133 lines not on this page · raw message
Committed. One question:
+ .reserved_first_sector = 1,
This line claims that overwriting first sector of nilfs won't destroy any data or metadata. Is it so?
Quoted 34 lines · Jiro SEKIBA
Hi,
Thank you very much for the comments!
I revised the patch to reflect the comments.Quoted 6 lines
nilfs2.c +4
-0+ { +grub_error (GRUB_ERR_BAD_FS ,"btree corruption\n" ); +return -1 ; + }What do you think about possible fallback to iterate over all nodes in case of fs corruption?
The case that btree is corrupted, it's very hard to take any action to recover because it is not possible to distinguish which block has meta data or which block has data without btree information.
nilfs2 has ability to mount old checkpoint by specifying checkpoint number. So using old checkpoint is one of the possible fallback if all the blocks belonging to the old checkpoint is healthy. But it requires some more work.
thanks,
regards
------------------------------------------------------------------------
------------------------------------------------------------------------
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 2 lines
Regards Vladimir 'φ-coder/phcoder' Serbinenko
Hi,
At Sat, 24 Apr 2010 22:12:52 +0200,
Quoted 2 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Committed. One question:
Thank you!
Quoted 4 lines
+ .reserved_first_sector = 1,
This line claims that overwriting first sector of nilfs won't destroy any data or metadata. Is it so?
Oh, that is the one I copied from fs/ext2.c without any doubt. But I think it's ok, since nilfs2 super block resides at 1K from begining of the parition. So any data within 1K will ignored.
I believe sector is assumed 512bytes, so first sector would be within 1K which is not used in nilfs2.
I checked with loop back device and write random data in first 1K, partion is healthy and mountable. And the range 0-1K is unchanged.
thanks
regards,
Quoted 42 lines
Quoted 34 lines · Jiro SEKIBA
Hi,
Thank you very much for the comments!
I revised the patch to reflect the comments.Quoted 6 lines
nilfs2.c +4
-0+ { +grub_error (GRUB_ERR_BAD_FS ,"btree corruption\n" ); +return -1 ; + }What do you think about possible fallback to iterate over all nodes in case of fs corruption?
The case that btree is corrupted, it's very hard to take any action to recover because it is not possible to distinguish which block has meta data or which block has data without btree information.
nilfs2 has ability to mount old checkpoint by specifying checkpoint number. So using old checkpoint is one of the possible fallback if all the blocks belonging to the old checkpoint is healthy. But it requires some more work.
thanks,
regards
------------------------------------------------------------------------
------------------------------------------------------------------------
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-develSignature · 2 lines
Regards Vladimir 'φ-coder/phcoder' Serbinenko
Signature · 1 line
Jiro SEKIBA <[email protected]>