Skip to contentSkip to conversation

swap-use-bdev_read_page-bdev_write_page.patch removed from -mm tree

merged [email protected] 1 participant 1 message Jun 5, 2014

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

Subject: [merged] swap-use-bdev_read_page-bdev_write_page.patch removed from -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Thu, 05 Jun 2014 12:50:36 -0700

The patch titled
Subject: swap: use bdev_read_page() / bdev_write_page()
has been removed from the -mm tree. Its filename was
swap-use-bdev_read_page-bdev_write_page.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Matthew Wilcox <[email protected]>
Subject: swap: use bdev_read_page() / bdev_write_page()

By calling the device driver to write the page directly, we avoid allocating a BIO, which allows us to free memory without allocating memory.

[[email protected]: fix used-uninitialized bug]
Cc Dave Chinner <[email protected]>
Cc Dheeraj Reddy <[email protected]>
Cc Hugh Dickins <[email protected]>

---

 mm/page_io.c |   21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
mm/page_io.c renamed from mm/page_io.c~swap-use-bdev_read_page-bdev_write_page +20 -1
diff -puN mm/page_io.c~swap-use-bdev_read_page-bdev_write_page mm/page_io.c
@@ -248,11 +248,16 @@ out:
 	return ret;
 }
 
+static sector_t swap_page_sector(struct page *page)
+{
+	return (sector_t)__page_file_index(page) << (PAGE_CACHE_SHIFT - 9);
+}
+
 int __swap_writepage(struct page *page, struct writeback_control *wbc,
 	void (*end_write_func)(struct bio *, int))
 {
 	struct bio *bio;
-	int ret = 0, rw = WRITE;
+	int ret, rw = WRITE;
 	struct swap_info_struct *sis = page_swap_info(page);
 
 	if (sis->flags & SWP_FILE) {
@@ -297,6 +302,13 @@ int __swap_writepage(struct page *page,
 		return ret;
 	}
 
+	ret = bdev_write_page(sis->bdev, swap_page_sector(page), page, wbc);
+	if (!ret) {
+		count_vm_event(PSWPOUT);
+		return 0;
+	}
+
+	ret = 0;
 	bio = get_swap_bio(GFP_NOIO, page, end_write_func);
 	if (bio == NULL) {
 		set_page_dirty(page);
@@ -338,6 +350,13 @@ int swap_readpage(struct page *page)
 		return ret;
 	}
 
+	ret = bdev_read_page(sis->bdev, swap_page_sector(page), page);
+	if (!ret) {
+		count_vm_event(PSWPIN);
+		return 0;
+	}
+
+	ret = 0;
 	bio = get_swap_bio(GFP_KERNEL, page, end_swap_bio_read);
 	if (bio == NULL) {
 		unlock_page(page);

_

Patches currently in -mm which might be from [email protected] are

origin.patch mm-introduce-do_shared_fault-and-drop-do_fault-fix-fix.patch do_shared_fault-check-that-mmap_sem-is-held.patch linux-next.patch