aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/ops_address.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/ops_address.c')
-rw-r--r--fs/gfs2/ops_address.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index 89a8b8fad2e7..01aa4a9b48c3 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -15,9 +15,12 @@
15#include <linux/pagemap.h> 15#include <linux/pagemap.h>
16#include <linux/mpage.h> 16#include <linux/mpage.h>
17#include <linux/fs.h> 17#include <linux/fs.h>
18#include <linux/gfs2_ondisk.h>
18#include <asm/semaphore.h> 19#include <asm/semaphore.h>
19 20
20#include "gfs2.h" 21#include "gfs2.h"
22#include "lm_interface.h"
23#include "incore.h"
21#include "bmap.h" 24#include "bmap.h"
22#include "glock.h" 25#include "glock.h"
23#include "inode.h" 26#include "inode.h"
@@ -29,6 +32,7 @@
29#include "trans.h" 32#include "trans.h"
30#include "rgrp.h" 33#include "rgrp.h"
31#include "ops_file.h" 34#include "ops_file.h"
35#include "util.h"
32 36
33/** 37/**
34 * gfs2_get_block - Fills in a buffer head with details about a block 38 * gfs2_get_block - Fills in a buffer head with details about a block
@@ -43,7 +47,7 @@
43int gfs2_get_block(struct inode *inode, sector_t lblock, 47int gfs2_get_block(struct inode *inode, sector_t lblock,
44 struct buffer_head *bh_result, int create) 48 struct buffer_head *bh_result, int create)
45{ 49{
46 struct gfs2_inode *ip = get_v2ip(inode); 50 struct gfs2_inode *ip = inode->u.generic_ip;
47 int new = create; 51 int new = create;
48 uint64_t dblock; 52 uint64_t dblock;
49 int error; 53 int error;
@@ -75,7 +79,7 @@ int gfs2_get_block(struct inode *inode, sector_t lblock,
75static int get_block_noalloc(struct inode *inode, sector_t lblock, 79static int get_block_noalloc(struct inode *inode, sector_t lblock,
76 struct buffer_head *bh_result, int create) 80 struct buffer_head *bh_result, int create)
77{ 81{
78 struct gfs2_inode *ip = get_v2ip(inode); 82 struct gfs2_inode *ip = inode->u.generic_ip;
79 int new = 0; 83 int new = 0;
80 uint64_t dblock; 84 uint64_t dblock;
81 int error; 85 int error;
@@ -96,7 +100,7 @@ static int get_blocks(struct inode *inode, sector_t lblock,
96 unsigned long max_blocks, struct buffer_head *bh_result, 100 unsigned long max_blocks, struct buffer_head *bh_result,
97 int create) 101 int create)
98{ 102{
99 struct gfs2_inode *ip = get_v2ip(inode); 103 struct gfs2_inode *ip = inode->u.generic_ip;
100 int new = create; 104 int new = create;
101 uint64_t dblock; 105 uint64_t dblock;
102 uint32_t extlen; 106 uint32_t extlen;
@@ -124,7 +128,7 @@ static int get_blocks_noalloc(struct inode *inode, sector_t lblock,
124 unsigned long max_blocks, 128 unsigned long max_blocks,
125 struct buffer_head *bh_result, int create) 129 struct buffer_head *bh_result, int create)
126{ 130{
127 struct gfs2_inode *ip = get_v2ip(inode); 131 struct gfs2_inode *ip = inode->u.generic_ip;
128 int new = 0; 132 int new = 0;
129 uint64_t dblock; 133 uint64_t dblock;
130 uint32_t extlen; 134 uint32_t extlen;
@@ -158,7 +162,7 @@ static int get_blocks_noalloc(struct inode *inode, sector_t lblock,
158static int gfs2_writepage(struct page *page, struct writeback_control *wbc) 162static int gfs2_writepage(struct page *page, struct writeback_control *wbc)
159{ 163{
160 struct inode *inode = page->mapping->host; 164 struct inode *inode = page->mapping->host;
161 struct gfs2_inode *ip = get_v2ip(page->mapping->host); 165 struct gfs2_inode *ip = page->mapping->host->u.generic_ip;
162 struct gfs2_sbd *sdp = ip->i_sbd; 166 struct gfs2_sbd *sdp = ip->i_sbd;
163 loff_t i_size = i_size_read(inode); 167 loff_t i_size = i_size_read(inode);
164 pgoff_t end_index = i_size >> PAGE_CACHE_SHIFT; 168 pgoff_t end_index = i_size >> PAGE_CACHE_SHIFT;
@@ -170,7 +174,7 @@ static int gfs2_writepage(struct page *page, struct writeback_control *wbc)
170 unlock_page(page); 174 unlock_page(page);
171 return -EIO; 175 return -EIO;
172 } 176 }
173 if (get_transaction) 177 if (current->journal_info)
174 goto out_ignore; 178 goto out_ignore;
175 179
176 /* Is the page fully outside i_size? (truncate in progress) */ 180 /* Is the page fully outside i_size? (truncate in progress) */
@@ -259,7 +263,7 @@ static int zero_readpage(struct page *page)
259 263
260static int gfs2_readpage(struct file *file, struct page *page) 264static int gfs2_readpage(struct file *file, struct page *page)
261{ 265{
262 struct gfs2_inode *ip = get_v2ip(page->mapping->host); 266 struct gfs2_inode *ip = page->mapping->host->u.generic_ip;
263 struct gfs2_sbd *sdp = ip->i_sbd; 267 struct gfs2_sbd *sdp = ip->i_sbd;
264 struct gfs2_holder gh; 268 struct gfs2_holder gh;
265 int error; 269 int error;
@@ -307,7 +311,7 @@ out_unlock:
307static int gfs2_prepare_write(struct file *file, struct page *page, 311static int gfs2_prepare_write(struct file *file, struct page *page,
308 unsigned from, unsigned to) 312 unsigned from, unsigned to)
309{ 313{
310 struct gfs2_inode *ip = get_v2ip(page->mapping->host); 314 struct gfs2_inode *ip = page->mapping->host->u.generic_ip;
311 struct gfs2_sbd *sdp = ip->i_sbd; 315 struct gfs2_sbd *sdp = ip->i_sbd;
312 unsigned int data_blocks, ind_blocks, rblocks; 316 unsigned int data_blocks, ind_blocks, rblocks;
313 int alloc_required; 317 int alloc_required;
@@ -402,7 +406,7 @@ static int gfs2_commit_write(struct file *file, struct page *page,
402 unsigned from, unsigned to) 406 unsigned from, unsigned to)
403{ 407{
404 struct inode *inode = page->mapping->host; 408 struct inode *inode = page->mapping->host;
405 struct gfs2_inode *ip = get_v2ip(inode); 409 struct gfs2_inode *ip = inode->u.generic_ip;
406 struct gfs2_sbd *sdp = ip->i_sbd; 410 struct gfs2_sbd *sdp = ip->i_sbd;
407 int error = -EOPNOTSUPP; 411 int error = -EOPNOTSUPP;
408 struct buffer_head *dibh; 412 struct buffer_head *dibh;
@@ -482,7 +486,7 @@ fail_nounlock:
482 486
483static sector_t gfs2_bmap(struct address_space *mapping, sector_t lblock) 487static sector_t gfs2_bmap(struct address_space *mapping, sector_t lblock)
484{ 488{
485 struct gfs2_inode *ip = get_v2ip(mapping->host); 489 struct gfs2_inode *ip = mapping->host->u.generic_ip;
486 struct gfs2_holder i_gh; 490 struct gfs2_holder i_gh;
487 sector_t dblock = 0; 491 sector_t dblock = 0;
488 int error; 492 int error;
@@ -504,10 +508,10 @@ static void discard_buffer(struct gfs2_sbd *sdp, struct buffer_head *bh)
504 struct gfs2_bufdata *bd; 508 struct gfs2_bufdata *bd;
505 509
506 gfs2_log_lock(sdp); 510 gfs2_log_lock(sdp);
507 bd = get_v2bd(bh); 511 bd = bh->b_private;
508 if (bd) { 512 if (bd) {
509 bd->bd_bh = NULL; 513 bd->bd_bh = NULL;
510 set_v2bd(bh, NULL); 514 bh->b_private = NULL;
511 gfs2_log_unlock(sdp); 515 gfs2_log_unlock(sdp);
512 brelse(bh); 516 brelse(bh);
513 } else 517 } else
@@ -525,7 +529,7 @@ static void discard_buffer(struct gfs2_sbd *sdp, struct buffer_head *bh)
525 529
526static int gfs2_invalidatepage(struct page *page, unsigned long offset) 530static int gfs2_invalidatepage(struct page *page, unsigned long offset)
527{ 531{
528 struct gfs2_sbd *sdp = get_v2sdp(page->mapping->host->i_sb); 532 struct gfs2_sbd *sdp = page->mapping->host->i_sb->s_fs_info;
529 struct buffer_head *head, *bh, *next; 533 struct buffer_head *head, *bh, *next;
530 unsigned int curr_off = 0; 534 unsigned int curr_off = 0;
531 int ret = 1; 535 int ret = 1;
@@ -557,7 +561,7 @@ static ssize_t gfs2_direct_IO_write(struct kiocb *iocb, const struct iovec *iov,
557{ 561{
558 struct file *file = iocb->ki_filp; 562 struct file *file = iocb->ki_filp;
559 struct inode *inode = file->f_mapping->host; 563 struct inode *inode = file->f_mapping->host;
560 struct gfs2_inode *ip = get_v2ip(inode); 564 struct gfs2_inode *ip = inode->u.generic_ip;
561 struct gfs2_holder gh; 565 struct gfs2_holder gh;
562 int rv; 566 int rv;
563 567
@@ -604,7 +608,7 @@ static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb,
604{ 608{
605 struct file *file = iocb->ki_filp; 609 struct file *file = iocb->ki_filp;
606 struct inode *inode = file->f_mapping->host; 610 struct inode *inode = file->f_mapping->host;
607 struct gfs2_inode *ip = get_v2ip(inode); 611 struct gfs2_inode *ip = inode->u.generic_ip;
608 struct gfs2_sbd *sdp = ip->i_sbd; 612 struct gfs2_sbd *sdp = ip->i_sbd;
609 613
610 if (rw == WRITE) 614 if (rw == WRITE)