From: Jan Kara <jack@suse.cz>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Jan Kara <jack@suse.cz>, linux-ext4@vger.kernel.org
Subject: Re: [PATCH 1/4] libext2fs: Support for orphan file feature
Date: Mon, 25 May 2015 09:49:58 +0200 [thread overview]
Message-ID: <20150525074958.GC2387@quack.suse.cz> (raw)
In-Reply-To: <20150522173521.GB830@birch.djwong.org>
On Fri 22-05-15 10:35:21, Darrick J. Wong wrote:
> On Fri, May 22, 2015 at 01:28:54PM +0200, Jan Kara wrote:
...
> > diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
> > index 28c46701da29..1e303d5d59ca 100644
> > --- a/lib/ext2fs/ext2fs.h
> > +++ b/lib/ext2fs/ext2fs.h
> > @@ -555,7 +555,8 @@ typedef struct ext2_icount *ext2_icount_t;
> > EXT2_FEATURE_COMPAT_RESIZE_INODE|\
> > EXT2_FEATURE_COMPAT_DIR_INDEX|\
> > EXT2_FEATURE_COMPAT_EXT_ATTR|\
> > - EXT4_FEATURE_COMPAT_SPARSE_SUPER2)
> > + EXT4_FEATURE_COMPAT_SPARSE_SUPER2|\
> > + EXT4_FEATURE_COMPAT_ORPHAN_FILE)
> >
> > #ifdef CONFIG_MMP
> > #define EXT4_LIB_INCOMPAT_MMP EXT4_FEATURE_INCOMPAT_MMP
> > @@ -589,7 +590,8 @@ typedef struct ext2_icount *ext2_icount_t;
> > EXT4_FEATURE_RO_COMPAT_BIGALLOC|\
> > EXT4_LIB_RO_COMPAT_QUOTA|\
> > EXT4_FEATURE_RO_COMPAT_METADATA_CSUM|\
> > - EXT4_FEATURE_RO_COMPAT_READONLY)
> > + EXT4_FEATURE_RO_COMPAT_READONLY|\
> > + EXT4_FEATURE_RO_COMPAT_ORPHAN_PRESENT)
> >
> > /*
> > * These features are only allowed if EXT2_FLAG_SOFTSUPP_FEATURES is passed
> > @@ -1512,6 +1514,19 @@ errcode_t ext2fs_get_data_io(ext2_filsys fs, io_channel *old_io);
> > errcode_t ext2fs_set_data_io(ext2_filsys fs, io_channel new_io);
> > errcode_t ext2fs_rewrite_to_io(ext2_filsys fs, io_channel new_io);
> >
> > +/* orphan.c */
> > +/*
> > + * Minimum orphan file size (it must be at least 1 block and smaller one isn't
> > + * very useful).
> > + */
> > +#define EXT4_MIN_ORPHAN_FILE_SIZE 16384
>
> What about 64k block size? I guess it's fine not to use the whole block in
> this (non-default) configuration.
We round up file size to be a multiple of fs block size.
> > +struct mkorphan_info {
> > + char *buf;
> > + char *zerobuf;
> > + blk_t num_blocks;
> > + blk_t alloc_blocks;
> > + errcode_t err;
> > +};
> > +
> > +static int mkorphan_proc(ext2_filsys fs,
> > + blk64_t *blocknr,
> > + e2_blkcnt_t blockcnt,
> > + blk64_t ref_block EXT2FS_ATTR((unused)),
> > + int ref_offset EXT2FS_ATTR((unused)),
> > + void *priv_data)
> > +{
> > + struct mkorphan_info *oi = (struct mkorphan_info *)priv_data;
> > + blk64_t new_blk;
> > + errcode_t err;
> > +
> > + err = ext2fs_new_block2(fs, 0, 0, &new_blk);
>
> Hm. I think this breaks the cluster allocation rules, since this allocates
> a new block for every logical block inside a cluster.
Yes, I didn't think of cluster allocation. Frankly, I have just mirrored
what a code creating journal does. If this is wrong, then that code needs
fixing as well ;)
> Hopefully ext2fs_fallocate will land soon, then we can get rid of open-coding
> file block allocation like this. You'll still have to have the iterate3 loop
> to write out the appropriate block footer, but iirc the library call can be
> told to allocate written extents without zeroing the blocks, precisely for
> cases like these.
So should I wait for that or do you have any pointer to code which does
it correctly?
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2015-05-25 7:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-22 11:28 [PATCH 0/4] e2fsprogs: Support for orphan file feature Jan Kara
2015-05-22 11:28 ` [PATCH 1/4] libext2fs: " Jan Kara
2015-05-22 17:35 ` Darrick J. Wong
2015-05-25 7:49 ` Jan Kara [this message]
2015-05-22 21:59 ` Andreas Dilger
2015-05-25 8:01 ` Jan Kara
2015-05-22 11:28 ` [PATCH 2/4] mke2fs: Add support for orphan_file feature Jan Kara
2015-05-22 11:28 ` [PATCH 3/4] e2fsck: Add support for handling orphan file Jan Kara
2015-05-22 11:28 ` [PATCH 4/4] tune2fs: Add support for orphan_file feature Jan Kara
2015-05-22 17:18 ` Darrick J. Wong
2015-05-25 7:38 ` Jan Kara
2015-05-25 16:16 ` Andreas Dilger
2015-05-26 7:24 ` Jan Kara
2015-05-22 15:51 ` [PATCH 0/4] e2fsprogs: Support for orphan file feature Albino Biasutti Neto
2015-05-25 7:19 ` Jan Kara
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=20150525074958.GC2387@quack.suse.cz \
--to=jack@suse.cz \
--cc=darrick.wong@oracle.com \
--cc=linux-ext4@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.