jfs: drop vmtruncate
Removed vmtruncate Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
70b31c4c88
commit
86dd07d66a
|
@ -119,9 +119,12 @@ int jfs_setattr(struct dentry *dentry, struct iattr *iattr)
|
||||||
iattr->ia_size != i_size_read(inode)) {
|
iattr->ia_size != i_size_read(inode)) {
|
||||||
inode_dio_wait(inode);
|
inode_dio_wait(inode);
|
||||||
|
|
||||||
rc = vmtruncate(inode, iattr->ia_size);
|
rc = inode_newsize_ok(inode, iattr->ia_size);
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
truncate_setsize(inode, iattr->ia_size);
|
||||||
|
jfs_truncate(inode);
|
||||||
}
|
}
|
||||||
|
|
||||||
setattr_copy(inode, iattr);
|
setattr_copy(inode, iattr);
|
||||||
|
@ -133,7 +136,6 @@ int jfs_setattr(struct dentry *dentry, struct iattr *iattr)
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct inode_operations jfs_file_inode_operations = {
|
const struct inode_operations jfs_file_inode_operations = {
|
||||||
.truncate = jfs_truncate,
|
|
||||||
.setxattr = jfs_setxattr,
|
.setxattr = jfs_setxattr,
|
||||||
.getxattr = jfs_getxattr,
|
.getxattr = jfs_getxattr,
|
||||||
.listxattr = jfs_listxattr,
|
.listxattr = jfs_listxattr,
|
||||||
|
|
|
@ -300,6 +300,16 @@ static int jfs_readpages(struct file *file, struct address_space *mapping,
|
||||||
return mpage_readpages(mapping, pages, nr_pages, jfs_get_block);
|
return mpage_readpages(mapping, pages, nr_pages, jfs_get_block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void jfs_write_failed(struct address_space *mapping, loff_t to)
|
||||||
|
{
|
||||||
|
struct inode *inode = mapping->host;
|
||||||
|
|
||||||
|
if (to > inode->i_size) {
|
||||||
|
truncate_pagecache(inode, to, inode->i_size);
|
||||||
|
jfs_truncate(inode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int jfs_write_begin(struct file *file, struct address_space *mapping,
|
static int jfs_write_begin(struct file *file, struct address_space *mapping,
|
||||||
loff_t pos, unsigned len, unsigned flags,
|
loff_t pos, unsigned len, unsigned flags,
|
||||||
struct page **pagep, void **fsdata)
|
struct page **pagep, void **fsdata)
|
||||||
|
@ -308,11 +318,8 @@ static int jfs_write_begin(struct file *file, struct address_space *mapping,
|
||||||
|
|
||||||
ret = nobh_write_begin(mapping, pos, len, flags, pagep, fsdata,
|
ret = nobh_write_begin(mapping, pos, len, flags, pagep, fsdata,
|
||||||
jfs_get_block);
|
jfs_get_block);
|
||||||
if (unlikely(ret)) {
|
if (unlikely(ret))
|
||||||
loff_t isize = mapping->host->i_size;
|
jfs_write_failed(mapping, pos + len);
|
||||||
if (pos + len > isize)
|
|
||||||
vmtruncate(mapping->host, isize);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -326,6 +333,7 @@ static ssize_t jfs_direct_IO(int rw, struct kiocb *iocb,
|
||||||
const struct iovec *iov, loff_t offset, unsigned long nr_segs)
|
const struct iovec *iov, loff_t offset, unsigned long nr_segs)
|
||||||
{
|
{
|
||||||
struct file *file = iocb->ki_filp;
|
struct file *file = iocb->ki_filp;
|
||||||
|
struct address_space *mapping = file->f_mapping;
|
||||||
struct inode *inode = file->f_mapping->host;
|
struct inode *inode = file->f_mapping->host;
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
|
||||||
|
@ -341,7 +349,7 @@ static ssize_t jfs_direct_IO(int rw, struct kiocb *iocb,
|
||||||
loff_t end = offset + iov_length(iov, nr_segs);
|
loff_t end = offset + iov_length(iov, nr_segs);
|
||||||
|
|
||||||
if (end > isize)
|
if (end > isize)
|
||||||
vmtruncate(inode, isize);
|
jfs_write_failed(mapping, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Reference in New Issue