meta_io.c (35858adbfca13678af99fb31618ef4428d6dedb0) | meta_io.c (009d851837ab26cab18adda6169a813f70b0b21b) |
---|---|
1/* 2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. 3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. 4 * 5 * This copyrighted material is made available to anyone wishing to use, 6 * modify, copy, or redistribute it subject to the terms and conditions 7 * of the GNU General Public License version 2. 8 */ --- 79 unchanged lines hidden (view full) --- 88 89 err = 0; 90 if (nr_underway == 0) 91 end_page_writeback(page); 92 93 return err; 94} 95 | 1/* 2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. 3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. 4 * 5 * This copyrighted material is made available to anyone wishing to use, 6 * modify, copy, or redistribute it subject to the terms and conditions 7 * of the GNU General Public License version 2. 8 */ --- 79 unchanged lines hidden (view full) --- 88 89 err = 0; 90 if (nr_underway == 0) 91 end_page_writeback(page); 92 93 return err; 94} 95 |
96static const struct address_space_operations aspace_aops = { | 96const struct address_space_operations gfs2_meta_aops = { |
97 .writepage = gfs2_aspace_writepage, 98 .releasepage = gfs2_releasepage, 99 .sync_page = block_sync_page, 100}; 101 102/** | 97 .writepage = gfs2_aspace_writepage, 98 .releasepage = gfs2_releasepage, 99 .sync_page = block_sync_page, 100}; 101 102/** |
103 * gfs2_aspace_get - Create and initialize a struct inode structure 104 * @sdp: the filesystem the aspace is in 105 * 106 * Right now a struct inode is just a struct inode. Maybe Linux 107 * will supply a more lightweight address space construct (that works) 108 * in the future. 109 * 110 * Make sure pages/buffers in this aspace aren't in high memory. 111 * 112 * Returns: the aspace 113 */ 114 115struct inode *gfs2_aspace_get(struct gfs2_sbd *sdp) 116{ 117 struct inode *aspace; 118 struct gfs2_inode *ip; 119 120 aspace = new_inode(sdp->sd_vfs); 121 if (aspace) { 122 mapping_set_gfp_mask(aspace->i_mapping, GFP_NOFS); 123 aspace->i_mapping->a_ops = &aspace_aops; 124 aspace->i_size = MAX_LFS_FILESIZE; 125 ip = GFS2_I(aspace); 126 clear_bit(GIF_USER, &ip->i_flags); 127 insert_inode_hash(aspace); 128 } 129 return aspace; 130} 131 132void gfs2_aspace_put(struct inode *aspace) 133{ 134 remove_inode_hash(aspace); 135 iput(aspace); 136} 137 138/** | |
139 * gfs2_meta_sync - Sync all buffers associated with a glock 140 * @gl: The glock 141 * 142 */ 143 144void gfs2_meta_sync(struct gfs2_glock *gl) 145{ | 103 * gfs2_meta_sync - Sync all buffers associated with a glock 104 * @gl: The glock 105 * 106 */ 107 108void gfs2_meta_sync(struct gfs2_glock *gl) 109{ |
146 struct address_space *mapping = gl->gl_aspace->i_mapping; | 110 struct address_space *mapping = gfs2_glock2aspace(gl); |
147 int error; 148 149 filemap_fdatawrite(mapping); 150 error = filemap_fdatawait(mapping); 151 152 if (error) 153 gfs2_io_error(gl->gl_sbd); 154} --- 4 unchanged lines hidden (view full) --- 159 * @blkno: the block number (filesystem scope) 160 * @create: 1 if the buffer should be created 161 * 162 * Returns: the buffer 163 */ 164 165struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl, u64 blkno, int create) 166{ | 111 int error; 112 113 filemap_fdatawrite(mapping); 114 error = filemap_fdatawait(mapping); 115 116 if (error) 117 gfs2_io_error(gl->gl_sbd); 118} --- 4 unchanged lines hidden (view full) --- 123 * @blkno: the block number (filesystem scope) 124 * @create: 1 if the buffer should be created 125 * 126 * Returns: the buffer 127 */ 128 129struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl, u64 blkno, int create) 130{ |
167 struct address_space *mapping = gl->gl_aspace->i_mapping; | 131 struct address_space *mapping = gfs2_glock2aspace(gl); |
168 struct gfs2_sbd *sdp = gl->gl_sbd; 169 struct page *page; 170 struct buffer_head *bh; 171 unsigned int shift; 172 unsigned long index; 173 unsigned int bufnum; 174 175 shift = PAGE_CACHE_SHIFT - sdp->sd_sb.sb_bsize_shift; --- 163 unchanged lines hidden (view full) --- 339 bh->b_private = bd; 340 341 if (meta) 342 unlock_page(bh->b_page); 343} 344 345void gfs2_remove_from_journal(struct buffer_head *bh, struct gfs2_trans *tr, int meta) 346{ | 132 struct gfs2_sbd *sdp = gl->gl_sbd; 133 struct page *page; 134 struct buffer_head *bh; 135 unsigned int shift; 136 unsigned long index; 137 unsigned int bufnum; 138 139 shift = PAGE_CACHE_SHIFT - sdp->sd_sb.sb_bsize_shift; --- 163 unchanged lines hidden (view full) --- 303 bh->b_private = bd; 304 305 if (meta) 306 unlock_page(bh->b_page); 307} 308 309void gfs2_remove_from_journal(struct buffer_head *bh, struct gfs2_trans *tr, int meta) 310{ |
347 struct gfs2_sbd *sdp = GFS2_SB(bh->b_page->mapping->host); | 311 struct address_space *mapping = bh->b_page->mapping; 312 struct gfs2_sbd *sdp = gfs2_mapping2sbd(mapping); |
348 struct gfs2_bufdata *bd = bh->b_private; | 313 struct gfs2_bufdata *bd = bh->b_private; |
314 |
|
349 if (test_clear_buffer_pinned(bh)) { 350 list_del_init(&bd->bd_le.le_list); 351 if (meta) { 352 gfs2_assert_warn(sdp, sdp->sd_log_num_buf); 353 sdp->sd_log_num_buf--; 354 tr->tr_num_buf_rm++; 355 } else { 356 gfs2_assert_warn(sdp, sdp->sd_log_num_databuf); --- 135 unchanged lines hidden --- | 315 if (test_clear_buffer_pinned(bh)) { 316 list_del_init(&bd->bd_le.le_list); 317 if (meta) { 318 gfs2_assert_warn(sdp, sdp->sd_log_num_buf); 319 sdp->sd_log_num_buf--; 320 tr->tr_num_buf_rm++; 321 } else { 322 gfs2_assert_warn(sdp, sdp->sd_log_num_databuf); --- 135 unchanged lines hidden --- |