From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 02/12] repair: allocate and free inode records individually
Date: Tue, 13 Dec 2011 10:16:29 +1100 [thread overview]
Message-ID: <20111212231629.GV14273@dastard> (raw)
In-Reply-To: <20111202174741.284403190@bombadil.infradead.org>
On Fri, Dec 02, 2011 at 12:46:21PM -0500, Christoph Hellwig wrote:
> Instead of allocating inode records in chunks and keeping a freelist of them
> which never gets released to the system memory allocator use plain malloc
> and free for them. The freelist just means adding a global lock instead
> of relying on malloc and free which could be implemented lockless, and the
> freelist is almost completely worthless as we are done allocating new
> inode records once we start freeing them in major quantities.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
OK, the freelist has been there since at least before the start of
the git tree history, but the locking was added as part of the
threading of repair back in 2007....
It looks to me like the allocation strategy is similar to the way
log tickets used to be allocated - a roll-your-own slab cache to
work around an inefficient memory allocator....
.....
> - /* initialize node */
> -
> - ino_rec->ino_startnum = 0;
> - ino_rec->ino_confirmed = 0;
> - ino_rec->ino_isa_dir = 0;
> - ino_rec->ir_free = (xfs_inofree_t) - 1;
> - ino_rec->ino_un.ex_data = NULL;
> - ino_rec->nlinkops = &nlinkops[0];
> - ino_rec->disk_nlinks = calloc(1, nlinkops[0].nlink_size);
> - if (ino_rec->disk_nlinks == NULL)
> + irec = malloc(sizeof(*irec));
> + if (!irec)
> + do_error(_("inode map malloc failed\n"));
> +
> + irec->avl_node.avl_nextino = NULL;
> + irec->avl_node.avl_forw = NULL;
> + irec->avl_node.avl_back = NULL;
> +
> + irec->ino_startnum = starting_ino;
OK, so you moved this initialisation into the init function instead
of doing it externally. Seems OK - both callers do post-init of
this, so no reason why not to do it here.
Everything else looks fine. the renaming of mk_ino_tree_nodes()
makes it kind of obvious now what that function is doing, too, so
that is good...
Reviewed-by: Dave Chinner <dchinner@redhat.com>
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2011-12-12 23:16 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-02 17:46 [PATCH 00/12] xfs_repair queue Christoph Hellwig
2011-12-02 17:46 ` [PATCH 01/12] repair: do not walk the unlinked inode list Christoph Hellwig
2011-12-12 22:55 ` Dave Chinner
2012-01-12 19:30 ` Mark Tinguely
2011-12-02 17:46 ` [PATCH 02/12] repair: allocate and free inode records individually Christoph Hellwig
2011-12-12 23:16 ` Dave Chinner [this message]
2012-01-12 22:38 ` Mark Tinguely
2011-12-02 17:46 ` [PATCH 03/12] repair: allocate and free extent " Christoph Hellwig
2011-12-12 23:21 ` Dave Chinner
2012-01-12 22:39 ` Mark Tinguely
2011-12-02 17:46 ` [PATCH 04/12] xfsprogs: allow linking against libtcmalloc Christoph Hellwig
2011-12-13 0:05 ` Dave Chinner
2011-12-18 22:47 ` Christoph Hellwig
2011-12-02 17:46 ` [PATCH 05/12] repair: update extent count after zapping duplicate blocks Christoph Hellwig
2011-12-13 2:12 ` Dave Chinner
2012-02-02 12:39 ` [PATCH v2] " Christoph Hellwig
2012-02-02 18:19 ` Mark Tinguely
2012-01-13 17:18 ` [PATCH 05/12] " Mark Tinguely
2011-12-02 17:46 ` [PATCH 06/12] repair: use recursive buffer locking Christoph Hellwig
2011-12-13 2:22 ` Dave Chinner
2011-12-18 22:54 ` Christoph Hellwig
2012-01-13 20:10 ` Mark Tinguely
2011-12-02 17:46 ` [PATCH 07/12] repair: fix another ABBA deadlock in inode prefetching Christoph Hellwig
2011-12-13 2:35 ` Dave Chinner
2012-01-13 18:51 ` Mark Tinguely
2011-12-02 17:46 ` [PATCH 08/12] repair: handle filesystems with the log in allocation group 0 Christoph Hellwig
2011-12-13 2:36 ` Dave Chinner
2012-01-13 15:18 ` Mark Tinguely
2011-12-02 17:46 ` [PATCH 09/12] repair: kill check_inode_block Christoph Hellwig
2012-01-11 11:29 ` Christoph Hellwig
2012-01-11 21:28 ` Mark Tinguely
2011-12-02 17:46 ` [PATCH 10/12] repair: mark local functions static Christoph Hellwig
2012-01-11 11:30 ` Christoph Hellwig
2012-01-11 21:37 ` Mark Tinguely
2011-12-02 17:46 ` [PATCH 11/12] repair: move extern declarations to headers Christoph Hellwig
2012-01-11 11:30 ` Christoph Hellwig
2012-01-11 21:40 ` Mark Tinguely
2011-12-02 17:46 ` [PATCH 12/12] repair: cleanup inode record macros Christoph Hellwig
2012-01-11 11:30 ` Christoph Hellwig
2012-01-12 17:05 ` Mark Tinguely
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=20111212231629.GV14273@dastard \
--to=david@fromorbit.com \
--cc=hch@infradead.org \
--cc=xfs@oss.sgi.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