mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-04-05 05:59:52 +07:00
nilfs2: 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
3e7a806928
commit
2d1b399b22
fs/nilfs2
@ -167,7 +167,6 @@ const struct file_operations nilfs_file_operations = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const struct inode_operations nilfs_file_inode_operations = {
|
const struct inode_operations nilfs_file_inode_operations = {
|
||||||
.truncate = nilfs_truncate,
|
|
||||||
.setattr = nilfs_setattr,
|
.setattr = nilfs_setattr,
|
||||||
.permission = nilfs_permission,
|
.permission = nilfs_permission,
|
||||||
.fiemap = nilfs_fiemap,
|
.fiemap = nilfs_fiemap,
|
||||||
|
@ -213,6 +213,16 @@ static int nilfs_set_page_dirty(struct page *page)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nilfs_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);
|
||||||
|
nilfs_truncate(inode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int nilfs_write_begin(struct file *file, struct address_space *mapping,
|
static int nilfs_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)
|
||||||
@ -227,10 +237,7 @@ static int nilfs_write_begin(struct file *file, struct address_space *mapping,
|
|||||||
err = block_write_begin(mapping, pos, len, flags, pagep,
|
err = block_write_begin(mapping, pos, len, flags, pagep,
|
||||||
nilfs_get_block);
|
nilfs_get_block);
|
||||||
if (unlikely(err)) {
|
if (unlikely(err)) {
|
||||||
loff_t isize = mapping->host->i_size;
|
nilfs_write_failed(mapping, pos + len);
|
||||||
if (pos + len > isize)
|
|
||||||
vmtruncate(mapping->host, isize);
|
|
||||||
|
|
||||||
nilfs_transaction_abort(inode->i_sb);
|
nilfs_transaction_abort(inode->i_sb);
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
@ -259,6 +266,7 @@ nilfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
|
|||||||
loff_t offset, unsigned long nr_segs)
|
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 size;
|
ssize_t size;
|
||||||
|
|
||||||
@ -278,7 +286,7 @@ nilfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
|
|||||||
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);
|
nilfs_write_failed(mapping, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
@ -786,10 +794,8 @@ int nilfs_setattr(struct dentry *dentry, struct iattr *iattr)
|
|||||||
if ((iattr->ia_valid & ATTR_SIZE) &&
|
if ((iattr->ia_valid & ATTR_SIZE) &&
|
||||||
iattr->ia_size != i_size_read(inode)) {
|
iattr->ia_size != i_size_read(inode)) {
|
||||||
inode_dio_wait(inode);
|
inode_dio_wait(inode);
|
||||||
|
truncate_setsize(inode, iattr->ia_size);
|
||||||
err = vmtruncate(inode, iattr->ia_size);
|
nilfs_truncate(inode);
|
||||||
if (unlikely(err))
|
|
||||||
goto out_err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setattr_copy(inode, iattr);
|
setattr_copy(inode, iattr);
|
||||||
|
@ -277,6 +277,7 @@ extern void nilfs_update_inode(struct inode *, struct buffer_head *);
|
|||||||
extern void nilfs_truncate(struct inode *);
|
extern void nilfs_truncate(struct inode *);
|
||||||
extern void nilfs_evict_inode(struct inode *);
|
extern void nilfs_evict_inode(struct inode *);
|
||||||
extern int nilfs_setattr(struct dentry *, struct iattr *);
|
extern int nilfs_setattr(struct dentry *, struct iattr *);
|
||||||
|
extern void nilfs_write_failed(struct address_space *mapping, loff_t to);
|
||||||
int nilfs_permission(struct inode *inode, int mask);
|
int nilfs_permission(struct inode *inode, int mask);
|
||||||
int nilfs_load_inode_block(struct inode *inode, struct buffer_head **pbh);
|
int nilfs_load_inode_block(struct inode *inode, struct buffer_head **pbh);
|
||||||
extern int nilfs_inode_dirty(struct inode *);
|
extern int nilfs_inode_dirty(struct inode *);
|
||||||
|
@ -527,7 +527,8 @@ static int nilfs_recover_dsync_blocks(struct the_nilfs *nilfs,
|
|||||||
if (unlikely(err)) {
|
if (unlikely(err)) {
|
||||||
loff_t isize = inode->i_size;
|
loff_t isize = inode->i_size;
|
||||||
if (pos + blocksize > isize)
|
if (pos + blocksize > isize)
|
||||||
vmtruncate(inode, isize);
|
nilfs_write_failed(inode->i_mapping,
|
||||||
|
pos + blocksize);
|
||||||
goto failed_inode;
|
goto failed_inode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user