* Writing to the swap space
@ 2002-05-06 22:11 Pavel Machek
2002-05-06 22:29 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Machek @ 2002-05-06 22:11 UTC (permalink / raw)
To: kernel list
Hi!
For swsusp, I need to write to the swap space.
I used technique similar to this:
static void mark_swapfiles(swp_entry_t prev, int mode)
{
swp_entry_t entry;
union diskpage *cur;
cur = (union diskpage *)get_free_page(GFP_ATOMIC);
if (!cur)
panic("Out of memory in mark_swapfiles");
/* XXX: this is dirty hack to get first page of swap file */
entry = SWP_ENTRY(root_swap, 0);
lock_page(virt_to_page((unsigned long)cur));
rw_swap_page_nolock(READ, entry, (char *) cur);
... modify cur->fields...
lock_page(virt_to_page((unsigned long)cur));
rw_swap_page_nolock(WRITE, entry, (char *)cur);
free_page((unsigned long)cur);
}
It seems not to work any more. Some io is done, but it is not
synchronous any more, and it does not seem to hit the disk.
What am I doing wrong, or is there something wrong in 2.5.12/2.5.13?
Pavel
--
(about SSSCA) "I don't say this lightly. However, I really think that the U.S.
no longer is classifiable as a democracy, but rather as a plutocracy." --hpa
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: Writing to the swap space
2002-05-06 22:11 Writing to the swap space Pavel Machek
@ 2002-05-06 22:29 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2002-05-06 22:29 UTC (permalink / raw)
To: Pavel Machek; +Cc: kernel list, Linus Torvalds
Pavel Machek wrote:
>
> Hi!
>
> For swsusp, I need to write to the swap space.
>
Ah. That's some left-over code. Reads will be OK, but
writes will be unexpectedly asynchronous. Nothing in
the kernel uses that function for writes so it didn't show up.
--- linux-2.5.14/mm/page_io.c Tue Apr 30 17:56:30 2002
+++ 25/mm/page_io.c Mon May 6 15:24:09 2002
@@ -117,9 +117,6 @@ void rw_swap_page_nolock(int rw, swp_ent
page->mapping = &swapper_space;
if (!rw_swap_page_base(rw, entry, page))
unlock_page(page);
- if (rw == WRITE)
- wait_on_page_writeback(page);
- else
- wait_on_page_locked(page);
+ wait_on_page_locked(page);
page->mapping = NULL;
}
-
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-05-06 22:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-06 22:11 Writing to the swap space Pavel Machek
2002-05-06 22:29 ` Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.