Merge remote-tracking branch 'aosp/upstream-f2fs-stable-linux-4.19.y' into android-4.19
* aosp/upstream-f2fs-stable-linux-4.19.y: f2fs: fix race conditions in ->d_compare() and ->d_hash() f2fs: fix dcache lookup of !casefolded directories f2fs: Add f2fs stats to sysfs f2fs: delete duplicate information on sysfs nodes f2fs: change to use rwsem for gc_mutex f2fs: update f2fs document regarding to fsync_mode f2fs: add a way to turn off ipu bio cache f2fs: code cleanup for f2fs_statfs_project() f2fs: fix miscounted block limit in f2fs_statfs_project() f2fs: show the CP_PAUSE reason in checkpoint traces f2fs: fix deadlock allocating bio_post_read_ctx from mempool f2fs: remove unneeded check for error allocating bio_post_read_ctx f2fs: convert inline_dir early before starting rename f2fs: fix memleak of kobject f2fs: fix to add swap extent correctly mm: export add_swap_extent() f2fs: run fsck when getting bad inode during GC f2fs: support data compression f2fs: free sysfs kobject f2fs: declare nested quota_sem and remove unnecessary sems f2fs: don't put new_page twice in f2fs_rename f2fs: set I_LINKABLE early to avoid wrong access by vfs f2fs: don't keep META_MAPPING pages used for moving verity file blocks f2fs: introduce private bioset f2fs: cleanup duplicate stats for atomic files f2fs: set GFP_NOFS when moving inline dentries f2fs: should avoid recursive filesystem ops f2fs: keep quota data on write_begin failure f2fs: call f2fs_balance_fs outside of locked page f2fs: preallocate DIO blocks when forcing buffered_io Bug: 148667616 Change-Id: Ic885bdb3ef3a8b5d264497b9972b41bcd26b4e85 Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
This commit is contained in:
@@ -386,7 +386,7 @@ static int f2fs_move_inline_dirents(struct inode *dir, struct page *ipage,
|
||||
struct f2fs_dentry_ptr src, dst;
|
||||
int err;
|
||||
|
||||
page = f2fs_grab_cache_page(dir->i_mapping, 0, false);
|
||||
page = f2fs_grab_cache_page(dir->i_mapping, 0, true);
|
||||
if (!page) {
|
||||
f2fs_put_page(ipage, 1);
|
||||
return -ENOMEM;
|
||||
@@ -548,7 +548,7 @@ static int f2fs_move_rehashed_dirents(struct inode *dir, struct page *ipage,
|
||||
return err;
|
||||
}
|
||||
|
||||
static int f2fs_convert_inline_dir(struct inode *dir, struct page *ipage,
|
||||
static int do_convert_inline_dir(struct inode *dir, struct page *ipage,
|
||||
void *inline_dentry)
|
||||
{
|
||||
if (!F2FS_I(dir)->i_dir_level)
|
||||
@@ -557,6 +557,44 @@ static int f2fs_convert_inline_dir(struct inode *dir, struct page *ipage,
|
||||
return f2fs_move_rehashed_dirents(dir, ipage, inline_dentry);
|
||||
}
|
||||
|
||||
int f2fs_try_convert_inline_dir(struct inode *dir, struct dentry *dentry)
|
||||
{
|
||||
struct f2fs_sb_info *sbi = F2FS_I_SB(dir);
|
||||
struct page *ipage;
|
||||
struct fscrypt_name fname;
|
||||
void *inline_dentry = NULL;
|
||||
int err = 0;
|
||||
|
||||
if (!f2fs_has_inline_dentry(dir))
|
||||
return 0;
|
||||
|
||||
f2fs_lock_op(sbi);
|
||||
|
||||
err = fscrypt_setup_filename(dir, &dentry->d_name, 0, &fname);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
ipage = f2fs_get_node_page(sbi, dir->i_ino);
|
||||
if (IS_ERR(ipage)) {
|
||||
err = PTR_ERR(ipage);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (f2fs_has_enough_room(dir, ipage, &fname)) {
|
||||
f2fs_put_page(ipage, 1);
|
||||
goto out;
|
||||
}
|
||||
|
||||
inline_dentry = inline_data_addr(dir, ipage);
|
||||
|
||||
err = do_convert_inline_dir(dir, ipage, inline_dentry);
|
||||
if (!err)
|
||||
f2fs_put_page(ipage, 1);
|
||||
out:
|
||||
f2fs_unlock_op(sbi);
|
||||
return err;
|
||||
}
|
||||
|
||||
int f2fs_add_inline_entry(struct inode *dir, const struct qstr *new_name,
|
||||
const struct qstr *orig_name,
|
||||
struct inode *inode, nid_t ino, umode_t mode)
|
||||
@@ -580,7 +618,7 @@ int f2fs_add_inline_entry(struct inode *dir, const struct qstr *new_name,
|
||||
|
||||
bit_pos = f2fs_room_for_filename(d.bitmap, slots, d.max);
|
||||
if (bit_pos >= d.max) {
|
||||
err = f2fs_convert_inline_dir(dir, ipage, inline_dentry);
|
||||
err = do_convert_inline_dir(dir, ipage, inline_dentry);
|
||||
if (err)
|
||||
return err;
|
||||
err = -EAGAIN;
|
||||
|
||||
Reference in New Issue
Block a user