Skip to contentSkip to conversation

what fsck does to the hfs+ journal

DISCUSSION Hin-Tak Leung 2 participants 2 messages Apr 5, 2014 VFS

lore
Share & tools
lore
#0 lore raw

Hi,

I have somewhat looked at what fsck does to unclean journals, and the outcome is surprising.

I have another darwin virtual machine which I killed for some other reason while doing some heavy writing.

- xnu replays an unclean journal with "replay_journal: from x to y (joffset 0xZZZZZZZ)"

- running fsck on its disk image, always results in xnu outputing "journal start/end pointer reset". This behavior is cleared only after the first rw mount. You can keep seeing the same message if you keep booting single user mode (i.e. read-only mount).

On first read-write mount, I get "Remove x orphaned /unlinked files and y directories", under either case.

There is a JOURNAL_RESET flag in the xnu code, which results in the pointer reset message, but diskdev_cmds does not even have this define.
(it does have JOURNAL_NO_GROUP_COMMIT, however), so I don't know how it was set (yet).

xnu/bsd/vfs/vfs_journal.h-293-/*
xnu/bsd/vfs/vfs_journal.h-294- * flags for journal_create/open. only can use xnu/bsd/vfs/vfs_journal.h-295- * the low 16 bits for flags because internal xnu/bsd/vfs/vfs_journal.h-296- * bits go in the high 16. xnu/bsd/vfs/vfs_journal.h-297- */
xnu/bsd/vfs/vfs_journal.h-298-#define JOURNAL_NO_GROUP_COMMIT 0x00000001
xnu/bsd/vfs/vfs_journal.h:299:#define JOURNAL_RESET 0x00000002

journal replay results in a bigger amount of file system change, than just fsck + mount rw. (in fact in the latter case, it seems there is a lot of fs changes on the first rw mount after).

Do we remove orphaned/unlinked files directories on read-write mount of hfs+ in the linux kernel?

Hin-Tak

#1 lore raw

Hi Hin-Tak,

Quoted 3 lines · Hin-Tak Leung

Do we remove orphaned/unlinked files directories on read-write mount of hfs+ in the linux kernel?

As far as I can judge, current state of HFS+ driver doesn't try to remove orphaned/unlinked files during RW mount. I think that it needs to be implemented.

Thanks,
Vyacheslav Dubeyko.