From: Hugh Dickins <hugh.dickins@tiscali.co.uk>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Rafael Wysocki <rjw@sisk.pl>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH 4/9] swap_info: miscellaneous minor cleanups
Date: Thu, 15 Oct 2009 01:50:54 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.64.0910150149160.3291@sister.anvils> (raw)
In-Reply-To: <Pine.LNX.4.64.0910150130001.2250@sister.anvils>
Move CONFIG_MIGRATION's swapdev_block() into the main CONFIG_MIGRATION
block, remove extraneous whitespace and return, fix typo in a comment.
Signed-off-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
---
mm/swapfile.c | 51 ++++++++++++++++++++++--------------------------
1 file changed, 24 insertions(+), 27 deletions(-)
--- si3/mm/swapfile.c 2009-10-14 21:26:22.000000000 +0100
+++ si4/mm/swapfile.c 2009-10-14 21:26:32.000000000 +0100
@@ -519,9 +519,9 @@ swp_entry_t get_swap_page_of_type(int ty
return (swp_entry_t) {0};
}
-static struct swap_info_struct * swap_info_get(swp_entry_t entry)
+static struct swap_info_struct *swap_info_get(swp_entry_t entry)
{
- struct swap_info_struct * p;
+ struct swap_info_struct *p;
unsigned long offset, type;
if (!entry.val)
@@ -599,7 +599,7 @@ static int swap_entry_free(struct swap_i
*/
void swap_free(swp_entry_t entry)
{
- struct swap_info_struct * p;
+ struct swap_info_struct *p;
p = swap_info_get(entry);
if (p) {
@@ -629,7 +629,6 @@ void swapcache_free(swp_entry_t entry, s
}
spin_unlock(&swap_lock);
}
- return;
}
/*
@@ -783,6 +782,21 @@ int swap_type_of(dev_t device, sector_t
}
/*
+ * Get the (PAGE_SIZE) block corresponding to given offset on the swapdev
+ * corresponding to given index in swap_info (swap type).
+ */
+sector_t swapdev_block(int type, pgoff_t offset)
+{
+ struct block_device *bdev;
+
+ if ((unsigned int)type >= nr_swapfiles)
+ return 0;
+ if (!(swap_info[type]->flags & SWP_WRITEOK))
+ return 0;
+ return map_swap_page(swp_entry(type, offset), &bdev);
+}
+
+/*
* Return either the total number of swap pages of given type, or the number
* of free pages of that type (depending on @free)
*
@@ -805,7 +819,7 @@ unsigned int count_swap_pages(int type,
spin_unlock(&swap_lock);
return n;
}
-#endif
+#endif /* CONFIG_HIBERNATION */
/*
* No need to decide whether this PTE shares the swap entry with others,
@@ -1317,23 +1331,6 @@ sector_t map_swap_page(swp_entry_t entry
}
}
-#ifdef CONFIG_HIBERNATION
-/*
- * Get the (PAGE_SIZE) block corresponding to given offset on the swapdev
- * corresponding to given index in swap_info (swap type).
- */
-sector_t swapdev_block(int type, pgoff_t offset)
-{
- struct block_device *bdev;
-
- if ((unsigned int)type >= nr_swapfiles)
- return 0;
- if (!(swap_info[type]->flags & SWP_WRITEOK))
- return 0;
- return map_swap_page(swp_entry(type, offset), &bdev);
-}
-#endif /* CONFIG_HIBERNATION */
-
/*
* Free all of a swapdev's extent information
*/
@@ -1525,12 +1522,12 @@ bad_bmap:
SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
{
- struct swap_info_struct * p = NULL;
+ struct swap_info_struct *p = NULL;
unsigned short *swap_map;
struct file *swap_file, *victim;
struct address_space *mapping;
struct inode *inode;
- char * pathname;
+ char *pathname;
int i, type, prev;
int err;
@@ -1782,7 +1779,7 @@ late_initcall(max_swapfiles_check);
*/
SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
{
- struct swap_info_struct * p;
+ struct swap_info_struct *p;
char *name = NULL;
struct block_device *bdev = NULL;
struct file *swap_file = NULL;
@@ -2117,7 +2114,7 @@ void si_swapinfo(struct sysinfo *val)
*/
static int __swap_duplicate(swp_entry_t entry, bool cache)
{
- struct swap_info_struct * p;
+ struct swap_info_struct *p;
unsigned long offset, type;
int result = -EINVAL;
int count;
@@ -2186,7 +2183,7 @@ void swap_duplicate(swp_entry_t entry)
/*
* @entry: swap entry for which we allocate swap cache.
*
- * Called when allocating swap cache for exising swap entry,
+ * Called when allocating swap cache for existing swap entry,
* This can return error codes. Returns 0 at success.
* -EBUSY means there is a swap cache.
* Note: return code is different from swap_duplicate().
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2009-10-15 0:50 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-15 0:44 [PATCH 0/9] swap_info and swap_map patches Hugh Dickins
2009-10-15 0:46 ` [PATCH 1/9] swap_info: private to swapfile.c Hugh Dickins
2009-10-15 14:57 ` Rik van Riel
2009-10-15 23:10 ` Nigel Cunningham
2009-10-16 0:28 ` Hugh Dickins
2009-10-15 0:48 ` [PATCH 2/9] swap_info: change to array of pointers Hugh Dickins
2009-10-15 2:11 ` KAMEZAWA Hiroyuki
2009-10-15 22:41 ` Hugh Dickins
2009-10-15 23:04 ` Hugh Dickins
2009-10-15 23:47 ` KAMEZAWA Hiroyuki
2009-10-15 23:46 ` KAMEZAWA Hiroyuki
2009-10-15 15:02 ` Rik van Riel
2009-10-15 0:49 ` [PATCH 3/9] swap_info: include first_swap_extent Hugh Dickins
2009-10-15 0:50 ` Hugh Dickins [this message]
2009-10-15 2:19 ` [PATCH 4/9] swap_info: miscellaneous minor cleanups KAMEZAWA Hiroyuki
2009-10-15 22:01 ` Hugh Dickins
2009-10-16 0:41 ` [PATCH 4/9 v2] " Hugh Dickins
2009-10-15 0:52 ` [PATCH 5/9] swap_info: SWAP_HAS_CACHE cleanups Hugh Dickins
2009-10-15 2:37 ` KAMEZAWA Hiroyuki
2009-10-15 22:08 ` Hugh Dickins
2009-10-15 0:53 ` [PATCH 6/9] swap_info: swap_map of chars not shorts Hugh Dickins
2009-10-15 2:44 ` KAMEZAWA Hiroyuki
2009-10-15 22:17 ` Hugh Dickins
2009-10-15 23:52 ` KAMEZAWA Hiroyuki
2009-10-15 0:56 ` [PATCH 7/9] swap_info: swap count continuations Hugh Dickins
2009-10-15 3:30 ` KAMEZAWA Hiroyuki
2009-10-15 19:45 ` Andrew Morton
2009-10-15 21:17 ` David Rientjes
2009-10-16 0:21 ` Hugh Dickins
2009-10-15 23:53 ` Hugh Dickins
2009-10-16 1:29 ` KAMEZAWA Hiroyuki
2009-10-16 2:24 ` Hugh Dickins
2009-10-16 4:06 ` KAMEZAWA Hiroyuki
2009-10-16 4:49 ` Nitin Gupta
2009-10-16 6:30 ` [PATCH] mm: call pte_unmap() against a proper pte (Re: [PATCH 7/9] swap_info: swap count continuations) Daisuke Nishimura
2009-10-16 8:01 ` KAMEZAWA Hiroyuki
2009-10-15 0:57 ` [PATCH 8/9] swap_info: note SWAP_MAP_SHMEM Hugh Dickins
2009-10-15 3:32 ` KAMEZAWA Hiroyuki
2009-10-15 22:23 ` Hugh Dickins
2009-10-16 0:04 ` KAMEZAWA Hiroyuki
2009-10-15 0:58 ` [PATCH 9/9] swap_info: reorder its fields Hugh Dickins
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0910150149160.3291@sister.anvils \
--to=hugh.dickins@tiscali.co.uk \
--cc=akpm@linux-foundation.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rjw@sisk.pl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).