mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 06:10:53 +07:00
f2fs: add the truncate_xattr_node function
The truncate_xattr_node function will be used by inline xattr. Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
This commit is contained in:
parent
dd9cfe236f
commit
4f16fb0f9b
@ -1016,6 +1016,7 @@ int is_checkpointed_node(struct f2fs_sb_info *, nid_t);
|
|||||||
void get_node_info(struct f2fs_sb_info *, nid_t, struct node_info *);
|
void get_node_info(struct f2fs_sb_info *, nid_t, struct node_info *);
|
||||||
int get_dnode_of_data(struct dnode_of_data *, pgoff_t, int);
|
int get_dnode_of_data(struct dnode_of_data *, pgoff_t, int);
|
||||||
int truncate_inode_blocks(struct inode *, pgoff_t);
|
int truncate_inode_blocks(struct inode *, pgoff_t);
|
||||||
|
int truncate_xattr_node(struct inode *, struct page *);
|
||||||
int remove_inode_page(struct inode *);
|
int remove_inode_page(struct inode *);
|
||||||
struct page *new_inode_page(struct inode *, const struct qstr *);
|
struct page *new_inode_page(struct inode *, const struct qstr *);
|
||||||
struct page *new_node_page(struct dnode_of_data *, unsigned int, struct page *);
|
struct page *new_node_page(struct dnode_of_data *, unsigned int, struct page *);
|
||||||
|
@ -772,6 +772,29 @@ int truncate_inode_blocks(struct inode *inode, pgoff_t from)
|
|||||||
return err > 0 ? 0 : err;
|
return err > 0 ? 0 : err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int truncate_xattr_node(struct inode *inode, struct page *page)
|
||||||
|
{
|
||||||
|
struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
|
||||||
|
nid_t nid = F2FS_I(inode)->i_xattr_nid;
|
||||||
|
struct dnode_of_data dn;
|
||||||
|
struct page *npage;
|
||||||
|
|
||||||
|
if (!nid)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
npage = get_node_page(sbi, nid);
|
||||||
|
if (IS_ERR(npage))
|
||||||
|
return PTR_ERR(npage);
|
||||||
|
|
||||||
|
F2FS_I(inode)->i_xattr_nid = 0;
|
||||||
|
set_new_dnode(&dn, inode, page, npage, nid);
|
||||||
|
|
||||||
|
if (page)
|
||||||
|
dn.inode_page_locked = 1;
|
||||||
|
truncate_node(&dn);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Caller should grab and release a mutex by calling mutex_lock_op() and
|
* Caller should grab and release a mutex by calling mutex_lock_op() and
|
||||||
* mutex_unlock_op().
|
* mutex_unlock_op().
|
||||||
@ -782,22 +805,16 @@ int remove_inode_page(struct inode *inode)
|
|||||||
struct page *page;
|
struct page *page;
|
||||||
nid_t ino = inode->i_ino;
|
nid_t ino = inode->i_ino;
|
||||||
struct dnode_of_data dn;
|
struct dnode_of_data dn;
|
||||||
|
int err;
|
||||||
|
|
||||||
page = get_node_page(sbi, ino);
|
page = get_node_page(sbi, ino);
|
||||||
if (IS_ERR(page))
|
if (IS_ERR(page))
|
||||||
return PTR_ERR(page);
|
return PTR_ERR(page);
|
||||||
|
|
||||||
if (F2FS_I(inode)->i_xattr_nid) {
|
err = truncate_xattr_node(inode, page);
|
||||||
nid_t nid = F2FS_I(inode)->i_xattr_nid;
|
if (err) {
|
||||||
struct page *npage = get_node_page(sbi, nid);
|
f2fs_put_page(page, 1);
|
||||||
|
return err;
|
||||||
if (IS_ERR(npage))
|
|
||||||
return PTR_ERR(npage);
|
|
||||||
|
|
||||||
F2FS_I(inode)->i_xattr_nid = 0;
|
|
||||||
set_new_dnode(&dn, inode, page, npage, nid);
|
|
||||||
dn.inode_page_locked = 1;
|
|
||||||
truncate_node(&dn);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 0 is possible, after f2fs_new_inode() is failed */
|
/* 0 is possible, after f2fs_new_inode() is failed */
|
||||||
|
Loading…
Reference in New Issue
Block a user