Commit 45dcfc27 authored by Guoqing Jiang's avatar Guoqing Jiang Committed by Linus Torvalds

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: default avatarGuoqing Jiang <guoqing.jiang@cloud.ionos.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Reviewed-by: default avatarAndrew 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.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent d1b89bc0
...@@ -123,14 +123,6 @@ void __wait_on_buffer(struct buffer_head * bh) ...@@ -123,14 +123,6 @@ void __wait_on_buffer(struct buffer_head * bh)
} }
EXPORT_SYMBOL(__wait_on_buffer); EXPORT_SYMBOL(__wait_on_buffer);
static void
__clear_page_buffers(struct page *page)
{
ClearPagePrivate(page);
set_page_private(page, 0);
put_page(page);
}
static void buffer_io_error(struct buffer_head *bh, char *msg) static void buffer_io_error(struct buffer_head *bh, char *msg)
{ {
if (!test_bit(BH_Quiet, &bh->b_state)) if (!test_bit(BH_Quiet, &bh->b_state))
...@@ -906,7 +898,7 @@ link_dev_buffers(struct page *page, struct buffer_head *head) ...@@ -906,7 +898,7 @@ link_dev_buffers(struct page *page, struct buffer_head *head)
bh = bh->b_this_page; bh = bh->b_this_page;
} while (bh); } while (bh);
tail->b_this_page = head; tail->b_this_page = head;
attach_page_buffers(page, head); attach_page_private(page, head);
} }
static sector_t blkdev_max_block(struct block_device *bdev, unsigned int size) static sector_t blkdev_max_block(struct block_device *bdev, unsigned int size)
...@@ -1587,7 +1579,7 @@ void create_empty_buffers(struct page *page, ...@@ -1587,7 +1579,7 @@ void create_empty_buffers(struct page *page,
bh = bh->b_this_page; bh = bh->b_this_page;
} while (bh != head); } while (bh != head);
} }
attach_page_buffers(page, head); attach_page_private(page, head);
spin_unlock(&page->mapping->private_lock); spin_unlock(&page->mapping->private_lock);
} }
EXPORT_SYMBOL(create_empty_buffers); EXPORT_SYMBOL(create_empty_buffers);
...@@ -2574,7 +2566,7 @@ static void attach_nobh_buffers(struct page *page, struct buffer_head *head) ...@@ -2574,7 +2566,7 @@ static void attach_nobh_buffers(struct page *page, struct buffer_head *head)
bh->b_this_page = head; bh->b_this_page = head;
bh = bh->b_this_page; bh = bh->b_this_page;
} while (bh != head); } while (bh != head);
attach_page_buffers(page, head); attach_page_private(page, head);
spin_unlock(&page->mapping->private_lock); spin_unlock(&page->mapping->private_lock);
} }
...@@ -3234,7 +3226,7 @@ drop_buffers(struct page *page, struct buffer_head **buffers_to_free) ...@@ -3234,7 +3226,7 @@ drop_buffers(struct page *page, struct buffer_head **buffers_to_free)
bh = next; bh = next;
} while (bh != head); } while (bh != head);
*buffers_to_free = head; *buffers_to_free = head;
__clear_page_buffers(page); detach_page_private(page);
return 1; return 1;
failed: failed:
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment