Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ebdec241 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Al Viro
Browse files

fs: kill block_prepare_write



__block_write_begin and block_prepare_write are identical except for slightly
different calling conventions.  Convert all callers to the __block_write_begin
calling conventions and drop block_prepare_write.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 56b0dacf
Loading
Loading
Loading
Loading
+5 −12
Original line number Original line Diff line number Diff line
@@ -1834,9 +1834,11 @@ void page_zero_new_buffers(struct page *page, unsigned from, unsigned to)
}
}
EXPORT_SYMBOL(page_zero_new_buffers);
EXPORT_SYMBOL(page_zero_new_buffers);


int block_prepare_write(struct page *page, unsigned from, unsigned to,
int __block_write_begin(struct page *page, loff_t pos, unsigned len,
		get_block_t *get_block)
		get_block_t *get_block)
{
{
	unsigned from = pos & (PAGE_CACHE_SIZE - 1);
	unsigned to = from + len;
	struct inode *inode = page->mapping->host;
	struct inode *inode = page->mapping->host;
	unsigned block_start, block_end;
	unsigned block_start, block_end;
	sector_t block;
	sector_t block;
@@ -1916,7 +1918,7 @@ int block_prepare_write(struct page *page, unsigned from, unsigned to,
	}
	}
	return err;
	return err;
}
}
EXPORT_SYMBOL(block_prepare_write);
EXPORT_SYMBOL(__block_write_begin);


static int __block_commit_write(struct inode *inode, struct page *page,
static int __block_commit_write(struct inode *inode, struct page *page,
		unsigned from, unsigned to)
		unsigned from, unsigned to)
@@ -1953,15 +1955,6 @@ static int __block_commit_write(struct inode *inode, struct page *page,
	return 0;
	return 0;
}
}


int __block_write_begin(struct page *page, loff_t pos, unsigned len,
		get_block_t *get_block)
{
	unsigned start = pos & (PAGE_CACHE_SIZE - 1);

	return block_prepare_write(page, start, start + len, get_block);
}
EXPORT_SYMBOL(__block_write_begin);

/*
/*
 * block_write_begin takes care of the basic task of block allocation and
 * block_write_begin takes care of the basic task of block allocation and
 * bringing partial write blocks uptodate first.
 * bringing partial write blocks uptodate first.
@@ -2379,7 +2372,7 @@ block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
	else
	else
		end = PAGE_CACHE_SIZE;
		end = PAGE_CACHE_SIZE;


	ret = block_prepare_write(page, 0, end, get_block);
	ret = __block_write_begin(page, 0, end, get_block);
	if (!ret)
	if (!ret)
		ret = block_commit_write(page, 0, end);
		ret = block_commit_write(page, 0, end);


+2 −2
Original line number Original line Diff line number Diff line
@@ -1696,7 +1696,7 @@ static int ext3_journalled_writepage(struct page *page,
		 * doesn't seem much point in redirtying the page here.
		 * doesn't seem much point in redirtying the page here.
		 */
		 */
		ClearPageChecked(page);
		ClearPageChecked(page);
		ret = block_prepare_write(page, 0, PAGE_CACHE_SIZE,
		ret = __block_write_begin(page, 0, PAGE_CACHE_SIZE,
					  ext3_get_block);
					  ext3_get_block);
		if (ret != 0) {
		if (ret != 0) {
			ext3_journal_stop(handle);
			ext3_journal_stop(handle);
+5 −6
Original line number Original line Diff line number Diff line
@@ -1538,10 +1538,10 @@ static int do_journal_get_write_access(handle_t *handle,
	if (!buffer_mapped(bh) || buffer_freed(bh))
	if (!buffer_mapped(bh) || buffer_freed(bh))
		return 0;
		return 0;
	/*
	/*
	 * __block_prepare_write() could have dirtied some buffers. Clean
	 * __block_write_begin() could have dirtied some buffers. Clean
	 * the dirty bit as jbd2_journal_get_write_access() could complain
	 * the dirty bit as jbd2_journal_get_write_access() could complain
	 * otherwise about fs integrity issues. Setting of the dirty bit
	 * otherwise about fs integrity issues. Setting of the dirty bit
	 * by __block_prepare_write() isn't a real problem here as we clear
	 * by __block_write_begin() isn't a real problem here as we clear
	 * the bit before releasing a page lock and thus writeback cannot
	 * the bit before releasing a page lock and thus writeback cannot
	 * ever write the buffer.
	 * ever write the buffer.
	 */
	 */
@@ -2550,8 +2550,7 @@ static int ext4_da_get_block_prep(struct inode *inode, sector_t iblock,
		if (buffer_delay(bh))
		if (buffer_delay(bh))
			return 0; /* Not sure this could or should happen */
			return 0; /* Not sure this could or should happen */
		/*
		/*
		 * XXX: __block_prepare_write() unmaps passed block,
		 * XXX: __block_write_begin() unmaps passed block, is it OK?
		 * is it OK?
		 */
		 */
		ret = ext4_da_reserve_space(inode, iblock);
		ret = ext4_da_reserve_space(inode, iblock);
		if (ret)
		if (ret)
@@ -2583,7 +2582,7 @@ static int ext4_da_get_block_prep(struct inode *inode, sector_t iblock,
/*
/*
 * This function is used as a standard get_block_t calback function
 * This function is used as a standard get_block_t calback function
 * when there is no desire to allocate any blocks.  It is used as a
 * when there is no desire to allocate any blocks.  It is used as a
 * callback function for block_prepare_write() and block_write_full_page().
 * callback function for block_write_begin() and block_write_full_page().
 * These functions should only try to map a single block at a time.
 * These functions should only try to map a single block at a time.
 *
 *
 * Since this function doesn't do block allocations even if the caller
 * Since this function doesn't do block allocations even if the caller
@@ -2743,7 +2742,7 @@ static int ext4_writepage(struct page *page,
		 * all are mapped and non delay. We don't want to
		 * all are mapped and non delay. We don't want to
		 * do block allocation here.
		 * do block allocation here.
		 */
		 */
		ret = block_prepare_write(page, 0, len,
		ret = __block_write_begin(page, 0, len,
					  noalloc_get_block_write);
					  noalloc_get_block_write);
		if (!ret) {
		if (!ret) {
			page_bufs = page_buffers(page);
			page_bufs = page_buffers(page);
+1 −2
Original line number Original line Diff line number Diff line
@@ -618,7 +618,6 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
	struct gfs2_alloc *al = NULL;
	struct gfs2_alloc *al = NULL;
	pgoff_t index = pos >> PAGE_CACHE_SHIFT;
	pgoff_t index = pos >> PAGE_CACHE_SHIFT;
	unsigned from = pos & (PAGE_CACHE_SIZE - 1);
	unsigned from = pos & (PAGE_CACHE_SIZE - 1);
	unsigned to = from + len;
	struct page *page;
	struct page *page;


	gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &ip->i_gh);
	gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &ip->i_gh);
@@ -691,7 +690,7 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
	}
	}


prepare_write:
prepare_write:
	error = block_prepare_write(page, from, to, gfs2_block_map);
	error = __block_write_begin(page, from, len, gfs2_block_map);
out:
out:
	if (error == 0)
	if (error == 0)
		return 0;
		return 0;
+3 −3
Original line number Original line Diff line number Diff line
@@ -1294,7 +1294,7 @@ static int write_empty_blocks(struct page *page, unsigned from, unsigned to)
	int error;
	int error;


	if (!page_has_buffers(page)) {
	if (!page_has_buffers(page)) {
		error = block_prepare_write(page, from, to, gfs2_block_map);
		error = __block_write_begin(page, from, to - from, gfs2_block_map);
		if (unlikely(error))
		if (unlikely(error))
			return error;
			return error;


@@ -1313,7 +1313,7 @@ static int write_empty_blocks(struct page *page, unsigned from, unsigned to)
		next += bh->b_size;
		next += bh->b_size;
		if (buffer_mapped(bh)) {
		if (buffer_mapped(bh)) {
			if (end) {
			if (end) {
				error = block_prepare_write(page, start, end,
				error = __block_write_begin(page, start, end - start,
							    gfs2_block_map);
							    gfs2_block_map);
				if (unlikely(error))
				if (unlikely(error))
					return error;
					return error;
@@ -1328,7 +1328,7 @@ static int write_empty_blocks(struct page *page, unsigned from, unsigned to)
	} while (next < to);
	} while (next < to);


	if (end) {
	if (end) {
		error = block_prepare_write(page, start, end, gfs2_block_map);
		error = __block_write_begin(page, start, end - start, gfs2_block_map);
		if (unlikely(error))
		if (unlikely(error))
			return error;
			return error;
		empty_write_end(page, start, end);
		empty_write_end(page, start, end);
Loading