|
@@ -676,6 +676,7 @@ static int fallocate_chunk(struct inode *inode, loff_t offset, loff_t len,
|
|
struct gfs2_inode *ip = GFS2_I(inode);
|
|
struct gfs2_inode *ip = GFS2_I(inode);
|
|
struct buffer_head *dibh;
|
|
struct buffer_head *dibh;
|
|
int error;
|
|
int error;
|
|
|
|
+ loff_t size = len;
|
|
unsigned int nr_blks;
|
|
unsigned int nr_blks;
|
|
sector_t lblock = offset >> inode->i_blkbits;
|
|
sector_t lblock = offset >> inode->i_blkbits;
|
|
|
|
|
|
@@ -709,8 +710,8 @@ static int fallocate_chunk(struct inode *inode, loff_t offset, loff_t len,
|
|
goto out;
|
|
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);
|
|
mark_inode_dirty(inode);
|
|
|
|
|
|
@@ -779,12 +780,14 @@ static long gfs2_fallocate(struct file *file, int mode, loff_t offset,
|
|
if (unlikely(error))
|
|
if (unlikely(error))
|
|
goto out_uninit;
|
|
goto out_uninit;
|
|
|
|
|
|
- if (!gfs2_write_alloc_required(ip, offset, len))
|
|
|
|
- goto out_unlock;
|
|
|
|
-
|
|
|
|
while (len > 0) {
|
|
while (len > 0) {
|
|
if (len < bytes)
|
|
if (len < bytes)
|
|
bytes = len;
|
|
bytes = len;
|
|
|
|
+ if (!gfs2_write_alloc_required(ip, offset, bytes)) {
|
|
|
|
+ len -= bytes;
|
|
|
|
+ offset += bytes;
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
qa = gfs2_qadata_get(ip);
|
|
qa = gfs2_qadata_get(ip);
|
|
if (!qa) {
|
|
if (!qa) {
|
|
error = -ENOMEM;
|
|
error = -ENOMEM;
|