UPSTREAM: f2fs: should use a temp extent_info for lookup
Otherwise, __lookup_extent_tree() will override the given extent_info which will be used by caller. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> (cherry picked from commit 22a341b43036415718f2d50f5f98b2f891fe17e9) Change-Id: I5ddc08dd3d299f222b4b9b1334f2e675e37956b6 Signed-off-by: zhaoyuenan <amktiao030215@gmail.com>
This commit is contained in:
committed by
Bruno Martins
parent
bfef390e6c
commit
82789d675e
@@ -889,6 +889,7 @@ static int __get_new_block_age(struct inode *inode, struct extent_info *ei,
|
|||||||
loff_t f_size = i_size_read(inode);
|
loff_t f_size = i_size_read(inode);
|
||||||
unsigned long long cur_blocks =
|
unsigned long long cur_blocks =
|
||||||
atomic64_read(&sbi->allocated_data_blocks);
|
atomic64_read(&sbi->allocated_data_blocks);
|
||||||
|
struct extent_info tei = *ei; /* only fofs and len are valid */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When I/O is not aligned to a PAGE_SIZE, update will happen to the last
|
* When I/O is not aligned to a PAGE_SIZE, update will happen to the last
|
||||||
@@ -899,17 +900,17 @@ static int __get_new_block_age(struct inode *inode, struct extent_info *ei,
|
|||||||
blkaddr == NEW_ADDR)
|
blkaddr == NEW_ADDR)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (__lookup_extent_tree(inode, ei->fofs, ei, EX_BLOCK_AGE)) {
|
if (__lookup_extent_tree(inode, ei->fofs, &tei, EX_BLOCK_AGE)) {
|
||||||
unsigned long long cur_age;
|
unsigned long long cur_age;
|
||||||
|
|
||||||
if (cur_blocks >= ei->last_blocks)
|
if (cur_blocks >= tei.last_blocks)
|
||||||
cur_age = cur_blocks - ei->last_blocks;
|
cur_age = cur_blocks - tei.last_blocks;
|
||||||
else
|
else
|
||||||
/* allocated_data_blocks overflow */
|
/* allocated_data_blocks overflow */
|
||||||
cur_age = ULLONG_MAX - ei->last_blocks + cur_blocks;
|
cur_age = ULLONG_MAX - tei.last_blocks + cur_blocks;
|
||||||
|
|
||||||
if (ei->age)
|
if (tei.age)
|
||||||
ei->age = __calculate_block_age(cur_age, ei->age);
|
ei->age = __calculate_block_age(cur_age, tei.age);
|
||||||
else
|
else
|
||||||
ei->age = cur_age;
|
ei->age = cur_age;
|
||||||
ei->last_blocks = cur_blocks;
|
ei->last_blocks = cur_blocks;
|
||||||
|
|||||||
Reference in New Issue
Block a user