Re: [PATCH][RFC] vfs: block_read_full_page allocates array depending on environment

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

 



Masayoshi MIZUMA <m.mizuma@xxxxxxxxxxxxxx> 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.

Thanks.

>         int nr, i;
>         int fully_mapped = 1;
>
>         BUG_ON(!PageLocked(page));
> -       blocksize = 1 << inode->i_blkbits;
>         if (!page_has_buffers(page))
>                 create_empty_buffers(page, blocksize, 0);
>         head = page_buffers(page);
-- 
OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux