f2fs: make more close to v4.13-rc1
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
9df0a9280f
commit
972aaba68e
6 changed files with 23 additions and 22 deletions
|
@ -2228,7 +2228,7 @@ static inline void *f2fs_kmalloc(struct f2fs_sb_info *sbi,
|
|||
return kmalloc(size, flags);
|
||||
}
|
||||
|
||||
static inline void *f2fs_kvmalloc(size_t size, gfp_t flags)
|
||||
static inline void *kvmalloc(size_t size, gfp_t flags)
|
||||
{
|
||||
void *ret;
|
||||
|
||||
|
@ -2238,7 +2238,7 @@ static inline void *f2fs_kvmalloc(size_t size, gfp_t flags)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static inline void *f2fs_kvzalloc(size_t size, gfp_t flags)
|
||||
static inline void *kvzalloc(size_t size, gfp_t flags)
|
||||
{
|
||||
void *ret;
|
||||
|
||||
|
@ -2891,4 +2891,5 @@ static inline bool f2fs_may_encrypt(struct inode *inode)
|
|||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1048,11 +1048,11 @@ static int __exchange_data_block(struct inode *src_inode,
|
|||
while (len) {
|
||||
olen = min((pgoff_t)4 * ADDRS_PER_BLOCK, len);
|
||||
|
||||
src_blkaddr = f2fs_kvzalloc(sizeof(block_t) * olen, GFP_KERNEL);
|
||||
src_blkaddr = kvzalloc(sizeof(block_t) * olen, GFP_KERNEL);
|
||||
if (!src_blkaddr)
|
||||
return -ENOMEM;
|
||||
|
||||
do_replace = f2fs_kvzalloc(sizeof(int) * olen, GFP_KERNEL);
|
||||
do_replace = kvzalloc(sizeof(int) * olen, GFP_KERNEL);
|
||||
if (!do_replace) {
|
||||
kvfree(src_blkaddr);
|
||||
return -ENOMEM;
|
||||
|
|
|
@ -988,7 +988,7 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
|
|||
file_lost_pino(old_inode);
|
||||
up_write(&F2FS_I(old_inode)->i_sem);
|
||||
|
||||
old_dir->i_ctime = CURRENT_TIME;
|
||||
old_dir->i_ctime = current_time(old_dir);
|
||||
if (old_nlink) {
|
||||
down_write(&F2FS_I(old_dir)->i_sem);
|
||||
f2fs_i_links_write(old_dir, old_nlink > 0);
|
||||
|
@ -1003,7 +1003,7 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
|
|||
file_lost_pino(new_inode);
|
||||
up_write(&F2FS_I(new_inode)->i_sem);
|
||||
|
||||
new_dir->i_ctime = CURRENT_TIME;
|
||||
new_dir->i_ctime = current_time(new_dir);
|
||||
if (new_nlink) {
|
||||
down_write(&F2FS_I(new_dir)->i_sem);
|
||||
f2fs_i_links_write(new_dir, new_nlink > 0);
|
||||
|
|
|
@ -2664,17 +2664,17 @@ static int init_free_nid_cache(struct f2fs_sb_info *sbi)
|
|||
{
|
||||
struct f2fs_nm_info *nm_i = NM_I(sbi);
|
||||
|
||||
nm_i->free_nid_bitmap = f2fs_kvzalloc(nm_i->nat_blocks *
|
||||
nm_i->free_nid_bitmap = kvzalloc(nm_i->nat_blocks *
|
||||
NAT_ENTRY_BITMAP_SIZE, GFP_KERNEL);
|
||||
if (!nm_i->free_nid_bitmap)
|
||||
return -ENOMEM;
|
||||
|
||||
nm_i->nat_block_bitmap = f2fs_kvzalloc(nm_i->nat_blocks / 8,
|
||||
nm_i->nat_block_bitmap = kvzalloc(nm_i->nat_blocks / 8,
|
||||
GFP_KERNEL);
|
||||
if (!nm_i->nat_block_bitmap)
|
||||
return -ENOMEM;
|
||||
|
||||
nm_i->free_nid_count = f2fs_kvzalloc(nm_i->nat_blocks *
|
||||
nm_i->free_nid_count = kvzalloc(nm_i->nat_blocks *
|
||||
sizeof(unsigned short), GFP_KERNEL);
|
||||
if (!nm_i->free_nid_count)
|
||||
return -ENOMEM;
|
||||
|
|
|
@ -1243,8 +1243,8 @@ static int __f2fs_issue_discard_zone(struct f2fs_sb_info *sbi,
|
|||
sector = SECTOR_FROM_BLOCK(blkstart);
|
||||
nr_sects = SECTOR_FROM_BLOCK(blklen);
|
||||
|
||||
if (sector & (bdev_zone_size(bdev) - 1) ||
|
||||
nr_sects != bdev_zone_size(bdev)) {
|
||||
if (sector & (bdev_zone_sectors(bdev) - 1) ||
|
||||
nr_sects != bdev_zone_sectors(bdev)) {
|
||||
f2fs_msg(sbi->sb, KERN_INFO,
|
||||
"(%d) %s: Unaligned discard attempted (block %x + %x)",
|
||||
devi, sbi->s_ndevs ? FDEV(devi).path: "",
|
||||
|
@ -2998,13 +2998,13 @@ static int build_sit_info(struct f2fs_sb_info *sbi)
|
|||
|
||||
SM_I(sbi)->sit_info = sit_i;
|
||||
|
||||
sit_i->sentries = f2fs_kvzalloc(MAIN_SEGS(sbi) *
|
||||
sit_i->sentries = kvzalloc(MAIN_SEGS(sbi) *
|
||||
sizeof(struct seg_entry), GFP_KERNEL);
|
||||
if (!sit_i->sentries)
|
||||
return -ENOMEM;
|
||||
|
||||
bitmap_size = f2fs_bitmap_size(MAIN_SEGS(sbi));
|
||||
sit_i->dirty_sentries_bitmap = f2fs_kvzalloc(bitmap_size, GFP_KERNEL);
|
||||
sit_i->dirty_sentries_bitmap = kvzalloc(bitmap_size, GFP_KERNEL);
|
||||
if (!sit_i->dirty_sentries_bitmap)
|
||||
return -ENOMEM;
|
||||
|
||||
|
@ -3037,7 +3037,7 @@ static int build_sit_info(struct f2fs_sb_info *sbi)
|
|||
return -ENOMEM;
|
||||
|
||||
if (sbi->segs_per_sec > 1) {
|
||||
sit_i->sec_entries = f2fs_kvzalloc(MAIN_SECS(sbi) *
|
||||
sit_i->sec_entries = kvzalloc(MAIN_SECS(sbi) *
|
||||
sizeof(struct sec_entry), GFP_KERNEL);
|
||||
if (!sit_i->sec_entries)
|
||||
return -ENOMEM;
|
||||
|
@ -3088,12 +3088,12 @@ static int build_free_segmap(struct f2fs_sb_info *sbi)
|
|||
SM_I(sbi)->free_info = free_i;
|
||||
|
||||
bitmap_size = f2fs_bitmap_size(MAIN_SEGS(sbi));
|
||||
free_i->free_segmap = f2fs_kvmalloc(bitmap_size, GFP_KERNEL);
|
||||
free_i->free_segmap = kvmalloc(bitmap_size, GFP_KERNEL);
|
||||
if (!free_i->free_segmap)
|
||||
return -ENOMEM;
|
||||
|
||||
sec_bitmap_size = f2fs_bitmap_size(MAIN_SECS(sbi));
|
||||
free_i->free_secmap = f2fs_kvmalloc(sec_bitmap_size, GFP_KERNEL);
|
||||
free_i->free_secmap = kvmalloc(sec_bitmap_size, GFP_KERNEL);
|
||||
if (!free_i->free_secmap)
|
||||
return -ENOMEM;
|
||||
|
||||
|
@ -3273,7 +3273,7 @@ static int init_victim_secmap(struct f2fs_sb_info *sbi)
|
|||
struct dirty_seglist_info *dirty_i = DIRTY_I(sbi);
|
||||
unsigned int bitmap_size = f2fs_bitmap_size(MAIN_SECS(sbi));
|
||||
|
||||
dirty_i->victim_secmap = f2fs_kvzalloc(bitmap_size, GFP_KERNEL);
|
||||
dirty_i->victim_secmap = kvzalloc(bitmap_size, GFP_KERNEL);
|
||||
if (!dirty_i->victim_secmap)
|
||||
return -ENOMEM;
|
||||
return 0;
|
||||
|
@ -3295,7 +3295,7 @@ static int build_dirty_segmap(struct f2fs_sb_info *sbi)
|
|||
bitmap_size = f2fs_bitmap_size(MAIN_SEGS(sbi));
|
||||
|
||||
for (i = 0; i < NR_DIRTY_TYPE; i++) {
|
||||
dirty_i->dirty_segmap[i] = f2fs_kvzalloc(bitmap_size, GFP_KERNEL);
|
||||
dirty_i->dirty_segmap[i] = kvzalloc(bitmap_size, GFP_KERNEL);
|
||||
if (!dirty_i->dirty_segmap[i])
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
|
|
@ -1638,16 +1638,16 @@ static int init_blkz_info(struct f2fs_sb_info *sbi, int devi)
|
|||
return 0;
|
||||
|
||||
if (sbi->blocks_per_blkz && sbi->blocks_per_blkz !=
|
||||
SECTOR_TO_BLOCK(bdev_zone_size(bdev)))
|
||||
SECTOR_TO_BLOCK(bdev_zone_sectors(bdev)))
|
||||
return -EINVAL;
|
||||
sbi->blocks_per_blkz = SECTOR_TO_BLOCK(bdev_zone_size(bdev));
|
||||
sbi->blocks_per_blkz = SECTOR_TO_BLOCK(bdev_zone_sectors(bdev));
|
||||
if (sbi->log_blocks_per_blkz && sbi->log_blocks_per_blkz !=
|
||||
__ilog2_u32(sbi->blocks_per_blkz))
|
||||
return -EINVAL;
|
||||
sbi->log_blocks_per_blkz = __ilog2_u32(sbi->blocks_per_blkz);
|
||||
FDEV(devi).nr_blkz = SECTOR_TO_BLOCK(nr_sectors) >>
|
||||
sbi->log_blocks_per_blkz;
|
||||
if (nr_sectors & (bdev_zone_size(bdev) - 1))
|
||||
if (nr_sectors & (bdev_zone_sectors(bdev) - 1))
|
||||
FDEV(devi).nr_blkz++;
|
||||
|
||||
FDEV(devi).blkz_type = kmalloc(FDEV(devi).nr_blkz, GFP_KERNEL);
|
||||
|
@ -1789,7 +1789,7 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi)
|
|||
/* Initialize single device information */
|
||||
if (!RDEV(0).path[0]) {
|
||||
#ifdef CONFIG_BLK_DEV_ZONED
|
||||
if (bdev_zoned_model(sbi->sb->s_bdev) == BLK_ZONED_NONE)
|
||||
if (!bdev_is_zoned(sbi->sb->s_bdev))
|
||||
return 0;
|
||||
max_devices = 1;
|
||||
#else
|
||||
|
|
Loading…
Add table
Reference in a new issue