From: OGAWA Hirofumi Subject: Re: [PATCH][RFC] vfs: block_read_full_page allocates array depending on environment Date: Mon, 01 Feb 2010 18:05:48 +0900 Message-ID: <874om1z5oz.fsf@devron.myhome.or.jp> References: <20100129095356.265D.61FB500B@jp.fujitsu.com> <87k4v0f72r.fsf@devron.myhome.or.jp> <20100201172105.14DE.61FB500B@jp.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Alexander Viro , linux-fsdevel@vger.kernel.org To: Masayoshi MIZUMA Return-path: Received: from mail.parknet.co.jp ([210.171.160.6]:56528 "EHLO mail.parknet.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753149Ab0BAJFw (ORCPT ); Mon, 1 Feb 2010 04:05:52 -0500 In-Reply-To: <20100201172105.14DE.61FB500B@jp.fujitsu.com> (Masayoshi MIZUMA's message of "Mon, 01 Feb 2010 17:21:07 +0900") Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Masayoshi MIZUMA writes: > OGAWA Hirofumi wrote: > >> Masayoshi MIZUMA writes: >> >> > @@ -2146,13 +2146,12 @@ int block_read_full_page(struct page *page, get_block_t *get_block) >> > { >> > struct inode *inode = page->mapping->host; >> > sector_t iblock, lblock; >> > - struct buffer_head *bh, *head, *arr[MAX_BUF_PER_PAGE]; >> > - unsigned int blocksize; >> > + unsigned int blocksize = 1 << inode->i_blkbits; >> > + struct buffer_head *bh, *head, *arr[PAGE_CACHE_SIZE / blocksize]; >> >> In practice, we avoid to use the variable-length array on the kernel >> stack. Although I'm not sure how important it is, there are some reasons >> to avoid. Also sparse will warn it, IIRC. > > Umm... I understand the practice itself, but is there specific reason for > the practice ? If there isn't, we don't need to avoid use it, I think. For example, from quick google http://lkml.org/lkml/2003/9/2/202 I guess you can find more reasons if needed. Thanks. -- OGAWA Hirofumi