if (is_inode_flag_set(fi, FI_NO_EXTENT))
return 0;
- read_lock(&fi->ext.ext_lock);
+ read_lock(&fi->ext_lock);
if (fi->ext.len == 0) {
- read_unlock(&fi->ext.ext_lock);
+ read_unlock(&fi->ext_lock);
return 0;
}
bh_result->b_size = UINT_MAX;
stat_inc_read_hit(inode->i_sb);
- read_unlock(&fi->ext.ext_lock);
+ read_unlock(&fi->ext_lock);
return 1;
}
- read_unlock(&fi->ext.ext_lock);
+ read_unlock(&fi->ext_lock);
return 0;
}
fofs = start_bidx_of_node(ofs_of_node(dn->node_page), fi) +
dn->ofs_in_node;
- write_lock(&fi->ext.ext_lock);
+ write_lock(&fi->ext_lock);
start_fofs = fi->ext.fofs;
end_fofs = fi->ext.fofs + fi->ext.len - 1;
need_update = true;
}
end_update:
- write_unlock(&fi->ext.ext_lock);
+ write_unlock(&fi->ext_lock);
if (need_update)
sync_inode_page(dn);
return;
#define F2FS_MIN_EXTENT_LEN 16 /* minimum extent length */
struct extent_info {
- rwlock_t ext_lock; /* rwlock for consistency */
unsigned int fofs; /* start offset in a file */
u32 blk_addr; /* start block address of the extent */
unsigned int len; /* length of the extent */
nid_t i_xattr_nid; /* node id that contains xattrs */
unsigned long long xattr_ver; /* cp version of xattr modification */
struct extent_info ext; /* in-memory extent cache entry */
+ rwlock_t ext_lock; /* rwlock for single extent cache */
struct inode_entry *dirty_dir; /* the pointer of dirty dir */
struct radix_tree_root inmem_root; /* radix tree for inmem pages */
static inline void get_extent_info(struct extent_info *ext,
struct f2fs_extent i_ext)
{
- write_lock(&ext->ext_lock);
ext->fofs = le32_to_cpu(i_ext.fofs);
ext->blk_addr = le32_to_cpu(i_ext.blk_addr);
ext->len = le32_to_cpu(i_ext.len);
- write_unlock(&ext->ext_lock);
}
static inline void set_raw_extent(struct extent_info *ext,
struct f2fs_extent *i_ext)
{
- read_lock(&ext->ext_lock);
i_ext->fofs = cpu_to_le32(ext->fofs);
i_ext->blk_addr = cpu_to_le32(ext->blk_addr);
i_ext->len = cpu_to_le32(ext->len);
- read_unlock(&ext->ext_lock);
}
struct f2fs_nm_info {
fi->i_pino = le32_to_cpu(ri->i_pino);
fi->i_dir_level = ri->i_dir_level;
+ write_lock(&fi->ext_lock);
get_extent_info(&fi->ext, ri->i_ext);
+ write_unlock(&fi->ext_lock);
+
get_inline_info(fi, ri);
/* check data exist */
ri->i_links = cpu_to_le32(inode->i_nlink);
ri->i_size = cpu_to_le64(i_size_read(inode));
ri->i_blocks = cpu_to_le64(inode->i_blocks);
+
+ read_lock(&F2FS_I(inode)->ext_lock);
set_raw_extent(&F2FS_I(inode)->ext, &ri->i_ext);
+ read_unlock(&F2FS_I(inode)->ext_lock);
+
set_raw_inline(F2FS_I(inode), ri);
ri->i_atime = cpu_to_le64(inode->i_atime.tv_sec);
atomic_set(&fi->dirty_pages, 0);
fi->i_current_depth = 1;
fi->i_advise = 0;
- rwlock_init(&fi->ext.ext_lock);
+ rwlock_init(&fi->ext_lock);
init_rwsem(&fi->i_sem);
INIT_RADIX_TREE(&fi->inmem_root, GFP_NOFS);
INIT_LIST_HEAD(&fi->inmem_pages);