From: Sergei Antonov Subject: Re: [PATCH] hfsplus: add journal replay Date: Sun, 23 Feb 2014 07:41:37 +0100 Message-ID: <2C424236-BEED-4C90-9F27-BEEB70F95076@gmail.com> References: <1393135432.86384.YahooMailBasic@web172301.mail.ir2.yahoo.com> Mime-Version: 1.0 (1.0) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8BIT Cc: "linux-fsdevel@vger.kernel.org" To: "htl10@users.sourceforge.net" Return-path: Received: from mail-qa0-f44.google.com ([209.85.216.44]:38878 "EHLO mail-qa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750973AbaBWGll convert rfc822-to-8bit (ORCPT ); Sun, 23 Feb 2014 01:41:41 -0500 Received: by mail-qa0-f44.google.com with SMTP id w5so5109860qac.31 for ; Sat, 22 Feb 2014 22:41:41 -0800 (PST) In-Reply-To: <1393135432.86384.YahooMailBasic@web172301.mail.ir2.yahoo.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: > Am 23.02.2014 um 07:03 schrieb Hin-Tak Leung : > > ------------------------------ > On Sun, Feb 23, 2014 5:33 AM GMT Sergei Antonov wrote: > >>> --- a/fs/hfsplus/hfsplus_fs.h >>> +++ b/fs/hfsplus/hfsplus_fs.h >>> ... >>> @@ -166,6 +167,11 @@ struct hfsplus_sb_info { >>> u32 total_blocks; >>> u32 data_clump_blocks, rsrc_clump_blocks; >>> >>> + /* immutable data on the placement of the journal (if there is one) */ >>> + u64 journal_offset; /* relative to volume start */ >>> + u64 journal_size; /* relative to volume start */ >>> + bool journal_swab; /* need swap bytes in journal */ >>> + >>> /* mutable data from the volume header, protected by alloc_mutex */ >>> u32 free_blocks; >>> struct mutex alloc_mutex; >>> ... >>> >>> --- a/fs/hfsplus/hfsplus_raw.h >>> +++ b/fs/hfsplus/hfsplus_raw.h >>> @@ -105,7 +105,7 @@ struct hfsplus_vh { >>> __be16 version; >>> __be32 attributes; >>> __be32 last_mount_vers; >>> - u32 reserved; >>> + __be32 jrnl_info_block; >>> >>> __be32 create_date; >>> __be32 modify_date; >>> @@ -145,6 +145,69 @@ struct hfsplus_vh { >>> #define HFSPLUS_VOL_JOURNALED (1 < 13) >>> #define HFSPLUS_VOL_SOFTLOCK (1 < 15) >>> >>> +/* Journal info */ >>> +struct hfs_jrnl_info { >>> + __be32 flags; >>> + u32 unused[8]; >>> + __be64 journal_offset; /* Misaligned! relative to volume start */ >>> + __be64 journal_size; /* Misaligned! relative to volume start */ >>> +} __packed; >>> + >>> ... >>> >>> Storing journal_offset and journal_size in two places seems redundant >>> - the journal info block is part of the volume header struct, which is accessible >>> from the superblock struct. >> >> It is not in volume header. Only its block number is in header. > > Hmm, would be make sense to hook them up? seems a bit strange > to have a smaller loose-hanging struct which is 2/3 of the superblock addition. The structure has misaligned fields. It is only good for reading values through special misalignment-safe functions once. Temporal structure on a way to journal.