diff --git a/fs/pipe.c b/fs/pipe.c index 1f559f0608e1..8773ecaa44b5 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -1007,6 +1007,18 @@ const struct file_operations pipefifo_fops = { .fasync = pipe_fasync, }; +/* + * Currently we rely on the pipe array holding a power-of-2 number + * of pages. + */ +static inline unsigned int round_pipe_size(unsigned int size) +{ + unsigned long nr_pages; + + nr_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; + return roundup_pow_of_two(nr_pages) << PAGE_SHIFT; +} + /* * Allocate a new array of pipe buffers and copy the info over. Returns the * pipe size if successful, or return -ERROR on error. @@ -1058,18 +1070,6 @@ static long pipe_set_size(struct pipe_inode_info *pipe, unsigned long nr_pages) return nr_pages * PAGE_SIZE; } -/* - * Currently we rely on the pipe array holding a power-of-2 number - * of pages. - */ -static inline unsigned int round_pipe_size(unsigned int size) -{ - unsigned long nr_pages; - - nr_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; - return roundup_pow_of_two(nr_pages) << PAGE_SHIFT; -} - /* * This should work even if CONFIG_PROC_FS isn't set, as proc_dointvec_minmax * will return an error.