linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jörn Engel" <joern@logfs.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-mtd@lists.infradead.org
Subject: Re: [patch 2/15] fs/logfs/logfs_abi.h
Date: Tue, 8 Apr 2008 11:39:46 +0200	[thread overview]
Message-ID: <20080408093946.GA31266@logfs.org> (raw)
In-Reply-To: <200804080224.18014.arnd@arndb.de>

On Tue, 8 April 2008 02:24:17 +0200, Arnd Bergmann wrote:
> 
> Great to see a new version finally posted again!

As Artem already noted, the transition to write-back caching was a
significant change and initially caused a huge drop in quality.  Took a
while.

> On Tuesday 01 April 2008, joern@logfs.org wrote:
> > --- /dev/null	2008-04-02 16:29:12.813336657 +0200
> > +++ linux-2.6.24logfs/fs/logfs/logfs_abi.h	2008-04-01 21:02:34.980239877 +0200
> > @@ -0,0 +1,523 @@
> > +/*
> > + * fs/logfs/logfs.h
> 
> The comment doesn't match the file name, and the file name doesn't
> match the purpose -- you are not defining an "application" binary
> interface but rather the medium format, with the small exception
> of the chattr flags.

Now it matches the file name.  If you have a better name than "abi",
I'll use that.

> > +#ifndef fs_logfs_logfs_abi_h
> > +#define fs_logfs_logfs_abi_h
> 
> Everyone else uses capital letters for these.

Changed.

> > +/*
> > + * LOGFS_HEADERSIZE is the size of a single header in the object store,
> > + * LOGFS_MAX_OBJECTSIZE the size of the largest possible object, including
> > + * its header,
> > + * LOGFS_SEGMENT_RESERVE is the amount of space reserved for each segment for
> > + * its segment header and the padded space at the end when no further objects
> > + * fit.
> > + */
> > +#define LOGFS_HEADERSIZE	(0x1c)
> > +#define LOGFS_SEGMENT_HEADERSIZE (0x18)
> > +#define LOGFS_MAX_OBJECTSIZE	(LOGFS_HEADERSIZE + LOGFS_BLOCKSIZE)
> > +#define LOGFS_SEGMENT_RESERVE	(LOGFS_HEADERSIZE + LOGFS_MAX_OBJECTSIZE - 1)
> 
> The comment makes it sound like the last line should be
> 
> #define LOGFS_SEGMENT_RESERVE (LOGFS_SEGMENT_HEADERSIZE + LOGFS_MAX_OBJECTSIZE - 1)

Correct.  Changed.

> > +/**
> > + * struct logfs_disk_dentry - on-medium dentry structure
> > + *
> > + * @ino:			inode number
> > + * @namelen:			length of file name
> > + * @type:			file type, identical to bits 12..15 of mode
> > + * @name:			file name
> > + */
> > +struct logfs_disk_dentry {
> > +	__be64	ino;
> > +	__be16	namelen;
> > +	__u8	type;
> > +	__u8	name[LOGFS_MAX_NAMELEN];
> > +} __attribute__((packed));
> 
> With LOGFS_MAX_NAMELEN == 255, this data structure is not aligned to 64
> bits, which means that accessing the inode number requires unaligned
> memory accesses when you have an array of logfs_disk_dentry structures
> on the medium. Is that intentional?
> 
> If you add another 32 bits here, you don't need the __packed any more.

6 bytes, actually.  Not a bad idea.  I just have to make sure they are
properly zeroed and don't cause an information leak.

> > +/**
> > + * struct logfs_object_header - per-object header in the ostore
> > + *
> > + * @crc:			crc32 of header, excluding data_crc
> > + * @len:			length of data
> > + * @type:			object type, see above
> > + * @compr:			compression type
> > + * @ino:			inode number
> > + * @bix:			block index
> > + * @data_crc:			crc32 of payload
> > + */
> > +struct logfs_object_header {
> > +	__be32	crc;
> > +	__be16	len;
> > +	__u8	type;
> > +	__u8	compr;
> > +	__be64	ino;
> > +	__be64	bix;
> > +	__be32	data_crc;
> > +} __attribute__((packed));
> 
> Similarly, this structure contains 8 byte members but has a smaller
> size.

I really don't want to enlarge the structure.  Every single block gets
one of them, so they cause a significant overhead.  Adding padding for
the in-memory structure and not copying it to/from the medium would make
sense, but that's not a trivial change.  Needs more thought.

For the record, I removed the __packed on all other structures and
replaced it with something like this:

#define SIZE_CHECK(type, size)					\
static inline void check_##type(void)				\
{								\
	BUILD_BUG_ON(sizeof(struct type) != (size));		\
}

...

struct logfs_journal_header {
	__be32	h_crc;
	__be16	h_len;
	__be16	h_datalen;
	__be16	h_type;
	__be16	h_version;
	__u8	h_compr;
	__u8	h_pad[3];
};

SIZE_CHECK(logfs_journal_header, 16);

Jörn

-- 
Do not stop an army on its way home.
-- Sun Tzu
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2008-04-08  9:39 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-01 18:13 [patch 0/15] LogFS take five joern
2008-04-01 18:13 ` [patch 2/15] fs/logfs/logfs_abi.h joern
2008-04-08  0:24   ` Arnd Bergmann
2008-04-08  9:39     ` Jörn Engel [this message]
2008-04-08 21:52       ` Andres Salomon
2008-04-09 12:08         ` Jörn Engel
2008-04-01 18:13 ` [patch 5/15] fs/logfs/dir.c joern
2008-04-04  6:22   ` Kyungmin Park
2008-04-01 18:13 ` [patch 11/15] fs/logfs/readwrite.c joern
2008-04-01 18:13 ` [patch 3/15] fs/logfs/logfs.h joern
2008-04-08  0:35   ` Arnd Bergmann
2008-04-08  9:41     ` Jörn Engel
2008-04-01 18:13 ` [patch 13/15] fs/logfs/super.c joern
2008-04-01 18:13 ` [patch 14/15] fs/logfs/dev_bdev.c joern
2008-04-01 18:13 ` [patch 6/15] fs/logfs/file.c joern
2008-04-01 18:13 ` [patch 12/15] fs/logfs/segment.c joern
2008-04-01 18:13 ` [patch 9/15] fs/logfs/journal.c joern
2008-04-01 18:13 ` [patch 1/15] Makefiles and Kconfig joern
2008-04-07  8:28   ` Christian Borntraeger
2008-04-07  8:40     ` Jörn Engel
2008-04-08  0:30   ` Arnd Bergmann
2008-04-08  8:33     ` Jörn Engel
2008-04-08 13:41       ` Arnd Bergmann
2008-04-08 13:52         ` Jörn Engel
2008-04-01 18:13 ` [patch 10/15] fs/logfs/memtree.c joern
2008-04-10 14:07   ` Arnd Bergmann
2008-04-11 10:37     ` Jörn Engel
2008-04-01 18:13 ` [patch 8/15] fs/logfs/inode.c joern
2008-04-04  6:57   ` Kyungmin Park
2008-04-07 11:12     ` Jörn Engel
2008-04-01 18:13 ` [patch 15/15] fs/logfs/dev_mtd.c joern
2008-04-01 18:13 ` [patch 4/15] fs/logfs/compr.c joern
2008-04-10 14:13   ` Arnd Bergmann
2008-04-11 10:41     ` Jörn Engel
2008-04-01 18:13 ` [patch 7/15] fs/logfs/gc.c joern
2008-04-03 17:13 ` [patch 0/15] LogFS take five^Wsix Jörn Engel
2008-04-04 11:46 ` [patch 0/15] LogFS take five Jens Axboe
2008-04-07  8:22   ` Jörn Engel
2008-04-07  8:28     ` Jens Axboe
2008-04-07  9:10       ` Jörn Engel
2008-04-07  9:17         ` Jens Axboe

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=20080408093946.GA31266@logfs.org \
    --to=joern@logfs.org \
    --cc=arnd@arndb.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    /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).