swapfile.c (a8b3e6f10f08f66ae1072efd087b30966a3654f6) | swapfile.c (b0d9bcd4bb79a7834f8492f2ae5c2655a551f23d) |
---|---|
1/* 2 * linux/mm/swapfile.c 3 * 4 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds 5 * Swap reorganised 29.12.95, Stephen Tweedie 6 */ 7 8#include <linux/config.h> --- 912 unchanged lines hidden (view full) --- 921 * swapfiles are handled *identically* after swapon time. 922 * 923 * For S_ISREG swapfiles, setup_swap_extents() will walk all the file's blocks 924 * and will parse them into an ordered extent list, in PAGE_SIZE chunks. If 925 * some stray blocks are found which do not fall within the PAGE_SIZE alignment 926 * requirements, they are simply tossed out - we will never use those blocks 927 * for swapping. 928 * | 1/* 2 * linux/mm/swapfile.c 3 * 4 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds 5 * Swap reorganised 29.12.95, Stephen Tweedie 6 */ 7 8#include <linux/config.h> --- 912 unchanged lines hidden (view full) --- 921 * swapfiles are handled *identically* after swapon time. 922 * 923 * For S_ISREG swapfiles, setup_swap_extents() will walk all the file's blocks 924 * and will parse them into an ordered extent list, in PAGE_SIZE chunks. If 925 * some stray blocks are found which do not fall within the PAGE_SIZE alignment 926 * requirements, they are simply tossed out - we will never use those blocks 927 * for swapping. 928 * |
929 * For S_ISREG swapfiles we hold i_sem across the life of the swapon. This | 929 * For S_ISREG swapfiles we set S_SWAPFILE across the life of the swapon. This |
930 * prevents root from shooting her foot off by ftruncating an in-use swapfile, 931 * which will scribble on the fs. 932 * 933 * The amount of disk space which a single swap extent represents varies. 934 * Typically it is in the 1-4 megabyte range. So we can have hundreds of 935 * extents in the list. To avoid much list walking, we cache the previous 936 * search location in `curr_swap_extent', and start new searches from there. 937 * This is extremely effective. The average number of iterations in --- 712 unchanged lines hidden --- | 930 * prevents root from shooting her foot off by ftruncating an in-use swapfile, 931 * which will scribble on the fs. 932 * 933 * The amount of disk space which a single swap extent represents varies. 934 * Typically it is in the 1-4 megabyte range. So we can have hundreds of 935 * extents in the list. To avoid much list walking, we cache the previous 936 * search location in `curr_swap_extent', and start new searches from there. 937 * This is extremely effective. The average number of iterations in --- 712 unchanged lines hidden --- |