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>
This commit is contained in:
parent
e5e6e97fe0
commit
b57c2cb9ea
8 changed files with 6 additions and 38 deletions
|
@ -44,12 +44,6 @@ static inline void exofs_put_page(struct page *page)
|
||||||
page_cache_release(page);
|
page_cache_release(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Accesses dir's inode->i_size must be called under inode lock */
|
|
||||||
static inline unsigned long dir_pages(struct inode *inode)
|
|
||||||
{
|
|
||||||
return (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned exofs_last_byte(struct inode *inode, unsigned long page_nr)
|
static unsigned exofs_last_byte(struct inode *inode, unsigned long page_nr)
|
||||||
{
|
{
|
||||||
loff_t last_byte = inode->i_size;
|
loff_t last_byte = inode->i_size;
|
||||||
|
|
|
@ -70,11 +70,6 @@ static inline void ext2_put_page(struct page *page)
|
||||||
page_cache_release(page);
|
page_cache_release(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned long dir_pages(struct inode *inode)
|
|
||||||
{
|
|
||||||
return (inode->i_size+PAGE_CACHE_SIZE-1)>>PAGE_CACHE_SHIFT;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the offset into page `page_nr' of the last valid
|
* Return the offset into page `page_nr' of the last valid
|
||||||
* byte in that page, plus one.
|
* byte in that page, plus one.
|
||||||
|
|
|
@ -61,13 +61,6 @@ const struct file_operations vxfs_dir_operations = {
|
||||||
.iterate = vxfs_readdir,
|
.iterate = vxfs_readdir,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static inline u_long
|
|
||||||
dir_pages(struct inode *inode)
|
|
||||||
{
|
|
||||||
return (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline u_long
|
static inline u_long
|
||||||
dir_blocks(struct inode *ip)
|
dir_blocks(struct inode *ip)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,11 +45,6 @@ minix_last_byte(struct inode *inode, unsigned long page_nr)
|
||||||
return last_byte;
|
return last_byte;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned long dir_pages(struct inode *inode)
|
|
||||||
{
|
|
||||||
return (inode->i_size+PAGE_CACHE_SIZE-1)>>PAGE_CACHE_SHIFT;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int dir_commit_chunk(struct page *page, loff_t pos, unsigned len)
|
static int dir_commit_chunk(struct page *page, loff_t pos, unsigned len)
|
||||||
{
|
{
|
||||||
struct address_space *mapping = page->mapping;
|
struct address_space *mapping = page->mapping;
|
||||||
|
|
|
@ -61,11 +61,6 @@ static inline void nilfs_put_page(struct page *page)
|
||||||
page_cache_release(page);
|
page_cache_release(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned long dir_pages(struct inode *inode)
|
|
||||||
{
|
|
||||||
return (inode->i_size+PAGE_CACHE_SIZE-1)>>PAGE_CACHE_SHIFT;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the offset into page `page_nr' of the last valid
|
* Return the offset into page `page_nr' of the last valid
|
||||||
* byte in that page, plus one.
|
* byte in that page, plus one.
|
||||||
|
|
|
@ -32,11 +32,6 @@ static struct page *qnx6_get_page(struct inode *dir, unsigned long n)
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned long dir_pages(struct inode *inode)
|
|
||||||
{
|
|
||||||
return (inode->i_size+PAGE_CACHE_SIZE-1)>>PAGE_CACHE_SHIFT;
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned last_entry(struct inode *inode, unsigned long page_nr)
|
static unsigned last_entry(struct inode *inode, unsigned long page_nr)
|
||||||
{
|
{
|
||||||
unsigned long last_byte = inode->i_size;
|
unsigned long last_byte = inode->i_size;
|
||||||
|
|
|
@ -33,11 +33,6 @@ static inline void dir_put_page(struct page *page)
|
||||||
page_cache_release(page);
|
page_cache_release(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned long dir_pages(struct inode *inode)
|
|
||||||
{
|
|
||||||
return (inode->i_size+PAGE_CACHE_SIZE-1)>>PAGE_CACHE_SHIFT;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int dir_commit_chunk(struct page *page, loff_t pos, unsigned len)
|
static int dir_commit_chunk(struct page *page, loff_t pos, unsigned len)
|
||||||
{
|
{
|
||||||
struct address_space *mapping = page->mapping;
|
struct address_space *mapping = page->mapping;
|
||||||
|
|
|
@ -670,4 +670,10 @@ static inline int add_to_page_cache(struct page *page,
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline unsigned long dir_pages(struct inode *inode)
|
||||||
|
{
|
||||||
|
return (unsigned long)(inode->i_size + PAGE_CACHE_SIZE - 1) >>
|
||||||
|
PAGE_CACHE_SHIFT;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* _LINUX_PAGEMAP_H */
|
#endif /* _LINUX_PAGEMAP_H */
|
||||||
|
|
Loading…
Add table
Reference in a new issue