Re: [linux-pm] [RFC 03/15] PM / Hibernate: separate block_io

Previous thread: [RFC 04/15] PM / Hibernate: move the first_sector out of swsusp_write by Jiri Slaby on Tuesday, March 23, 2010 - 9:17 am. (3 messages)

Next thread: Re: [PATCH 1/6] serial: TTY: new ldisc for TI BT/FM/GPS chips by Pavan Savoy on Tuesday, March 23, 2010 - 9:38 am. (1 message)
From: Jiri Slaby
Date: Tuesday, March 23, 2010 - 9:17 am

Move block I/O operations to a separate file. It is because it will
be used later not only by the swap writer.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Nigel Cunningham <ncunningham@crca.org.au>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
---
 kernel/power/Makefile   |    3 +-
 kernel/power/block_io.c |  103 +++++++++++++++++++++++++++++++++++
 kernel/power/power.h    |    9 +++
 kernel/power/swap.c     |  136 +++++++++--------------------------------------
 4 files changed, 139 insertions(+), 112 deletions(-)
 create mode 100644 kernel/power/block_io.c

diff --git a/kernel/power/Makefile b/kernel/power/Makefile
index 4319181..524e058 100644
--- a/kernel/power/Makefile
+++ b/kernel/power/Makefile
@@ -8,7 +8,8 @@ obj-$(CONFIG_PM_SLEEP)		+= console.o
 obj-$(CONFIG_FREEZER)		+= process.o
 obj-$(CONFIG_SUSPEND)		+= suspend.o
 obj-$(CONFIG_PM_TEST_SUSPEND)	+= suspend_test.o
-obj-$(CONFIG_HIBERNATION)	+= hibernate.o snapshot.o swap.o user.o
+obj-$(CONFIG_HIBERNATION)	+= hibernate.o snapshot.o swap.o user.o \
+				   block_io.o
 obj-$(CONFIG_HIBERNATION_NVS)	+= hibernate_nvs.o
 
 obj-$(CONFIG_MAGIC_SYSRQ)	+= poweroff.o
diff --git a/kernel/power/block_io.c b/kernel/power/block_io.c
new file mode 100644
index 0000000..2b7898a
--- /dev/null
+++ b/kernel/power/block_io.c
@@ -0,0 +1,103 @@
+/*
+ * This file provides functions for block I/O operations on swap/file.
+ *
+ * Copyright (C) 1998,2001-2005 Pavel Machek <pavel@suse.cz>
+ * Copyright (C) 2006 Rafael J. Wysocki <rjw@sisk.pl>
+ *
+ * This file is released under the GPLv2.
+ */
+
+#include <linux/bio.h>
+#include <linux/kernel.h>
+#include <linux/pagemap.h>
+#include <linux/swap.h>
+
+#include "power.h"
+
+/**
+ *	submit - submit BIO request.
+ *	@rw:	READ or WRITE.
+ *	@off	physical offset of page.
+ *	@page:	page we're reading or writing.
+ *	@bio_chain: list of pending biod (for async reading)
+ *
+ *	Straight from the textbook - allocate and initialize the bio.
+ *	If we're reading, make sure the page ...
From: Pavel Machek
Date: Wednesday, March 24, 2010 - 1:30 pm

sws_ is kind of strange prefix. We were trying to get away from
"swsuspend" name for quite some time...
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--

From: Jiri Slaby
Date: Wednesday, March 24, 2010 - 2:22 pm

No problem to change the prefix to anything else. Do you (anybody)
suggest anything?

-- 
js
--

From: Nigel Cunningham
Date: Wednesday, March 24, 2010 - 3:58 pm

Hi.


How about some abbreviation of hibernate? "hib"?

Regards,

Nigel
--

From: Nigel Cunningham
Date: Wednesday, March 24, 2010 - 7:35 pm

Hi again.


On further reflection, how about "std" (suspend to disk)? I think that's 
less ugly than the 'hib' suggestion :)

Regards,

Nigel
--

From: Rafael J. Wysocki
Date: Thursday, March 25, 2010 - 1:12 pm

But it also decodes as "standard" if someone is not in the right context. :-)

If the "bio" part of the name is not essential (ie. there's no conflicting name
already), we could call it simply hibernate_read_page().

Rafael
--

From: Nigel Cunningham
Date: Thursday, March 25, 2010 - 1:13 pm

Hi.



Yeah. So we're going with hibernate or hib_ if it needs abbreviating?

Nigel
--

From: Rafael J. Wysocki
Date: Thursday, March 25, 2010 - 1:33 pm

I'd just use "hibernate" without abbreviating if reasonably possible.
We can also use "image_" in some cases I guess.

Rafael
--

From: Nigel Cunningham
Date: Thursday, March 25, 2010 - 1:36 pm

Hi.


k.

Nigel
--

From: Pavel Machek
Date: Monday, March 29, 2010 - 6:30 am

Hmm, and when you are in really wrong context, you get rather nasty
diseases...

std_prepare() seems like rather bad idea :-).
									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--

From: Pavel Machek
Date: Thursday, March 25, 2010 - 7:29 am

Previous thread: [RFC 04/15] PM / Hibernate: move the first_sector out of swsusp_write by Jiri Slaby on Tuesday, March 23, 2010 - 9:17 am. (3 messages)

Next thread: Re: [PATCH 1/6] serial: TTY: new ldisc for TI BT/FM/GPS chips by Pavan Savoy on Tuesday, March 23, 2010 - 9:38 am. (1 message)