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 c5fb3597f69..76834587a8a 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)  		return gfs2_get_flags(filp, (u32 __user *)arg);  	case FS_IOC_SETFLAGS:  		return gfs2_set_flags(filp, (u32 __user *)arg); +	case FITRIM: +		return gfs2_fitrim(filp, (void __user *)arg);  	}  	return -ENOTTY;  } @@ -674,6 +676,7 @@ static int fallocate_chunk(struct inode *inode, loff_t offset, loff_t len,  	struct gfs2_inode *ip = GFS2_I(inode);  	struct buffer_head *dibh;  	int error; +	loff_t size = len;  	unsigned int nr_blks;  	sector_t lblock = offset >> inode->i_blkbits; @@ -707,8 +710,8 @@ static int fallocate_chunk(struct inode *inode, loff_t offset, loff_t len,  			goto out;  		}  	} -	if (offset + len > inode->i_size && !(mode & FALLOC_FL_KEEP_SIZE)) -		i_size_write(inode, offset + len); +	if (offset + size > inode->i_size && !(mode & FALLOC_FL_KEEP_SIZE)) +		i_size_write(inode, offset + size);  	mark_inode_dirty(inode); @@ -777,12 +780,14 @@ static long gfs2_fallocate(struct file *file, int mode, loff_t offset,  	if (unlikely(error))  		goto out_uninit; -	if (!gfs2_write_alloc_required(ip, offset, len)) -		goto out_unlock; -  	while (len > 0) {  		if (len < bytes)  			bytes = len; +		if (!gfs2_write_alloc_required(ip, offset, bytes)) { +			len -= bytes; +			offset += bytes; +			continue; +		}  		qa = gfs2_qadata_get(ip);  		if (!qa) {  			error = -ENOMEM;  |