Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176257
b: refs/heads/master
c: 73c34b6
h: refs/heads/master
i:
  176255: 5babe88
v: v3
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Dec 15, 2009
1 parent 7c6f855 commit 06a9227
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 28 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9625a5f289f7c3c100b59c317e2bcc3c7e2e51fb
refs/heads/master: 73c34b6accc8427584f5d7db4d5acb230ed8c912
51 changes: 24 additions & 27 deletions trunk/mm/swapfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,9 +519,9 @@ swp_entry_t get_swap_page_of_type(int type)
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)
Expand Down Expand Up @@ -599,7 +599,7 @@ static int swap_entry_free(struct swap_info_struct *p,
*/
void swap_free(swp_entry_t entry)
{
struct swap_info_struct * p;
struct swap_info_struct *p;

p = swap_info_get(entry);
if (p) {
Expand Down Expand Up @@ -629,7 +629,6 @@ void swapcache_free(swp_entry_t entry, struct page *page)
}
spin_unlock(&swap_lock);
}
return;
}

/*
Expand Down Expand Up @@ -782,6 +781,21 @@ int swap_type_of(dev_t device, sector_t offset, struct block_device **bdev_p)
return -ENODEV;
}

/*
* 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)
Expand All @@ -805,7 +819,7 @@ unsigned int count_swap_pages(int type, int free)
spin_unlock(&swap_lock);
return n;
}
#endif
#endif /* CONFIG_HIBERNATION */

/*
* No need to decide whether this PTE shares the swap entry with others,
Expand Down Expand Up @@ -1316,23 +1330,6 @@ sector_t map_swap_page(swp_entry_t entry, struct block_device **bdev)
}
}

#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
*/
Expand Down Expand Up @@ -1523,12 +1520,12 @@ static int setup_swap_extents(struct swap_info_struct *sis, sector_t *span)

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;

Expand Down Expand Up @@ -1780,7 +1777,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;
Expand Down Expand Up @@ -2116,7 +2113,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;
Expand Down Expand Up @@ -2185,7 +2182,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().
Expand Down

0 comments on commit 06a9227

Please sign in to comment.