Skip to content

Commit

Permalink
GFS2: Fix address space from page function
Browse files Browse the repository at this point in the history
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 <[email protected]>
Tested-by: Abhi Das <[email protected]>
Signed-off-by: Steven Whitehouse <[email protected]>
  • Loading branch information
swhiteho committed Mar 31, 2014
1 parent 0597880 commit 1b2ad41
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions fs/gfs2/meta_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions fs/gfs2/meta_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion fs/gfs2/ops_fstype.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1b2ad41

Please sign in to comment.