linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* hfsplus journal detection - try 3
@ 2008-11-08  8:55 Warren Turkal
  2008-11-08  8:55 ` [PATCH] Identify journal info block in volume header Warren Turkal
  0 siblings, 1 reply; 3+ messages in thread
From: Warren Turkal @ 2008-11-08  8:55 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Roman Zippel, Warren Turkal

Here's the third try for this improved journal detection for HFS+. It
allows the HFS+ volume to be mounted rw with having to use the force
mount option in the case where the journal info block in the volume
header is 0 and journal attribute bit is on. Please review and consider
for inclusion.

Thanks,
wt

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] Identify journal info block in volume header.
  2008-11-08  8:55 hfsplus journal detection - try 3 Warren Turkal
@ 2008-11-08  8:55 ` Warren Turkal
  2008-11-08  8:55   ` [PATCH] Fix journal detection on HFS+ Warren Turkal
  0 siblings, 1 reply; 3+ messages in thread
From: Warren Turkal @ 2008-11-08  8:55 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Roman Zippel, Warren Turkal

Signed-off-by: Warren Turkal <wt@penguintechs.org>
---
 fs/hfsplus/hfsplus_raw.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/hfsplus/hfsplus_raw.h b/fs/hfsplus/hfsplus_raw.h
index fe99fe8..14f1dd8 100644
--- a/fs/hfsplus/hfsplus_raw.h
+++ b/fs/hfsplus/hfsplus_raw.h
@@ -94,7 +94,7 @@ struct hfsplus_vh {
 	__be16 version;
 	__be32 attributes;
 	__be32 last_mount_vers;
-	u32 reserved;
+	__be32 journal_info_block;
 
 	__be32 create_date;
 	__be32 modify_date;
-- 
1.5.6.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] Fix journal detection on HFS+.
  2008-11-08  8:55 ` [PATCH] Identify journal info block in volume header Warren Turkal
@ 2008-11-08  8:55   ` Warren Turkal
  0 siblings, 0 replies; 3+ messages in thread
From: Warren Turkal @ 2008-11-08  8:55 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Roman Zippel, Warren Turkal

The code was unconditionally assumming that the volume had a jounal if the
jounal attribute was set in the volume header. However, the volume also has to
have a non-zero journal info block to actually have a journal.

Signed-off-by: Warren Turkal <wt@penguintechs.org>
---
 fs/hfsplus/super.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index eb74531..128101b 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -17,9 +17,16 @@
 
 static struct inode *hfsplus_alloc_inode(struct super_block *sb);
 static void hfsplus_destroy_inode(struct inode *inode);
+static bool hfsplus_vol_has_journal(struct hfsplus_vh *vhdr);
 
 #include "hfsplus_fs.h"
 
+static bool hfsplus_vol_has_journal(struct hfsplus_vh *vhdr)
+{
+	return (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_JOURNALED) &&
+				vhdr->journal_info_block);
+}
+
 struct inode *hfsplus_iget(struct super_block *sb, unsigned long ino)
 {
 	struct hfs_find_data fd;
@@ -260,7 +267,7 @@ static int hfsplus_remount(struct super_block *sb, int *flags, char *data)
 			printk(KERN_WARNING "hfs: filesystem is marked locked, leaving read-only.\n");
 			sb->s_flags |= MS_RDONLY;
 			*flags |= MS_RDONLY;
-		} else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_JOURNALED)) {
+		} else if (hfsplus_vol_has_journal(vhdr)) {
 			printk(KERN_WARNING "hfs: filesystem is marked journaled, leaving read-only.\n");
 			sb->s_flags |= MS_RDONLY;
 			*flags |= MS_RDONLY;
@@ -356,7 +363,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
 	} else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_SOFTLOCK)) {
 		printk(KERN_WARNING "hfs: Filesystem is marked locked, mounting read-only.\n");
 		sb->s_flags |= MS_RDONLY;
-	} else if ((vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_JOURNALED)) && !(sb->s_flags & MS_RDONLY)) {
+	} else if (hfsplus_vol_has_journal(vhdr) && !(sb->s_flags & MS_RDONLY)) {
 		printk(KERN_WARNING "hfs: write access to a journaled filesystem is not supported, "
 		       "use the force option at your own risk, mounting read-only.\n");
 		sb->s_flags |= MS_RDONLY;
-- 
1.5.6.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-11-08  8:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-08  8:55 hfsplus journal detection - try 3 Warren Turkal
2008-11-08  8:55 ` [PATCH] Identify journal info block in volume header Warren Turkal
2008-11-08  8:55   ` [PATCH] Fix journal detection on HFS+ Warren Turkal

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).