diff options
Diffstat (limited to 'fs/pipe.c')
-rw-r--r-- | fs/pipe.c | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -1008,6 +1008,18 @@ const struct file_operations pipefifo_fops = { | |||
1008 | }; | 1008 | }; |
1009 | 1009 | ||
1010 | /* | 1010 | /* |
1011 | * Currently we rely on the pipe array holding a power-of-2 number | ||
1012 | * of pages. | ||
1013 | */ | ||
1014 | static inline unsigned int round_pipe_size(unsigned int size) | ||
1015 | { | ||
1016 | unsigned long nr_pages; | ||
1017 | |||
1018 | nr_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; | ||
1019 | return roundup_pow_of_two(nr_pages) << PAGE_SHIFT; | ||
1020 | } | ||
1021 | |||
1022 | /* | ||
1011 | * Allocate a new array of pipe buffers and copy the info over. Returns the | 1023 | * Allocate a new array of pipe buffers and copy the info over. Returns the |
1012 | * pipe size if successful, or return -ERROR on error. | 1024 | * pipe size if successful, or return -ERROR on error. |
1013 | */ | 1025 | */ |
@@ -1059,18 +1071,6 @@ static long pipe_set_size(struct pipe_inode_info *pipe, unsigned long nr_pages) | |||
1059 | } | 1071 | } |
1060 | 1072 | ||
1061 | /* | 1073 | /* |
1062 | * Currently we rely on the pipe array holding a power-of-2 number | ||
1063 | * of pages. | ||
1064 | */ | ||
1065 | static inline unsigned int round_pipe_size(unsigned int size) | ||
1066 | { | ||
1067 | unsigned long nr_pages; | ||
1068 | |||
1069 | nr_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; | ||
1070 | return roundup_pow_of_two(nr_pages) << PAGE_SHIFT; | ||
1071 | } | ||
1072 | |||
1073 | /* | ||
1074 | * This should work even if CONFIG_PROC_FS isn't set, as proc_dointvec_minmax | 1074 | * This should work even if CONFIG_PROC_FS isn't set, as proc_dointvec_minmax |
1075 | * will return an error. | 1075 | * will return an error. |
1076 | */ | 1076 | */ |