Skip to content

Commit 45dcfc2

Browse files
Guoqing Jiangtorvalds
authored andcommitted
fs/buffer.c: use attach/detach_page_private
Since the new pair function is introduced, we can call them to clean the code in buffer.c. Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Link: http://lkml.kernel.org/r/20200517214718.468-5-guoqing.jiang@cloud.ionos.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent d1b89bc commit 45dcfc2

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

‎fs/buffer.c‎

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,6 @@ void __wait_on_buffer(struct buffer_head * bh)
123123
}
124124
EXPORT_SYMBOL(__wait_on_buffer);
125125

126-
static void
127-
__clear_page_buffers(struct page *page)
128-
{
129-
ClearPagePrivate(page);
130-
set_page_private(page, 0);
131-
put_page(page);
132-
}
133-
134126
static void buffer_io_error(struct buffer_head *bh, char *msg)
135127
{
136128
if (!test_bit(BH_Quiet, &bh->b_state))
@@ -906,7 +898,7 @@ link_dev_buffers(struct page *page, struct buffer_head *head)
906898
bh = bh->b_this_page;
907899
} while (bh);
908900
tail->b_this_page = head;
909-
attach_page_buffers(page, head);
901+
attach_page_private(page, head);
910902
}
911903

912904
static sector_t blkdev_max_block(struct block_device *bdev, unsigned int size)
@@ -1587,7 +1579,7 @@ void create_empty_buffers(struct page *page,
15871579
bh = bh->b_this_page;
15881580
} while (bh != head);
15891581
}
1590-
attach_page_buffers(page, head);
1582+
attach_page_private(page, head);
15911583
spin_unlock(&page->mapping->private_lock);
15921584
}
15931585
EXPORT_SYMBOL(create_empty_buffers);
@@ -2574,7 +2566,7 @@ static void attach_nobh_buffers(struct page *page, struct buffer_head *head)
25742566
bh->b_this_page = head;
25752567
bh = bh->b_this_page;
25762568
} while (bh != head);
2577-
attach_page_buffers(page, head);
2569+
attach_page_private(page, head);
25782570
spin_unlock(&page->mapping->private_lock);
25792571
}
25802572

@@ -3234,7 +3226,7 @@ drop_buffers(struct page *page, struct buffer_head **buffers_to_free)
32343226
bh = next;
32353227
} while (bh != head);
32363228
*buffers_to_free = head;
3237-
__clear_page_buffers(page);
3229+
detach_page_private(page);
32383230
return 1;
32393231
failed:
32403232
return 0;

0 commit comments

Comments
 (0)