linux-embedded.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phillip Lougher <phillip@lougher.demon.co.uk>
To: "David P. Quigley" <dpquigl@tycho.nsa.gov>
Cc: akpm@linux-foundation.org, linux-embedded@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	tim.bird@am.sony.com
Subject: Re: Subject: [PATCH 12/16] Squashfs: header files
Date: Tue, 21 Oct 2008 19:17:30 +0100	[thread overview]
Message-ID: <48FE1CBA.8080805@lougher.demon.co.uk> (raw)
In-Reply-To: <1224606318.31157.80.camel@moss-terrapins.epoch.ncsc.mil>

David P. Quigley wrote:

> 
> Something that seems weird is the inconsistency in the ordering of these
> structs. The base part is the same across all inodes but for your
> reg/lreg dir/ldir pairs you seem to shuffle the order of the added
> parts. Is there a reason for this? Is their layout the same on disk
> (baring the extra data in the l versions)? If so they probably should be
> the same in the struct.
> 
> 

They're deliberately shuffled about to eliminate holes (due to alignment 
contraints), and to maximise compression.  Shifting to cluster similar 
fields can get better compression, and the current layout is the result 
of a lot of work to to get the best ordering.

For example:

 >> +struct squashfs_reg_inode {
 >> +	__le16			inode_type;
 >> +	__le16			mode;
 >> +	__le16			uid;
 >> +	__le16			guid;
 >> +	__le32			mtime;
 >> +	__le32	 		inode_number;
 >> +	__le32			start_block;
 >> +	__le32			fragment;
 >> +	__le32			offset;
 >> +	__le32			file_size;
 >> +	__le16			block_list[0];
 >> +};

Inode_number, start_block, fragment clustered together because in most 
filesystems they'll contain a lot of zero bits (filesystems mainly being 
small).  Better compression.

 >> +
 >> +struct squashfs_lreg_inode {
 >> +	__le16			inode_type;
 >> +	__le16			mode;
 >> +	__le16			uid;
 >> +	__le16			guid;
 >> +	__le32			mtime;
 >> +	__le32	 		inode_number;
 >> +	__le64			start_block;
 >> +	__le64			file_size;
 >> +	__le64			sparse;
 >> +	__le32			nlink;
 >> +	__le32			fragment;
 >> +	__le32			offset;
 >> +	__le32			xattr;
 >> +	__le16			block_list[0];
 >> +};

Start_block, file_size have been doubled, and the fragment field 
consequently moved to preserve 64-bit alignment constraints on 64-bit 
quantities (no holes).  Plus moving fragment means it can be grouped 
with the new nlink field giving a nice run of zero bits (non-extended 
regular files have an implicit nlink of 1).

  reply	other threads:[~2008-10-21 18:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-17 15:42 Subject: [PATCH 12/16] Squashfs: header files Phillip Lougher
2008-10-21 16:25 ` David P. Quigley
2008-10-21 18:17   ` Phillip Lougher [this message]
2008-10-22 16:13 ` Geert Uytterhoeven
2008-10-23  8:56   ` Phillip Lougher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48FE1CBA.8080805@lougher.demon.co.uk \
    --to=phillip@lougher.demon.co.uk \
    --cc=akpm@linux-foundation.org \
    --cc=dpquigl@tycho.nsa.gov \
    --cc=linux-embedded@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tim.bird@am.sony.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).