diff options
Diffstat (limited to 'fs/gfs2/file.c')
-rw-r--r-- | fs/gfs2/file.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index c5fb3597f696..76834587a8a4 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c | |||
@@ -313,6 +313,8 @@ static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
313 | return gfs2_get_flags(filp, (u32 __user *)arg); | 313 | return gfs2_get_flags(filp, (u32 __user *)arg); |
314 | case FS_IOC_SETFLAGS: | 314 | case FS_IOC_SETFLAGS: |
315 | return gfs2_set_flags(filp, (u32 __user *)arg); | 315 | return gfs2_set_flags(filp, (u32 __user *)arg); |
316 | case FITRIM: | ||
317 | return gfs2_fitrim(filp, (void __user *)arg); | ||
316 | } | 318 | } |
317 | return -ENOTTY; | 319 | return -ENOTTY; |
318 | } | 320 | } |
@@ -674,6 +676,7 @@ static int fallocate_chunk(struct inode *inode, loff_t offset, loff_t len, | |||
674 | struct gfs2_inode *ip = GFS2_I(inode); | 676 | struct gfs2_inode *ip = GFS2_I(inode); |
675 | struct buffer_head *dibh; | 677 | struct buffer_head *dibh; |
676 | int error; | 678 | int error; |
679 | loff_t size = len; | ||
677 | unsigned int nr_blks; | 680 | unsigned int nr_blks; |
678 | sector_t lblock = offset >> inode->i_blkbits; | 681 | sector_t lblock = offset >> inode->i_blkbits; |
679 | 682 | ||
@@ -707,8 +710,8 @@ static int fallocate_chunk(struct inode *inode, loff_t offset, loff_t len, | |||
707 | goto out; | 710 | goto out; |
708 | } | 711 | } |
709 | } | 712 | } |
710 | if (offset + len > inode->i_size && !(mode & FALLOC_FL_KEEP_SIZE)) | 713 | if (offset + size > inode->i_size && !(mode & FALLOC_FL_KEEP_SIZE)) |
711 | i_size_write(inode, offset + len); | 714 | i_size_write(inode, offset + size); |
712 | 715 | ||
713 | mark_inode_dirty(inode); | 716 | mark_inode_dirty(inode); |
714 | 717 | ||
@@ -777,12 +780,14 @@ static long gfs2_fallocate(struct file *file, int mode, loff_t offset, | |||
777 | if (unlikely(error)) | 780 | if (unlikely(error)) |
778 | goto out_uninit; | 781 | goto out_uninit; |
779 | 782 | ||
780 | if (!gfs2_write_alloc_required(ip, offset, len)) | ||
781 | goto out_unlock; | ||
782 | |||
783 | while (len > 0) { | 783 | while (len > 0) { |
784 | if (len < bytes) | 784 | if (len < bytes) |
785 | bytes = len; | 785 | bytes = len; |
786 | if (!gfs2_write_alloc_required(ip, offset, bytes)) { | ||
787 | len -= bytes; | ||
788 | offset += bytes; | ||
789 | continue; | ||
790 | } | ||
786 | qa = gfs2_qadata_get(ip); | 791 | qa = gfs2_qadata_get(ip); |
787 | if (!qa) { | 792 | if (!qa) { |
788 | error = -ENOMEM; | 793 | error = -ENOMEM; |