[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTimOaQSdJa9aXEs_UM0pAO92S0_zGT5w7kU33etk@mail.gmail.com>
Date: Mon, 7 Feb 2011 22:59:54 +0200
From: Amir Goldstein <amir73il@...il.com>
To: "Ted Ts'o" <tytso@....edu>
Cc: i@...y.li, Ext4 Developers List <linux-ext4@...r.kernel.org>
Subject: Re: [PATCH 0/5] mballoc: trivial code cleanup
On Mon, Feb 7, 2011 at 7:41 PM, Ted Ts'o <tytso@....edu> wrote:
> On Sun, Feb 06, 2011 at 10:43:58AM +0200, Amir Goldstein wrote:
>> When looking at alloc_sem, I realized that it is only needed to avoid
>> race with adjacent group buddy initialization.
>
> Actually, alloc_sem is used to protect all of the block group specific
> data structures; the buddy bitmap counters, adjusting the buddy bitmap
> itself, the largest free order in a block group, etc. So even in the
> case where block_size == page_size, alloc_sem is still needed!
>
This was my assumption by the name of the lock itself, but when I searched where
down_write(alloc_sem) is called, I saw that it is called by 3 functions:
mb_init_group - for lazy init of buddy cache, once per mount per blockgroup,
before any alloc routines can access that blockgroup.
add_groupblocks - for online resize, even before lazy init of buddy cache.
init_inode_table - for lazy init of inode table, once per mkfs, per blockgroup.
it seems to me like down_write(alloc_sem) may be taken in mb_init_group()
*only* in case EXT4_MB_GRP_NEED_INIT(grp) and that all down_read(alloc_sem)
calls in mballoc.c serve no purpose when block_size == page_size.
I concluded that from the comment in mb_load_buddy():
/* Take the read lock on the group alloc
* sem. This would make sure a parallel
* ext4_mb_init_group happening on other
* groups mapped by the page is blocked
* till we are done with allocation
*/
it says alloc_sem protects against lazy init of adjacent groups
and says nothing about protecting block group specific data structures...
what am I missing???
what am I missing here???
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists