aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2014-03-31 12:48:27 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2014-03-31 12:48:27 -0400
commit1b2ad41214c9bf6e8befa000f0522629194bf540 (patch)
treeca9bfdbbabf9aa50e81565c643a8849789a69949
parent059788039f1e6343f34f46d202f8d9f2158c2783 (diff)
GFS2: Fix address space from page function
Now that rgrps use the address space which is part of the super block, we need to update gfs2_mapping2sbd() to take account of that. The only way to do that easily is to use a different set of address_space_operations for rgrps. Reported-by: Abhi Das <adas@redhat.com> Tested-by: Abhi Das <adas@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
-rw-r--r--fs/gfs2/meta_io.c5
-rw-r--r--fs/gfs2/meta_io.h3
-rw-r--r--fs/gfs2/ops_fstype.c2
3 files changed, 9 insertions, 1 deletions
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index 005e4686af0d..2cf09b63a6b4 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -97,6 +97,11 @@ const struct address_space_operations gfs2_meta_aops = {
97 .releasepage = gfs2_releasepage, 97 .releasepage = gfs2_releasepage,
98}; 98};
99 99
100const struct address_space_operations gfs2_rgrp_aops = {
101 .writepage = gfs2_aspace_writepage,
102 .releasepage = gfs2_releasepage,
103};
104
100/** 105/**
101 * gfs2_getbuf - Get a buffer with a given address space 106 * gfs2_getbuf - Get a buffer with a given address space
102 * @gl: the glock 107 * @gl: the glock
diff --git a/fs/gfs2/meta_io.h b/fs/gfs2/meta_io.h
index 4823b934208a..ac5d8027d335 100644
--- a/fs/gfs2/meta_io.h
+++ b/fs/gfs2/meta_io.h
@@ -38,12 +38,15 @@ static inline void gfs2_buffer_copy_tail(struct buffer_head *to_bh,
38} 38}
39 39
40extern const struct address_space_operations gfs2_meta_aops; 40extern const struct address_space_operations gfs2_meta_aops;
41extern const struct address_space_operations gfs2_rgrp_aops;
41 42
42static inline struct gfs2_sbd *gfs2_mapping2sbd(struct address_space *mapping) 43static inline struct gfs2_sbd *gfs2_mapping2sbd(struct address_space *mapping)
43{ 44{
44 struct inode *inode = mapping->host; 45 struct inode *inode = mapping->host;
45 if (mapping->a_ops == &gfs2_meta_aops) 46 if (mapping->a_ops == &gfs2_meta_aops)
46 return (((struct gfs2_glock *)mapping) - 1)->gl_sbd; 47 return (((struct gfs2_glock *)mapping) - 1)->gl_sbd;
48 else if (mapping->a_ops == &gfs2_rgrp_aops)
49 return container_of(mapping, struct gfs2_sbd, sd_aspace);
47 else 50 else
48 return inode->i_sb->s_fs_info; 51 return inode->i_sb->s_fs_info;
49} 52}
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index fba74a26a6a3..22f954051bb8 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -106,7 +106,7 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb)
106 mapping = &sdp->sd_aspace; 106 mapping = &sdp->sd_aspace;
107 107
108 address_space_init_once(mapping); 108 address_space_init_once(mapping);
109 mapping->a_ops = &gfs2_meta_aops; 109 mapping->a_ops = &gfs2_rgrp_aops;
110 mapping->host = sb->s_bdev->bd_inode; 110 mapping->host = sb->s_bdev->bd_inode;
111 mapping->flags = 0; 111 mapping->flags = 0;
112 mapping_set_gfp_mask(mapping, GFP_NOFS); 112 mapping_set_gfp_mask(mapping, GFP_NOFS);