/* We attach and possibly dirty the buffers atomically wrt __set_page_dirty_buffers() via private_lock. try_to_free_buffers is already excluded via the page lock.  */
void create_empty_buffers(struct page *page, unsigned long blocksize, unsigned long b_state)
/* We attach and possibly dirty the buffers atomically wrt __set_page_dirty_buffers() via private_lock. try_to_free_buffers is already excluded via the page lock.  */
void create_empty_buffers(struct page *page, unsigned long blocksize, unsigned long b_state)
{
	struct buffer_head *bh, *head, *tail;
	head = alloc_page_buffers(page, blocksize, 1);
	bh = head;
	do {
		bh->b_state |= b_state;
		tail = bh;
		bh = bh->b_this_page;
	} while (bh);
	tail->b_this_page = head;
	spin_lock(&page->mapping->private_lock);
	if (PageUptodate(page) || PageDirty(page)) {
		bh = head;
		do {
			if (PageDirty(page))
				set_buffer_dirty(bh);
			if (PageUptodate(page))
				set_buffer_uptodate(bh);
			bh = bh->b_this_page;
		} while (bh != head);
	}
	attach_page_buffers(page, head);
	spin_unlock(&page->mapping->private_lock);
}