diff options
author | Fabian Frederick <fabf@skynet.be> | 2015-05-24 11:19:41 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-06-23 18:02:00 -0400 |
commit | b57c2cb9ea1a02c2ae08e16de8c20cc13ffbf85a (patch) | |
tree | 22dd8d727b5797964bd0fdd7bc06218802a517d3 | |
parent | e5e6e97fe0f63b374e44a22f5a5c2d151c7fa8c5 (diff) |
pagemap.h: move dir_pages() over there
That function was declared in a lot of filesystems to calculate
directory pages.
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/exofs/dir.c | 6 | ||||
-rw-r--r-- | fs/ext2/dir.c | 5 | ||||
-rw-r--r-- | fs/freevxfs/vxfs_lookup.c | 7 | ||||
-rw-r--r-- | fs/minix/dir.c | 5 | ||||
-rw-r--r-- | fs/nilfs2/dir.c | 5 | ||||
-rw-r--r-- | fs/qnx6/dir.c | 5 | ||||
-rw-r--r-- | fs/sysv/dir.c | 5 | ||||
-rw-r--r-- | include/linux/pagemap.h | 6 |
8 files changed, 6 insertions, 38 deletions
diff --git a/fs/exofs/dir.c b/fs/exofs/dir.c index 4deb0b05b011..e5bb2abf77f9 100644 --- a/fs/exofs/dir.c +++ b/fs/exofs/dir.c | |||
@@ -44,12 +44,6 @@ static inline void exofs_put_page(struct page *page) | |||
44 | page_cache_release(page); | 44 | page_cache_release(page); |
45 | } | 45 | } |
46 | 46 | ||
47 | /* Accesses dir's inode->i_size must be called under inode lock */ | ||
48 | static inline unsigned long dir_pages(struct inode *inode) | ||
49 | { | ||
50 | return (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; | ||
51 | } | ||
52 | |||
53 | static unsigned exofs_last_byte(struct inode *inode, unsigned long page_nr) | 47 | static unsigned exofs_last_byte(struct inode *inode, unsigned long page_nr) |
54 | { | 48 | { |
55 | loff_t last_byte = inode->i_size; | 49 | loff_t last_byte = inode->i_size; |
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c index 796b491e6978..0c6638b40f21 100644 --- a/fs/ext2/dir.c +++ b/fs/ext2/dir.c | |||
@@ -70,11 +70,6 @@ static inline void ext2_put_page(struct page *page) | |||
70 | page_cache_release(page); | 70 | page_cache_release(page); |
71 | } | 71 | } |
72 | 72 | ||
73 | static inline unsigned long dir_pages(struct inode *inode) | ||
74 | { | ||
75 | return (inode->i_size+PAGE_CACHE_SIZE-1)>>PAGE_CACHE_SHIFT; | ||
76 | } | ||
77 | |||
78 | /* | 73 | /* |
79 | * Return the offset into page `page_nr' of the last valid | 74 | * Return the offset into page `page_nr' of the last valid |
80 | * byte in that page, plus one. | 75 | * byte in that page, plus one. |
diff --git a/fs/freevxfs/vxfs_lookup.c b/fs/freevxfs/vxfs_lookup.c index 99c7f0a37af4..484b32d3234a 100644 --- a/fs/freevxfs/vxfs_lookup.c +++ b/fs/freevxfs/vxfs_lookup.c | |||
@@ -61,13 +61,6 @@ const struct file_operations vxfs_dir_operations = { | |||
61 | .iterate = vxfs_readdir, | 61 | .iterate = vxfs_readdir, |
62 | }; | 62 | }; |
63 | 63 | ||
64 | |||
65 | static inline u_long | ||
66 | dir_pages(struct inode *inode) | ||
67 | { | ||
68 | return (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; | ||
69 | } | ||
70 | |||
71 | static inline u_long | 64 | static inline u_long |
72 | dir_blocks(struct inode *ip) | 65 | dir_blocks(struct inode *ip) |
73 | { | 66 | { |
diff --git a/fs/minix/dir.c b/fs/minix/dir.c index 118e4e7bc935..d19ac258105a 100644 --- a/fs/minix/dir.c +++ b/fs/minix/dir.c | |||
@@ -45,11 +45,6 @@ minix_last_byte(struct inode *inode, unsigned long page_nr) | |||
45 | return last_byte; | 45 | return last_byte; |
46 | } | 46 | } |
47 | 47 | ||
48 | static inline unsigned long dir_pages(struct inode *inode) | ||
49 | { | ||
50 | return (inode->i_size+PAGE_CACHE_SIZE-1)>>PAGE_CACHE_SHIFT; | ||
51 | } | ||
52 | |||
53 | static int dir_commit_chunk(struct page *page, loff_t pos, unsigned len) | 48 | static int dir_commit_chunk(struct page *page, loff_t pos, unsigned len) |
54 | { | 49 | { |
55 | struct address_space *mapping = page->mapping; | 50 | struct address_space *mapping = page->mapping; |
diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c index 0ee0bed3649b..6b8b92b19cec 100644 --- a/fs/nilfs2/dir.c +++ b/fs/nilfs2/dir.c | |||
@@ -61,11 +61,6 @@ static inline void nilfs_put_page(struct page *page) | |||
61 | page_cache_release(page); | 61 | page_cache_release(page); |
62 | } | 62 | } |
63 | 63 | ||
64 | static inline unsigned long dir_pages(struct inode *inode) | ||
65 | { | ||
66 | return (inode->i_size+PAGE_CACHE_SIZE-1)>>PAGE_CACHE_SHIFT; | ||
67 | } | ||
68 | |||
69 | /* | 64 | /* |
70 | * Return the offset into page `page_nr' of the last valid | 65 | * Return the offset into page `page_nr' of the last valid |
71 | * byte in that page, plus one. | 66 | * byte in that page, plus one. |
diff --git a/fs/qnx6/dir.c b/fs/qnx6/dir.c index 8d64bb5366bf..e1f37278cf97 100644 --- a/fs/qnx6/dir.c +++ b/fs/qnx6/dir.c | |||
@@ -32,11 +32,6 @@ static struct page *qnx6_get_page(struct inode *dir, unsigned long n) | |||
32 | return page; | 32 | return page; |
33 | } | 33 | } |
34 | 34 | ||
35 | static inline unsigned long dir_pages(struct inode *inode) | ||
36 | { | ||
37 | return (inode->i_size+PAGE_CACHE_SIZE-1)>>PAGE_CACHE_SHIFT; | ||
38 | } | ||
39 | |||
40 | static unsigned last_entry(struct inode *inode, unsigned long page_nr) | 35 | static unsigned last_entry(struct inode *inode, unsigned long page_nr) |
41 | { | 36 | { |
42 | unsigned long last_byte = inode->i_size; | 37 | unsigned long last_byte = inode->i_size; |
diff --git a/fs/sysv/dir.c b/fs/sysv/dir.c index 8f3555f00c54..63c1bcb224ee 100644 --- a/fs/sysv/dir.c +++ b/fs/sysv/dir.c | |||
@@ -33,11 +33,6 @@ static inline void dir_put_page(struct page *page) | |||
33 | page_cache_release(page); | 33 | page_cache_release(page); |
34 | } | 34 | } |
35 | 35 | ||
36 | static inline unsigned long dir_pages(struct inode *inode) | ||
37 | { | ||
38 | return (inode->i_size+PAGE_CACHE_SIZE-1)>>PAGE_CACHE_SHIFT; | ||
39 | } | ||
40 | |||
41 | static int dir_commit_chunk(struct page *page, loff_t pos, unsigned len) | 36 | static int dir_commit_chunk(struct page *page, loff_t pos, unsigned len) |
42 | { | 37 | { |
43 | struct address_space *mapping = page->mapping; | 38 | struct address_space *mapping = page->mapping; |
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 4b3736f7065c..808942d31062 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h | |||
@@ -670,4 +670,10 @@ static inline int add_to_page_cache(struct page *page, | |||
670 | return error; | 670 | return error; |
671 | } | 671 | } |
672 | 672 | ||
673 | static inline unsigned long dir_pages(struct inode *inode) | ||
674 | { | ||
675 | return (unsigned long)(inode->i_size + PAGE_CACHE_SIZE - 1) >> | ||
676 | PAGE_CACHE_SHIFT; | ||
677 | } | ||
678 | |||
673 | #endif /* _LINUX_PAGEMAP_H */ | 679 | #endif /* _LINUX_PAGEMAP_H */ |