GFS2: Fix address space from page function
authorSteven Whitehouse <swhiteho@redhat.com>
Mon, 31 Mar 2014 16:48:27 +0000 (17:48 +0100)
committerSteven Whitehouse <swhiteho@redhat.com>
Mon, 31 Mar 2014 16:48:27 +0000 (17:48 +0100)
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>
fs/gfs2/meta_io.c
fs/gfs2/meta_io.h
fs/gfs2/ops_fstype.c

index 005e4686af0d67687dcc6a6f632c04ad10f6bf1a..2cf09b63a6b4433a2f35095b53a8141325f1bb5f 100644 (file)
@@ -97,6 +97,11 @@ const struct address_space_operations gfs2_meta_aops = {
        .releasepage = gfs2_releasepage,
 };
 
+const struct address_space_operations gfs2_rgrp_aops = {
+       .writepage = gfs2_aspace_writepage,
+       .releasepage = gfs2_releasepage,
+};
+
 /**
  * gfs2_getbuf - Get a buffer with a given address space
  * @gl: the glock
index 4823b934208a2be6012a71ded8f4e950fca753fb..ac5d8027d33569437f42b76808f8103903c5c3de 100644 (file)
@@ -38,12 +38,15 @@ static inline void gfs2_buffer_copy_tail(struct buffer_head *to_bh,
 }
 
 extern const struct address_space_operations gfs2_meta_aops;
+extern const struct address_space_operations gfs2_rgrp_aops;
 
 static inline struct gfs2_sbd *gfs2_mapping2sbd(struct address_space *mapping)
 {
        struct inode *inode = mapping->host;
        if (mapping->a_ops == &gfs2_meta_aops)
                return (((struct gfs2_glock *)mapping) - 1)->gl_sbd;
+       else if (mapping->a_ops == &gfs2_rgrp_aops)
+               return container_of(mapping, struct gfs2_sbd, sd_aspace);
        else
                return inode->i_sb->s_fs_info;
 }
index fba74a26a6a3c97fc1a05780573aabe790f8706c..22f954051bb89bd47990c47f6dc986b4dd011561 100644 (file)
@@ -106,7 +106,7 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb)
        mapping = &sdp->sd_aspace;
 
        address_space_init_once(mapping);
-       mapping->a_ops = &gfs2_meta_aops;
+       mapping->a_ops = &gfs2_rgrp_aops;
        mapping->host = sb->s_bdev->bd_inode;
        mapping->flags = 0;
        mapping_set_gfp_mask(mapping, GFP_NOFS);