diff options
author | Jan Kara <jack@suse.cz> | 2011-05-23 18:23:34 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-05-26 07:26:44 -0400 |
commit | 24da4fab5a617ecbf0f0c64e7ba7703383faa411 (patch) | |
tree | 28f62d2e0e69b11765f021db53c327b56f741576 /include/linux/buffer_head.h | |
parent | 7c6e984dfca8ff5b04d359a59b24f39a691b87d3 (diff) |
vfs: Create __block_page_mkwrite() helper passing error values back
Create __block_page_mkwrite() helper which does all what block_page_mkwrite()
does except that it passes back errors from __block_write_begin /
block_commit_write calls.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux/buffer_head.h')
-rw-r--r-- | include/linux/buffer_head.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index f5df23561b96..2bf6a9136a94 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h | |||
@@ -217,8 +217,22 @@ int cont_write_begin(struct file *, struct address_space *, loff_t, | |||
217 | get_block_t *, loff_t *); | 217 | get_block_t *, loff_t *); |
218 | int generic_cont_expand_simple(struct inode *inode, loff_t size); | 218 | int generic_cont_expand_simple(struct inode *inode, loff_t size); |
219 | int block_commit_write(struct page *page, unsigned from, unsigned to); | 219 | int block_commit_write(struct page *page, unsigned from, unsigned to); |
220 | int __block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, | ||
221 | get_block_t get_block); | ||
220 | int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, | 222 | int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, |
221 | get_block_t get_block); | 223 | get_block_t get_block); |
224 | /* Convert errno to return value from ->page_mkwrite() call */ | ||
225 | static inline int block_page_mkwrite_return(int err) | ||
226 | { | ||
227 | if (err == 0) | ||
228 | return VM_FAULT_LOCKED; | ||
229 | if (err == -EFAULT) | ||
230 | return VM_FAULT_NOPAGE; | ||
231 | if (err == -ENOMEM) | ||
232 | return VM_FAULT_OOM; | ||
233 | /* -ENOSPC, -EDQUOT, -EIO ... */ | ||
234 | return VM_FAULT_SIGBUS; | ||
235 | } | ||
222 | sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); | 236 | sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); |
223 | int block_truncate_page(struct address_space *, loff_t, get_block_t *); | 237 | int block_truncate_page(struct address_space *, loff_t, get_block_t *); |
224 | int nobh_write_begin(struct address_space *, loff_t, unsigned, unsigned, | 238 | int nobh_write_begin(struct address_space *, loff_t, unsigned, unsigned, |