Skip to content

Commit

Permalink
fs: export empty_aops
Browse files Browse the repository at this point in the history
With the ->sync_page() hook gone, we have a few users that
add their own static address_space_operations without any
functions defined.

fs/inode.c already has an empty_aops that it uses for init
purposes. Lets export that and use it in the places where
an otherwise empty aops was defined.

Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
  • Loading branch information
Jens Axboe committed Apr 5, 2011
1 parent 929e272 commit 7dcda1c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
9 changes: 8 additions & 1 deletion fs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ __cacheline_aligned_in_smp DEFINE_SPINLOCK(inode_wb_list_lock);
*/
static DECLARE_RWSEM(iprune_sem);

/*
* Empty aops. Can be used for the cases where the user does not
* define any of the address_space operations.
*/
const struct address_space_operations empty_aops = {
};
EXPORT_SYMBOL(empty_aops);

/*
* Statistics gathering..
*/
Expand Down Expand Up @@ -176,7 +184,6 @@ int proc_nr_inodes(ctl_table *table, int write,
*/
int inode_init_always(struct super_block *sb, struct inode *inode)
{
static const struct address_space_operations empty_aops;
static const struct inode_operations empty_iops;
static const struct file_operations empty_fops;
struct address_space *const mapping = &inode->i_data;
Expand Down
2 changes: 0 additions & 2 deletions fs/nilfs2/page.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,6 @@ unsigned nilfs_page_count_clean_buffers(struct page *page,
void nilfs_mapping_init(struct address_space *mapping,
struct backing_dev_info *bdi)
{
static const struct address_space_operations empty_aops;

mapping->host = NULL;
mapping->flags = 0;
mapping_set_gfp_mask(mapping, GFP_NOFS);
Expand Down
4 changes: 2 additions & 2 deletions fs/ubifs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
*/

#include "ubifs.h"
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/xattr.h>
#include <linux/posix_acl_xattr.h>
Expand All @@ -80,7 +81,6 @@ enum {
};

static const struct inode_operations none_inode_operations;
static const struct address_space_operations none_address_operations;
static const struct file_operations none_file_operations;

/**
Expand Down Expand Up @@ -130,7 +130,7 @@ static int create_xattr(struct ubifs_info *c, struct inode *host,
}

/* Re-define all operations to be "nothing" */
inode->i_mapping->a_ops = &none_address_operations;
inode->i_mapping->a_ops = &empty_aops;
inode->i_op = &none_inode_operations;
inode->i_fop = &none_file_operations;

Expand Down
2 changes: 2 additions & 0 deletions include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,8 @@ struct address_space_operations {
int (*error_remove_page)(struct address_space *, struct page *);
};

extern const struct address_space_operations empty_aops;

/*
* pagecache_write_begin/pagecache_write_end must be used by general code
* to write into the pagecache.
Expand Down

0 comments on commit 7dcda1c

Please sign in to comment.