linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/6] relax dirty check
@ 2004-10-20 23:13 Roman Zippel
  0 siblings, 0 replies; only message in thread
From: Roman Zippel @ 2004-10-20 23:13 UTC (permalink / raw)
  To: Andrew Morton, linux-fsdevel


hfs has two dirty bits, but currently OS X uses only one of them, so
match its behaviour, so that a uncleanly unmounted disk can be mounted
r/w again, after it has been checked.

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>

Index: linux-2.6-hfs/fs/hfs/mdb.c
===================================================================
--- linux-2.6-hfs.orig/fs/hfs/mdb.c	2004-10-19 19:34:42.000000000 +0200
+++ linux-2.6-hfs/fs/hfs/mdb.c	2004-10-21 00:43:00.652087825 +0200
@@ -200,8 +200,7 @@ int hfs_mdb_get(struct super_block *sb)
 	}
 
 	attrib = mdb->drAtrb;
-	if (!(attrib & cpu_to_be16(HFS_SB_ATTRIB_UNMNT))
-	    || (attrib & cpu_to_be16(HFS_SB_ATTRIB_INCNSTNT))) {
+	if (!(attrib & cpu_to_be16(HFS_SB_ATTRIB_UNMNT))) {
 		hfs_warn("HFS-fs warning: Filesystem was not cleanly unmounted, "
 			 "running fsck.hfs is recommended.  mounting read-only.\n");
 		sb->s_flags |= MS_RDONLY;
@@ -212,8 +211,9 @@ int hfs_mdb_get(struct super_block *sb)
 	}
 	if (!(sb->s_flags & MS_RDONLY)) {
 		/* Mark the volume uncleanly unmounted in case we crash */
-		mdb->drAtrb = attrib & cpu_to_be16(~HFS_SB_ATTRIB_UNMNT);
-		mdb->drAtrb = attrib | cpu_to_be16(HFS_SB_ATTRIB_INCNSTNT);
+		attrib &= cpu_to_be16(~HFS_SB_ATTRIB_UNMNT);
+		attrib |= cpu_to_be16(HFS_SB_ATTRIB_INCNSTNT);
+		mdb->drAtrb = attrib;
 		mdb->drWrCnt = cpu_to_be32(be32_to_cpu(mdb->drWrCnt) + 1);
 		mdb->drLsMod = hfs_mtime();
 
Index: linux-2.6-hfs/fs/hfs/super.c
===================================================================
--- linux-2.6-hfs.orig/fs/hfs/super.c	2004-10-19 19:34:42.000000000 +0200
+++ linux-2.6-hfs/fs/hfs/super.c	2004-10-21 00:43:00.652087825 +0200
@@ -98,8 +98,7 @@ int hfs_remount(struct super_block *sb, 
 	if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY))
 		return 0;
 	if (!(*flags & MS_RDONLY)) {
-		if (!(HFS_SB(sb)->mdb->drAtrb & cpu_to_be16(HFS_SB_ATTRIB_UNMNT))
-		    || (HFS_SB(sb)->mdb->drAtrb & cpu_to_be16(HFS_SB_ATTRIB_INCNSTNT))) {
+		if (!(HFS_SB(sb)->mdb->drAtrb & cpu_to_be16(HFS_SB_ATTRIB_UNMNT))) {
 			printk("HFS-fs warning: Filesystem was not cleanly unmounted, "
 			       "running fsck.hfs is recommended.  leaving read-only.\n");
 			sb->s_flags |= MS_RDONLY;
Index: linux-2.6-hfs/fs/hfsplus/super.c
===================================================================
--- linux-2.6-hfs.orig/fs/hfsplus/super.c	2004-10-19 19:34:43.000000000 +0200
+++ linux-2.6-hfs/fs/hfsplus/super.c	2004-10-21 00:43:00.683082502 +0200
@@ -246,8 +246,7 @@ int hfsplus_remount(struct super_block *
 	if (!(*flags & MS_RDONLY)) {
 		struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr;
 
-		if ((vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_INCNSTNT)) ||
-		    !(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) {
+		if (!(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) {
 			printk("HFS+-fs warning: Filesystem was not cleanly unmounted, "
 			       "running fsck.hfsplus is recommended.  leaving read-only.\n");
 			sb->s_flags |= MS_RDONLY;
@@ -332,8 +331,7 @@ static int hfsplus_fill_super(struct sup
 	sb->s_op = &hfsplus_sops;
 	sb->s_maxbytes = MAX_LFS_FILESIZE;
 
-	if ((vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_INCNSTNT)) ||
-	    !(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) {
+	if (!(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) {
 		if (!silent)
 			printk("HFS+-fs warning: Filesystem was not cleanly unmounted, "
 			       "running fsck.hfsplus is recommended.  mounting read-only.\n");

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-10-20 23:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-20 23:13 [PATCH 2/6] relax dirty check Roman Zippel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).