swapfile.c (f9f956b550b8ce6fb902af9f29ba31b3e0fd052d) | swapfile.c (3ecdeb0f876e91c4a7129ba2ba5baa530aa6c4f9) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * linux/mm/swapfile.c 4 * 5 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds 6 * Swap reorganised 29.12.95, Stephen Tweedie 7 */ 8 --- 1430 unchanged lines hidden (view full) --- 1439 return swap_count(si->swap_map[offset]); 1440} 1441 1442/* 1443 * How many references to @entry are currently swapped out? 1444 * This does not give an exact answer when swap count is continued, 1445 * but does include the high COUNT_CONTINUED flag to allow for that. 1446 */ | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * linux/mm/swapfile.c 4 * 5 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds 6 * Swap reorganised 29.12.95, Stephen Tweedie 7 */ 8 --- 1430 unchanged lines hidden (view full) --- 1439 return swap_count(si->swap_map[offset]); 1440} 1441 1442/* 1443 * How many references to @entry are currently swapped out? 1444 * This does not give an exact answer when swap count is continued, 1445 * but does include the high COUNT_CONTINUED flag to allow for that. 1446 */ |
1447static int swap_swapcount(struct swap_info_struct *si, swp_entry_t entry) | 1447int swap_swapcount(struct swap_info_struct *si, swp_entry_t entry) |
1448{ 1449 pgoff_t offset = swp_offset(entry); 1450 struct swap_cluster_info *ci; 1451 int count; 1452 1453 ci = lock_cluster_or_swap_info(si, offset); 1454 count = swap_count(si->swap_map[offset]); 1455 unlock_cluster_or_swap_info(si, ci); 1456 return count; 1457} 1458 1459/* 1460 * How many references to @entry are currently swapped out? | 1448{ 1449 pgoff_t offset = swp_offset(entry); 1450 struct swap_cluster_info *ci; 1451 int count; 1452 1453 ci = lock_cluster_or_swap_info(si, offset); 1454 count = swap_count(si->swap_map[offset]); 1455 unlock_cluster_or_swap_info(si, ci); 1456 return count; 1457} 1458 1459/* 1460 * How many references to @entry are currently swapped out? |
1461 * This does not give an exact answer when swap count is continued, 1462 * but does include the high COUNT_CONTINUED flag to allow for that. 1463 */ 1464int __swp_swapcount(swp_entry_t entry) 1465{ 1466 int count = 0; 1467 struct swap_info_struct *si; 1468 1469 si = get_swap_device(entry); 1470 if (si) { 1471 count = swap_swapcount(si, entry); 1472 put_swap_device(si); 1473 } 1474 return count; 1475} 1476 1477/* 1478 * How many references to @entry are currently swapped out? | |
1479 * This considers COUNT_CONTINUED so it returns exact answer. 1480 */ 1481int swp_swapcount(swp_entry_t entry) 1482{ 1483 int count, tmp_count, n; 1484 struct swap_info_struct *p; 1485 struct swap_cluster_info *ci; 1486 struct page *page; --- 2201 unchanged lines hidden --- | 1461 * This considers COUNT_CONTINUED so it returns exact answer. 1462 */ 1463int swp_swapcount(swp_entry_t entry) 1464{ 1465 int count, tmp_count, n; 1466 struct swap_info_struct *p; 1467 struct swap_cluster_info *ci; 1468 struct page *page; --- 2201 unchanged lines hidden --- |