@@ -519,9 +519,9 @@ swp_entry_t get_swap_page_of_type(int type)
519519 return (swp_entry_t ) {0 };
520520}
521521
522- static struct swap_info_struct * swap_info_get (swp_entry_t entry )
522+ static struct swap_info_struct * swap_info_get (swp_entry_t entry )
523523{
524- struct swap_info_struct * p ;
524+ struct swap_info_struct * p ;
525525 unsigned long offset , type ;
526526
527527 if (!entry .val )
@@ -599,7 +599,7 @@ static int swap_entry_free(struct swap_info_struct *p,
599599 */
600600void swap_free (swp_entry_t entry )
601601{
602- struct swap_info_struct * p ;
602+ struct swap_info_struct * p ;
603603
604604 p = swap_info_get (entry );
605605 if (p ) {
@@ -629,7 +629,6 @@ void swapcache_free(swp_entry_t entry, struct page *page)
629629 }
630630 spin_unlock (& swap_lock );
631631 }
632- return ;
633632}
634633
635634/*
@@ -782,6 +781,21 @@ int swap_type_of(dev_t device, sector_t offset, struct block_device **bdev_p)
782781 return - ENODEV ;
783782}
784783
784+ /*
785+ * Get the (PAGE_SIZE) block corresponding to given offset on the swapdev
786+ * corresponding to given index in swap_info (swap type).
787+ */
788+ sector_t swapdev_block (int type , pgoff_t offset )
789+ {
790+ struct block_device * bdev ;
791+
792+ if ((unsigned int )type >= nr_swapfiles )
793+ return 0 ;
794+ if (!(swap_info [type ]-> flags & SWP_WRITEOK ))
795+ return 0 ;
796+ return map_swap_page (swp_entry (type , offset ), & bdev );
797+ }
798+
785799/*
786800 * Return either the total number of swap pages of given type, or the number
787801 * of free pages of that type (depending on @free)
@@ -805,7 +819,7 @@ unsigned int count_swap_pages(int type, int free)
805819 spin_unlock (& swap_lock );
806820 return n ;
807821}
808- #endif
822+ #endif /* CONFIG_HIBERNATION */
809823
810824/*
811825 * No need to decide whether this PTE shares the swap entry with others,
@@ -1316,23 +1330,6 @@ sector_t map_swap_page(swp_entry_t entry, struct block_device **bdev)
13161330 }
13171331}
13181332
1319- #ifdef CONFIG_HIBERNATION
1320- /*
1321- * Get the (PAGE_SIZE) block corresponding to given offset on the swapdev
1322- * corresponding to given index in swap_info (swap type).
1323- */
1324- sector_t swapdev_block (int type , pgoff_t offset )
1325- {
1326- struct block_device * bdev ;
1327-
1328- if ((unsigned int )type >= nr_swapfiles )
1329- return 0 ;
1330- if (!(swap_info [type ]-> flags & SWP_WRITEOK ))
1331- return 0 ;
1332- return map_swap_page (swp_entry (type , offset ), & bdev );
1333- }
1334- #endif /* CONFIG_HIBERNATION */
1335-
13361333/*
13371334 * Free all of a swapdev's extent information
13381335 */
@@ -1523,12 +1520,12 @@ static int setup_swap_extents(struct swap_info_struct *sis, sector_t *span)
15231520
15241521SYSCALL_DEFINE1 (swapoff , const char __user * , specialfile )
15251522{
1526- struct swap_info_struct * p = NULL ;
1523+ struct swap_info_struct * p = NULL ;
15271524 unsigned short * swap_map ;
15281525 struct file * swap_file , * victim ;
15291526 struct address_space * mapping ;
15301527 struct inode * inode ;
1531- char * pathname ;
1528+ char * pathname ;
15321529 int i , type , prev ;
15331530 int err ;
15341531
@@ -1780,7 +1777,7 @@ late_initcall(max_swapfiles_check);
17801777 */
17811778SYSCALL_DEFINE2 (swapon , const char __user * , specialfile , int , swap_flags )
17821779{
1783- struct swap_info_struct * p ;
1780+ struct swap_info_struct * p ;
17841781 char * name = NULL ;
17851782 struct block_device * bdev = NULL ;
17861783 struct file * swap_file = NULL ;
@@ -2116,7 +2113,7 @@ void si_swapinfo(struct sysinfo *val)
21162113 */
21172114static int __swap_duplicate (swp_entry_t entry , bool cache )
21182115{
2119- struct swap_info_struct * p ;
2116+ struct swap_info_struct * p ;
21202117 unsigned long offset , type ;
21212118 int result = - EINVAL ;
21222119 int count ;
@@ -2185,7 +2182,7 @@ void swap_duplicate(swp_entry_t entry)
21852182/*
21862183 * @entry: swap entry for which we allocate swap cache.
21872184 *
2188- * Called when allocating swap cache for exising swap entry,
2185+ * Called when allocating swap cache for existing swap entry,
21892186 * This can return error codes. Returns 0 at success.
21902187 * -EBUSY means there is a swap cache.
21912188 * Note: return code is different from swap_duplicate().
0 commit comments