Re: [PATCH 0/5] mballoc: trivial code cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 7, 2011 at 7:41 PM, Ted Ts'o <tytso@xxxxxxx> 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux