btrfs: use list_last_entry in add_falloc_range
Instead of calling list_entry with head->prev simply call list_last_entry which makes it obvious which member of the list is being referred. This allows to remove the extra 'prev' pointer. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
committed by
David Sterba
parent
4183abf6cb
commit
ec87b42f70
@@ -3034,7 +3034,6 @@ struct falloc_range {
|
|||||||
*/
|
*/
|
||||||
static int add_falloc_range(struct list_head *head, u64 start, u64 len)
|
static int add_falloc_range(struct list_head *head, u64 start, u64 len)
|
||||||
{
|
{
|
||||||
struct falloc_range *prev = NULL;
|
|
||||||
struct falloc_range *range = NULL;
|
struct falloc_range *range = NULL;
|
||||||
|
|
||||||
if (list_empty(head))
|
if (list_empty(head))
|
||||||
@@ -3044,9 +3043,9 @@ static int add_falloc_range(struct list_head *head, u64 start, u64 len)
|
|||||||
* As fallocate iterate by bytenr order, we only need to check
|
* As fallocate iterate by bytenr order, we only need to check
|
||||||
* the last range.
|
* the last range.
|
||||||
*/
|
*/
|
||||||
prev = list_entry(head->prev, struct falloc_range, list);
|
range = list_last_entry(head, struct falloc_range, list);
|
||||||
if (prev->start + prev->len == start) {
|
if (range->start + range->len == start) {
|
||||||
prev->len += len;
|
range->len += len;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
insert:
|
insert:
|
||||||
|
|||||||
Reference in New Issue
Block a user