mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 19:07:52 +00:00
iomap: Use kzalloc to allocate iomap_page
We can skip most of the initialisation, although spinlocks still need explicit initialisation as architectures may use a non-zero value to indicate unlocked. The comment is no longer useful as attach_page_private() handles the refcount now. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:
parent
24addd848a
commit
a6901d4d14
1 changed files with 1 additions and 9 deletions
|
@ -49,16 +49,8 @@ iomap_page_create(struct inode *inode, struct page *page)
|
||||||
if (iop || i_blocks_per_page(inode, page) <= 1)
|
if (iop || i_blocks_per_page(inode, page) <= 1)
|
||||||
return iop;
|
return iop;
|
||||||
|
|
||||||
iop = kmalloc(sizeof(*iop), GFP_NOFS | __GFP_NOFAIL);
|
iop = kzalloc(sizeof(*iop), GFP_NOFS | __GFP_NOFAIL);
|
||||||
atomic_set(&iop->read_count, 0);
|
|
||||||
atomic_set(&iop->write_count, 0);
|
|
||||||
spin_lock_init(&iop->uptodate_lock);
|
spin_lock_init(&iop->uptodate_lock);
|
||||||
bitmap_zero(iop->uptodate, PAGE_SIZE / SECTOR_SIZE);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* migrate_page_move_mapping() assumes that pages with private data have
|
|
||||||
* their count elevated by 1.
|
|
||||||
*/
|
|
||||||
attach_page_private(page, iop);
|
attach_page_private(page, iop);
|
||||||
return iop;
|
return iop;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue