mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
fs: convert simple fs to new truncate
Convert simple filesystems: ramfs, configfs, sysfs, block_dev to new truncate sequence. Cc: Christoph Hellwig <[email protected]> Signed-off-by: Nick Piggin <[email protected]> Signed-off-by: Al Viro <[email protected]>
This commit is contained in:
parent
15c6fd9786
commit
3322e79a38
5 changed files with 15 additions and 19 deletions
|
|
@ -50,5 +50,6 @@ const struct file_operations ramfs_file_operations = {
|
|||
};
|
||||
|
||||
const struct inode_operations ramfs_file_inode_operations = {
|
||||
.setattr = simple_setattr,
|
||||
.getattr = simple_getattr,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ static int ramfs_nommu_resize(struct inode *inode, loff_t newsize, loff_t size)
|
|||
return ret;
|
||||
}
|
||||
|
||||
ret = vmtruncate(inode, newsize);
|
||||
ret = simple_setsize(inode, newsize);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -169,7 +169,8 @@ static int ramfs_nommu_setattr(struct dentry *dentry, struct iattr *ia)
|
|||
|
||||
/* pick out size-changing events */
|
||||
if (ia->ia_valid & ATTR_SIZE) {
|
||||
loff_t size = i_size_read(inode);
|
||||
loff_t size = inode->i_size;
|
||||
|
||||
if (ia->ia_size != size) {
|
||||
ret = ramfs_nommu_resize(inode, ia->ia_size, size);
|
||||
if (ret < 0 || ia->ia_valid == ATTR_SIZE)
|
||||
|
|
@ -182,7 +183,7 @@ static int ramfs_nommu_setattr(struct dentry *dentry, struct iattr *ia)
|
|||
}
|
||||
}
|
||||
|
||||
ret = inode_setattr(inode, ia);
|
||||
generic_setattr(inode, ia);
|
||||
out:
|
||||
ia->ia_valid = old_ia_valid;
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Reference in a new issue