f2fs: clean up codes with {f2fs_,}data_blkaddr()
- rename datablock_addr() to data_blkaddr(). - wrap data_blkaddr() with f2fs_data_blkaddr() to clean up parameters. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
Родитель
a7e679b533
Коммит
a2ced1ce10
|
@ -557,7 +557,7 @@ static int f2fs_compressed_blocks(struct compress_ctx *cc)
|
|||
for (i = 1; i < cc->cluster_size; i++) {
|
||||
block_t blkaddr;
|
||||
|
||||
blkaddr = datablock_addr(dn.inode,
|
||||
blkaddr = data_blkaddr(dn.inode,
|
||||
dn.node_page, dn.ofs_in_node + i);
|
||||
if (blkaddr != NULL_ADDR)
|
||||
ret++;
|
||||
|
@ -797,7 +797,7 @@ static int f2fs_write_compressed_pages(struct compress_ctx *cc,
|
|||
goto out_unlock_op;
|
||||
|
||||
for (i = 0; i < cc->cluster_size; i++) {
|
||||
if (datablock_addr(dn.inode, dn.node_page,
|
||||
if (data_blkaddr(dn.inode, dn.node_page,
|
||||
dn.ofs_in_node + i) == NULL_ADDR)
|
||||
goto out_put_dnode;
|
||||
}
|
||||
|
@ -846,8 +846,7 @@ static int f2fs_write_compressed_pages(struct compress_ctx *cc,
|
|||
for (i = 0; i < cc->cluster_size; i++, dn.ofs_in_node++) {
|
||||
block_t blkaddr;
|
||||
|
||||
blkaddr = datablock_addr(dn.inode, dn.node_page,
|
||||
dn.ofs_in_node);
|
||||
blkaddr = f2fs_data_blkaddr(&dn);
|
||||
fio.page = cc->rpages[i];
|
||||
fio.old_blkaddr = blkaddr;
|
||||
|
||||
|
|
|
@ -1044,8 +1044,7 @@ int f2fs_reserve_new_blocks(struct dnode_of_data *dn, blkcnt_t count)
|
|||
f2fs_wait_on_page_writeback(dn->node_page, NODE, true, true);
|
||||
|
||||
for (; count > 0; dn->ofs_in_node++) {
|
||||
block_t blkaddr = datablock_addr(dn->inode,
|
||||
dn->node_page, dn->ofs_in_node);
|
||||
block_t blkaddr = f2fs_data_blkaddr(dn);
|
||||
if (blkaddr == NULL_ADDR) {
|
||||
dn->data_blkaddr = NEW_ADDR;
|
||||
__set_data_blkaddr(dn);
|
||||
|
@ -1297,8 +1296,7 @@ static int __allocate_data_block(struct dnode_of_data *dn, int seg_type)
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
dn->data_blkaddr = datablock_addr(dn->inode,
|
||||
dn->node_page, dn->ofs_in_node);
|
||||
dn->data_blkaddr = f2fs_data_blkaddr(dn);
|
||||
if (dn->data_blkaddr != NULL_ADDR)
|
||||
goto alloc;
|
||||
|
||||
|
@ -1460,7 +1458,7 @@ next_dnode:
|
|||
end_offset = ADDRS_PER_PAGE(dn.node_page, inode);
|
||||
|
||||
next_block:
|
||||
blkaddr = datablock_addr(dn.inode, dn.node_page, dn.ofs_in_node);
|
||||
blkaddr = f2fs_data_blkaddr(&dn);
|
||||
|
||||
if (__is_valid_data_blkaddr(blkaddr) &&
|
||||
!f2fs_is_valid_blkaddr(sbi, blkaddr, DATA_GENERIC_ENHANCE)) {
|
||||
|
@ -2060,7 +2058,7 @@ int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret,
|
|||
for (i = 1; i < cc->cluster_size; i++) {
|
||||
block_t blkaddr;
|
||||
|
||||
blkaddr = datablock_addr(dn.inode, dn.node_page,
|
||||
blkaddr = data_blkaddr(dn.inode, dn.node_page,
|
||||
dn.ofs_in_node + i);
|
||||
|
||||
if (!__is_valid_data_blkaddr(blkaddr))
|
||||
|
@ -2089,7 +2087,7 @@ int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret,
|
|||
struct page *page = dic->cpages[i];
|
||||
block_t blkaddr;
|
||||
|
||||
blkaddr = datablock_addr(dn.inode, dn.node_page,
|
||||
blkaddr = data_blkaddr(dn.inode, dn.node_page,
|
||||
dn.ofs_in_node + i + 1);
|
||||
|
||||
if (bio && !page_is_mergeable(sbi, bio,
|
||||
|
|
|
@ -2378,7 +2378,7 @@ static inline __le32 *blkaddr_in_node(struct f2fs_node *node)
|
|||
}
|
||||
|
||||
static inline int f2fs_has_extra_attr(struct inode *inode);
|
||||
static inline block_t datablock_addr(struct inode *inode,
|
||||
static inline block_t data_blkaddr(struct inode *inode,
|
||||
struct page *node_page, unsigned int offset)
|
||||
{
|
||||
struct f2fs_node *raw_node;
|
||||
|
@ -2400,6 +2400,11 @@ static inline block_t datablock_addr(struct inode *inode,
|
|||
return le32_to_cpu(addr_array[base + offset]);
|
||||
}
|
||||
|
||||
static inline block_t f2fs_data_blkaddr(struct dnode_of_data *dn)
|
||||
{
|
||||
return data_blkaddr(dn->inode, dn->node_page, dn->ofs_in_node);
|
||||
}
|
||||
|
||||
static inline int f2fs_test_bit(unsigned int nr, char *addr)
|
||||
{
|
||||
int mask;
|
||||
|
|
|
@ -455,8 +455,7 @@ static loff_t f2fs_seek_block(struct file *file, loff_t offset, int whence)
|
|||
data_ofs = (loff_t)pgofs << PAGE_SHIFT) {
|
||||
block_t blkaddr;
|
||||
|
||||
blkaddr = datablock_addr(dn.inode,
|
||||
dn.node_page, dn.ofs_in_node);
|
||||
blkaddr = f2fs_data_blkaddr(&dn);
|
||||
|
||||
if (__is_valid_data_blkaddr(blkaddr) &&
|
||||
!f2fs_is_valid_blkaddr(F2FS_I_SB(inode),
|
||||
|
@ -1116,8 +1115,7 @@ next_dnode:
|
|||
done = min((pgoff_t)ADDRS_PER_PAGE(dn.node_page, inode) -
|
||||
dn.ofs_in_node, len);
|
||||
for (i = 0; i < done; i++, blkaddr++, do_replace++, dn.ofs_in_node++) {
|
||||
*blkaddr = datablock_addr(dn.inode,
|
||||
dn.node_page, dn.ofs_in_node);
|
||||
*blkaddr = f2fs_data_blkaddr(&dn);
|
||||
|
||||
if (__is_valid_data_blkaddr(*blkaddr) &&
|
||||
!f2fs_is_valid_blkaddr(sbi, *blkaddr,
|
||||
|
@ -1206,8 +1204,7 @@ static int __clone_blkaddrs(struct inode *src_inode, struct inode *dst_inode,
|
|||
ADDRS_PER_PAGE(dn.node_page, dst_inode) -
|
||||
dn.ofs_in_node, len - i);
|
||||
do {
|
||||
dn.data_blkaddr = datablock_addr(dn.inode,
|
||||
dn.node_page, dn.ofs_in_node);
|
||||
dn.data_blkaddr = f2fs_data_blkaddr(&dn);
|
||||
f2fs_truncate_data_blocks_range(&dn, 1);
|
||||
|
||||
if (do_replace[i]) {
|
||||
|
@ -1383,8 +1380,7 @@ static int f2fs_do_zero_range(struct dnode_of_data *dn, pgoff_t start,
|
|||
int ret;
|
||||
|
||||
for (; index < end; index++, dn->ofs_in_node++) {
|
||||
if (datablock_addr(dn->inode, dn->node_page,
|
||||
dn->ofs_in_node) == NULL_ADDR)
|
||||
if (f2fs_data_blkaddr(dn) == NULL_ADDR)
|
||||
count++;
|
||||
}
|
||||
|
||||
|
@ -1395,8 +1391,7 @@ static int f2fs_do_zero_range(struct dnode_of_data *dn, pgoff_t start,
|
|||
|
||||
dn->ofs_in_node = ofs_in_node;
|
||||
for (index = start; index < end; index++, dn->ofs_in_node++) {
|
||||
dn->data_blkaddr = datablock_addr(dn->inode,
|
||||
dn->node_page, dn->ofs_in_node);
|
||||
dn->data_blkaddr = f2fs_data_blkaddr(dn);
|
||||
/*
|
||||
* f2fs_reserve_new_blocks will not guarantee entire block
|
||||
* allocation.
|
||||
|
|
|
@ -637,7 +637,7 @@ static bool is_alive(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
|
|||
}
|
||||
|
||||
*nofs = ofs_of_node(node_page);
|
||||
source_blkaddr = datablock_addr(NULL, node_page, ofs_in_node);
|
||||
source_blkaddr = data_blkaddr(NULL, node_page, ofs_in_node);
|
||||
f2fs_put_page(node_page, 1);
|
||||
|
||||
if (source_blkaddr != blkaddr) {
|
||||
|
|
|
@ -805,8 +805,7 @@ int f2fs_get_dnode_of_data(struct dnode_of_data *dn, pgoff_t index, int mode)
|
|||
dn->nid = nids[level];
|
||||
dn->ofs_in_node = offset[level];
|
||||
dn->node_page = npage[level];
|
||||
dn->data_blkaddr = datablock_addr(dn->inode,
|
||||
dn->node_page, dn->ofs_in_node);
|
||||
dn->data_blkaddr = f2fs_data_blkaddr(dn);
|
||||
return 0;
|
||||
|
||||
release_pages:
|
||||
|
|
|
@ -496,8 +496,7 @@ out:
|
|||
return 0;
|
||||
|
||||
truncate_out:
|
||||
if (datablock_addr(tdn.inode, tdn.node_page,
|
||||
tdn.ofs_in_node) == blkaddr)
|
||||
if (f2fs_data_blkaddr(&tdn) == blkaddr)
|
||||
f2fs_truncate_data_blocks_range(&tdn, 1);
|
||||
if (dn->inode->i_ino == nid && !dn->inode_page_locked)
|
||||
unlock_page(dn->inode_page);
|
||||
|
@ -560,8 +559,8 @@ retry_dn:
|
|||
for (; start < end; start++, dn.ofs_in_node++) {
|
||||
block_t src, dest;
|
||||
|
||||
src = datablock_addr(dn.inode, dn.node_page, dn.ofs_in_node);
|
||||
dest = datablock_addr(dn.inode, page, dn.ofs_in_node);
|
||||
src = f2fs_data_blkaddr(&dn);
|
||||
dest = data_blkaddr(dn.inode, page, dn.ofs_in_node);
|
||||
|
||||
if (__is_valid_data_blkaddr(src) &&
|
||||
!f2fs_is_valid_blkaddr(sbi, src, META_POR)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче