blob: 1696e5d9d112c937e1de075bd19c1b54072f5444 [file] [log] [blame]
David Teiglandb3b94fa2006-01-16 16:50:04 +00001/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
Robert Peterson7ae8fa82007-05-09 09:37:57 -05003 * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
David Teiglandb3b94fa2006-01-16 16:50:04 +00004 *
5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions
Steven Whitehousee9fc2aa2006-09-01 11:05:15 -04007 * of the GNU General Public License version 2.
David Teiglandb3b94fa2006-01-16 16:50:04 +00008 */
9
10#include <linux/sched.h>
11#include <linux/slab.h>
12#include <linux/spinlock.h>
13#include <linux/completion.h>
14#include <linux/buffer_head.h>
15#include <linux/pagemap.h>
Steven Whitehousefd88de562006-05-05 16:59:11 -040016#include <linux/pagevec.h>
Steven Whitehouse9b124fb2006-01-30 11:55:32 +000017#include <linux/mpage.h>
Steven Whitehoused1665e42006-02-14 11:54:42 +000018#include <linux/fs.h>
Steven Whitehousea8d638e2007-01-15 13:52:17 +000019#include <linux/writeback.h>
Steven Whitehouse7765ec22007-10-16 01:25:07 -070020#include <linux/swap.h>
Steven Whitehouse5c676f62006-02-27 17:23:27 -050021#include <linux/gfs2_ondisk.h>
Fabio Massimo Di Nitto7d308592006-09-19 07:56:29 +020022#include <linux/lm_interface.h>
Steven Whitehouse51ff87b2007-10-15 14:42:35 +010023#include <linux/swap.h>
David Teiglandb3b94fa2006-01-16 16:50:04 +000024
25#include "gfs2.h"
Steven Whitehouse5c676f62006-02-27 17:23:27 -050026#include "incore.h"
David Teiglandb3b94fa2006-01-16 16:50:04 +000027#include "bmap.h"
28#include "glock.h"
29#include "inode.h"
David Teiglandb3b94fa2006-01-16 16:50:04 +000030#include "log.h"
31#include "meta_io.h"
32#include "ops_address.h"
David Teiglandb3b94fa2006-01-16 16:50:04 +000033#include "quota.h"
34#include "trans.h"
Steven Whitehouse18ec7d52006-02-08 11:50:51 +000035#include "rgrp.h"
Robert Petersoncd81a4b2007-05-14 12:42:18 -050036#include "super.h"
Steven Whitehouse5c676f62006-02-27 17:23:27 -050037#include "util.h"
Steven Whitehouse4340fe62006-07-11 09:46:33 -040038#include "glops.h"
David Teiglandb3b94fa2006-01-16 16:50:04 +000039
Steven Whitehouseba7f7292006-07-26 11:27:10 -040040
41static void gfs2_page_add_databufs(struct gfs2_inode *ip, struct page *page,
42 unsigned int from, unsigned int to)
43{
44 struct buffer_head *head = page_buffers(page);
45 unsigned int bsize = head->b_size;
46 struct buffer_head *bh;
47 unsigned int start, end;
48
49 for (bh = head, start = 0; bh != head || !start;
50 bh = bh->b_this_page, start = end) {
51 end = start + bsize;
52 if (end <= from || start >= to)
53 continue;
Benjamin Marzinskiddf4b422007-06-01 14:21:38 -050054 if (gfs2_is_jdata(ip))
55 set_buffer_uptodate(bh);
Steven Whitehouseba7f7292006-07-26 11:27:10 -040056 gfs2_trans_add_bh(ip->i_gl, bh, 0);
57 }
58}
59
David Teiglandb3b94fa2006-01-16 16:50:04 +000060/**
Steven Whitehouse4ff14672006-01-30 09:39:10 +000061 * gfs2_get_block - Fills in a buffer head with details about a block
David Teiglandb3b94fa2006-01-16 16:50:04 +000062 * @inode: The inode
63 * @lblock: The block number to look up
64 * @bh_result: The buffer head to return the result in
65 * @create: Non-zero if we may add block to the file
66 *
67 * Returns: errno
68 */
69
Steven Whitehouse4ff14672006-01-30 09:39:10 +000070int gfs2_get_block(struct inode *inode, sector_t lblock,
71 struct buffer_head *bh_result, int create)
David Teiglandb3b94fa2006-01-16 16:50:04 +000072{
Steven Whitehouse23591252006-10-13 17:25:45 -040073 return gfs2_block_map(inode, lblock, create, bh_result);
David Teiglandb3b94fa2006-01-16 16:50:04 +000074}
75
76/**
Steven Whitehouse7a6bbac2006-09-18 17:18:23 -040077 * gfs2_get_block_noalloc - Fills in a buffer head with details about a block
David Teiglandb3b94fa2006-01-16 16:50:04 +000078 * @inode: The inode
79 * @lblock: The block number to look up
80 * @bh_result: The buffer head to return the result in
81 * @create: Non-zero if we may add block to the file
82 *
83 * Returns: errno
84 */
85
Steven Whitehouse7a6bbac2006-09-18 17:18:23 -040086static int gfs2_get_block_noalloc(struct inode *inode, sector_t lblock,
87 struct buffer_head *bh_result, int create)
David Teiglandb3b94fa2006-01-16 16:50:04 +000088{
David Teiglandb3b94fa2006-01-16 16:50:04 +000089 int error;
90
Steven Whitehouse23591252006-10-13 17:25:45 -040091 error = gfs2_block_map(inode, lblock, 0, bh_result);
David Teiglandb3b94fa2006-01-16 16:50:04 +000092 if (error)
93 return error;
Wendy Chengde986e82007-09-18 09:19:13 -040094 if (!buffer_mapped(bh_result))
Steven Whitehouse7a6bbac2006-09-18 17:18:23 -040095 return -EIO;
Steven Whitehouse623d9352006-08-31 12:14:44 -040096 return 0;
97}
Steven Whitehouse7a6bbac2006-09-18 17:18:23 -040098
99static int gfs2_get_block_direct(struct inode *inode, sector_t lblock,
100 struct buffer_head *bh_result, int create)
101{
Steven Whitehouse23591252006-10-13 17:25:45 -0400102 return gfs2_block_map(inode, lblock, 0, bh_result);
Steven Whitehouse7a6bbac2006-09-18 17:18:23 -0400103}
104
David Teiglandb3b94fa2006-01-16 16:50:04 +0000105/**
106 * gfs2_writepage - Write complete page
107 * @page: Page to write
108 *
109 * Returns: errno
110 *
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000111 * Some of this is copied from block_write_full_page() although we still
112 * call it to do most of the work.
David Teiglandb3b94fa2006-01-16 16:50:04 +0000113 */
114
115static int gfs2_writepage(struct page *page, struct writeback_control *wbc)
116{
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000117 struct inode *inode = page->mapping->host;
Steven Whitehousef4387142006-08-08 13:23:19 -0400118 struct gfs2_inode *ip = GFS2_I(inode);
119 struct gfs2_sbd *sdp = GFS2_SB(inode);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000120 loff_t i_size = i_size_read(inode);
121 pgoff_t end_index = i_size >> PAGE_CACHE_SHIFT;
122 unsigned offset;
David Teiglandb3b94fa2006-01-16 16:50:04 +0000123 int error;
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000124 int done_trans = 0;
David Teiglandb3b94fa2006-01-16 16:50:04 +0000125
David Teiglandb3b94fa2006-01-16 16:50:04 +0000126 if (gfs2_assert_withdraw(sdp, gfs2_glock_is_held_excl(ip->i_gl))) {
127 unlock_page(page);
128 return -EIO;
129 }
Steven Whitehouse5c676f62006-02-27 17:23:27 -0500130 if (current->journal_info)
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000131 goto out_ignore;
132
133 /* Is the page fully outside i_size? (truncate in progress) */
134 offset = i_size & (PAGE_CACHE_SIZE-1);
Steven Whitehoused2d7b8a2006-05-02 12:09:42 -0400135 if (page->index > end_index || (page->index == end_index && !offset)) {
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000136 page->mapping->a_ops->invalidatepage(page, 0);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000137 unlock_page(page);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000138 return 0; /* don't care */
139 }
140
Robert Peterson8fb68592007-06-12 11:24:36 -0500141 if ((sdp->sd_args.ar_data == GFS2_DATA_ORDERED || gfs2_is_jdata(ip)) &&
142 PageChecked(page)) {
143 ClearPageChecked(page);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000144 error = gfs2_trans_begin(sdp, RES_DINODE + 1, 0);
145 if (error)
146 goto out_ignore;
Steven Whitehousef4387142006-08-08 13:23:19 -0400147 if (!page_has_buffers(page)) {
148 create_empty_buffers(page, inode->i_sb->s_blocksize,
149 (1 << BH_Dirty)|(1 << BH_Uptodate));
150 }
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000151 gfs2_page_add_databufs(ip, page, 0, sdp->sd_vfs->s_blocksize-1);
152 done_trans = 1;
David Teiglandb3b94fa2006-01-16 16:50:04 +0000153 }
Steven Whitehouse7a6bbac2006-09-18 17:18:23 -0400154 error = block_write_full_page(page, gfs2_get_block_noalloc, wbc);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000155 if (done_trans)
156 gfs2_trans_end(sdp);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000157 gfs2_meta_cache_flush(ip);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000158 return error;
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000159
160out_ignore:
161 redirty_page_for_writepage(wbc, page);
162 unlock_page(page);
163 return 0;
David Teiglandb3b94fa2006-01-16 16:50:04 +0000164}
165
166/**
Steven Whitehousea8d638e2007-01-15 13:52:17 +0000167 * gfs2_writepages - Write a bunch of dirty pages back to disk
168 * @mapping: The mapping to write
169 * @wbc: Write-back control
170 *
171 * For journaled files and/or ordered writes this just falls back to the
172 * kernel's default writepages path for now. We will probably want to change
173 * that eventually (i.e. when we look at allocate on flush).
174 *
175 * For the data=writeback case though we can already ignore buffer heads
176 * and write whole extents at once. This is a big reduction in the
177 * number of I/O requests we send and the bmap calls we make in this case.
178 */
Adrian Bunka2cf8222007-02-06 23:12:49 +0100179static int gfs2_writepages(struct address_space *mapping,
180 struct writeback_control *wbc)
Steven Whitehousea8d638e2007-01-15 13:52:17 +0000181{
182 struct inode *inode = mapping->host;
183 struct gfs2_inode *ip = GFS2_I(inode);
184 struct gfs2_sbd *sdp = GFS2_SB(inode);
185
186 if (sdp->sd_args.ar_data == GFS2_DATA_WRITEBACK && !gfs2_is_jdata(ip))
187 return mpage_writepages(mapping, wbc, gfs2_get_block_noalloc);
188
189 return generic_writepages(mapping, wbc);
190}
191
192/**
David Teiglandb3b94fa2006-01-16 16:50:04 +0000193 * stuffed_readpage - Fill in a Linux page with stuffed file data
194 * @ip: the inode
195 * @page: the page
196 *
197 * Returns: errno
198 */
199
200static int stuffed_readpage(struct gfs2_inode *ip, struct page *page)
201{
202 struct buffer_head *dibh;
203 void *kaddr;
204 int error;
205
Steven Whitehousebf126ae2007-04-20 09:18:30 +0100206 /*
207 * Due to the order of unstuffing files and ->nopage(), we can be
208 * asked for a zero page in the case of a stuffed file being extended,
209 * so we need to supply one here. It doesn't happen often.
210 */
211 if (unlikely(page->index)) {
Steven Whitehouse28405012007-06-18 16:31:42 +0100212 zero_user_page(page, 0, PAGE_CACHE_SIZE, KM_USER0);
Steven Whitehousebf126ae2007-04-20 09:18:30 +0100213 return 0;
214 }
Steven Whitehousefd88de562006-05-05 16:59:11 -0400215
David Teiglandb3b94fa2006-01-16 16:50:04 +0000216 error = gfs2_meta_inode_buffer(ip, &dibh);
217 if (error)
218 return error;
219
Steven Whitehouse5c4e9e02006-02-15 12:26:19 +0000220 kaddr = kmap_atomic(page, KM_USER0);
Steven Whitehousefd88de562006-05-05 16:59:11 -0400221 memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode),
David Teiglandb3b94fa2006-01-16 16:50:04 +0000222 ip->i_di.di_size);
Steven Whitehousefd88de562006-05-05 16:59:11 -0400223 memset(kaddr + ip->i_di.di_size, 0, PAGE_CACHE_SIZE - ip->i_di.di_size);
Russell Cattelanc312c4f2006-10-12 09:23:41 -0400224 kunmap_atomic(kaddr, KM_USER0);
Steven Whitehousebf126ae2007-04-20 09:18:30 +0100225 flush_dcache_page(page);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000226 brelse(dibh);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000227 SetPageUptodate(page);
228
229 return 0;
230}
231
David Teiglandb3b94fa2006-01-16 16:50:04 +0000232
233/**
Steven Whitehouse51ff87b2007-10-15 14:42:35 +0100234 * __gfs2_readpage - readpage
235 * @file: The file to read a page for
David Teiglandb3b94fa2006-01-16 16:50:04 +0000236 * @page: The page to read
237 *
Steven Whitehouse51ff87b2007-10-15 14:42:35 +0100238 * This is the core of gfs2's readpage. Its used by the internal file
239 * reading code as in that case we already hold the glock. Also its
240 * called by gfs2_readpage() once the required lock has been granted.
241 *
242 */
243
244static int __gfs2_readpage(void *file, struct page *page)
245{
246 struct gfs2_inode *ip = GFS2_I(page->mapping->host);
247 struct gfs2_sbd *sdp = GFS2_SB(page->mapping->host);
248 int error;
249
250 if (gfs2_is_stuffed(ip)) {
251 error = stuffed_readpage(ip, page);
252 unlock_page(page);
253 } else {
254 error = mpage_readpage(page, gfs2_get_block);
255 }
256
257 if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
258 return -EIO;
259
260 return error;
261}
262
263/**
264 * gfs2_readpage - read a page of a file
265 * @file: The file to read
266 * @page: The page of the file
267 *
Steven Whitehouse3cc3f712007-10-15 15:40:33 +0100268 * This deals with the locking required. We use a trylock in order to
Steven Whitehouse51ff87b2007-10-15 14:42:35 +0100269 * avoid the page lock / glock ordering problems returning AOP_TRUNCATED_PAGE
270 * in the event that we are unable to get the lock.
David Teiglandb3b94fa2006-01-16 16:50:04 +0000271 */
272
273static int gfs2_readpage(struct file *file, struct page *page)
274{
Steven Whitehousefeaa7bb2006-06-14 15:32:57 -0400275 struct gfs2_inode *ip = GFS2_I(page->mapping->host);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000276 struct gfs2_holder gh;
David Teiglandb3b94fa2006-01-16 16:50:04 +0000277 int error;
278
Steven Whitehouse51ff87b2007-10-15 14:42:35 +0100279 gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME|LM_FLAG_TRY_1CB, &gh);
280 error = gfs2_glock_nq_atime(&gh);
281 if (unlikely(error)) {
Steven Whitehousefd88de562006-05-05 16:59:11 -0400282 unlock_page(page);
Steven Whitehouse51ff87b2007-10-15 14:42:35 +0100283 goto out;
Steven Whitehouse61a30dc2006-02-15 10:15:18 +0000284 }
Steven Whitehouse51ff87b2007-10-15 14:42:35 +0100285 error = __gfs2_readpage(file, page);
286 gfs2_glock_dq(&gh);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000287out:
Steven Whitehouse51ff87b2007-10-15 14:42:35 +0100288 gfs2_holder_uninit(&gh);
Josef Whitera13cbe32007-02-23 12:49:51 -0500289 if (error == GLR_TRYFAILED) {
Josef Whitera13cbe32007-02-23 12:49:51 -0500290 yield();
Steven Whitehouse51ff87b2007-10-15 14:42:35 +0100291 return AOP_TRUNCATED_PAGE;
Josef Whitera13cbe32007-02-23 12:49:51 -0500292 }
Steven Whitehouse51ff87b2007-10-15 14:42:35 +0100293 return error;
294}
295
296/**
297 * gfs2_internal_read - read an internal file
298 * @ip: The gfs2 inode
299 * @ra_state: The readahead state (or NULL for no readahead)
300 * @buf: The buffer to fill
301 * @pos: The file position
302 * @size: The amount to read
303 *
304 */
305
306int gfs2_internal_read(struct gfs2_inode *ip, struct file_ra_state *ra_state,
307 char *buf, loff_t *pos, unsigned size)
308{
309 struct address_space *mapping = ip->i_inode.i_mapping;
310 unsigned long index = *pos / PAGE_CACHE_SIZE;
311 unsigned offset = *pos & (PAGE_CACHE_SIZE - 1);
312 unsigned copied = 0;
313 unsigned amt;
314 struct page *page;
315 void *p;
316
317 do {
318 amt = size - copied;
319 if (offset + size > PAGE_CACHE_SIZE)
320 amt = PAGE_CACHE_SIZE - offset;
321 page = read_cache_page(mapping, index, __gfs2_readpage, NULL);
322 if (IS_ERR(page))
323 return PTR_ERR(page);
324 p = kmap_atomic(page, KM_USER0);
325 memcpy(buf + copied, p + offset, amt);
326 kunmap_atomic(p, KM_USER0);
327 mark_page_accessed(page);
328 page_cache_release(page);
329 copied += amt;
330 index++;
331 offset = 0;
332 } while(copied < size);
333 (*pos) += size;
334 return size;
Steven Whitehousefd88de562006-05-05 16:59:11 -0400335}
336
Steven Whitehousefd88de562006-05-05 16:59:11 -0400337/**
338 * gfs2_readpages - Read a bunch of pages at once
339 *
340 * Some notes:
341 * 1. This is only for readahead, so we can simply ignore any things
342 * which are slightly inconvenient (such as locking conflicts between
343 * the page lock and the glock) and return having done no I/O. Its
344 * obviously not something we'd want to do on too regular a basis.
345 * Any I/O we ignore at this time will be done via readpage later.
Steven Whitehousee1d5b182006-12-15 16:49:51 -0500346 * 2. We don't handle stuffed files here we let readpage do the honours.
Steven Whitehousefd88de562006-05-05 16:59:11 -0400347 * 3. mpage_readpages() does most of the heavy lifting in the common case.
348 * 4. gfs2_get_block() is relied upon to set BH_Boundary in the right places.
Steven Whitehousefd88de562006-05-05 16:59:11 -0400349 */
Steven Whitehouse3cc3f712007-10-15 15:40:33 +0100350
Steven Whitehousefd88de562006-05-05 16:59:11 -0400351static int gfs2_readpages(struct file *file, struct address_space *mapping,
352 struct list_head *pages, unsigned nr_pages)
353{
354 struct inode *inode = mapping->host;
Steven Whitehousefeaa7bb2006-06-14 15:32:57 -0400355 struct gfs2_inode *ip = GFS2_I(inode);
356 struct gfs2_sbd *sdp = GFS2_SB(inode);
Steven Whitehousefd88de562006-05-05 16:59:11 -0400357 struct gfs2_holder gh;
Steven Whitehouse3cc3f712007-10-15 15:40:33 +0100358 int ret;
Steven Whitehousefd88de562006-05-05 16:59:11 -0400359
Steven Whitehouse3cc3f712007-10-15 15:40:33 +0100360 gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, &gh);
Steven Whitehouse51ff87b2007-10-15 14:42:35 +0100361 ret = gfs2_glock_nq_atime(&gh);
Steven Whitehouse51ff87b2007-10-15 14:42:35 +0100362 if (unlikely(ret))
Steven Whitehouse3cc3f712007-10-15 15:40:33 +0100363 goto out_uninit;
Steven Whitehousee1d5b182006-12-15 16:49:51 -0500364 if (!gfs2_is_stuffed(ip))
Steven Whitehousefd88de562006-05-05 16:59:11 -0400365 ret = mpage_readpages(mapping, pages, nr_pages, gfs2_get_block);
Steven Whitehouse3cc3f712007-10-15 15:40:33 +0100366 gfs2_glock_dq(&gh);
367out_uninit:
368 gfs2_holder_uninit(&gh);
Steven Whitehousefd88de562006-05-05 16:59:11 -0400369 if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
370 ret = -EIO;
371 return ret;
David Teiglandb3b94fa2006-01-16 16:50:04 +0000372}
373
374/**
Steven Whitehouse7765ec22007-10-16 01:25:07 -0700375 * gfs2_write_begin - Begin to write to a file
David Teiglandb3b94fa2006-01-16 16:50:04 +0000376 * @file: The file to write to
Steven Whitehouse7765ec22007-10-16 01:25:07 -0700377 * @mapping: The mapping in which to write
378 * @pos: The file offset at which to start writing
379 * @len: Length of the write
380 * @flags: Various flags
381 * @pagep: Pointer to return the page
382 * @fsdata: Pointer to return fs data (unused by GFS2)
David Teiglandb3b94fa2006-01-16 16:50:04 +0000383 *
384 * Returns: errno
385 */
386
Steven Whitehouse7765ec22007-10-16 01:25:07 -0700387static int gfs2_write_begin(struct file *file, struct address_space *mapping,
388 loff_t pos, unsigned len, unsigned flags,
389 struct page **pagep, void **fsdata)
David Teiglandb3b94fa2006-01-16 16:50:04 +0000390{
Steven Whitehouse7765ec22007-10-16 01:25:07 -0700391 struct gfs2_inode *ip = GFS2_I(mapping->host);
392 struct gfs2_sbd *sdp = GFS2_SB(mapping->host);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000393 unsigned int data_blocks, ind_blocks, rblocks;
394 int alloc_required;
David Teiglandb3b94fa2006-01-16 16:50:04 +0000395 int error = 0;
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000396 struct gfs2_alloc *al;
Steven Whitehouse7765ec22007-10-16 01:25:07 -0700397 pgoff_t index = pos >> PAGE_CACHE_SHIFT;
398 unsigned from = pos & (PAGE_CACHE_SIZE - 1);
399 unsigned to = from + len;
400 struct page *page;
Russell Cattelan52ae7b72006-10-09 12:11:54 -0500401
Steven Whitehouse7765ec22007-10-16 01:25:07 -0700402 gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_ATIME, &ip->i_gh);
Steven Whitehousedcd24792006-11-16 11:08:16 -0500403 error = gfs2_glock_nq_atime(&ip->i_gh);
Steven Whitehouse7765ec22007-10-16 01:25:07 -0700404 if (unlikely(error))
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000405 goto out_uninit;
406
Steven Whitehouse7765ec22007-10-16 01:25:07 -0700407 error = -ENOMEM;
408 page = __grab_cache_page(mapping, index);
409 *pagep = page;
410 if (!page)
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000411 goto out_unlock;
412
Steven Whitehouse7765ec22007-10-16 01:25:07 -0700413 gfs2_write_calc_reserv(ip, len, &data_blocks, &ind_blocks);
414
415 error = gfs2_write_alloc_required(ip, pos, len, &alloc_required);
416 if (error)
417 goto out_putpage;
418
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000419
Steven Whitehousef5c54802006-10-10 13:45:15 -0400420 ip->i_alloc.al_requested = 0;
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000421 if (alloc_required) {
422 al = gfs2_alloc_get(ip);
423
424 error = gfs2_quota_lock(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
425 if (error)
426 goto out_alloc_put;
427
Steven Whitehouse2933f922006-11-01 13:23:29 -0500428 error = gfs2_quota_check(ip, ip->i_inode.i_uid, ip->i_inode.i_gid);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000429 if (error)
430 goto out_qunlock;
431
432 al->al_requested = data_blocks + ind_blocks;
433 error = gfs2_inplace_reserve(ip);
434 if (error)
435 goto out_qunlock;
436 }
437
438 rblocks = RES_DINODE + ind_blocks;
439 if (gfs2_is_jdata(ip))
440 rblocks += data_blocks ? data_blocks : 1;
441 if (ind_blocks || data_blocks)
442 rblocks += RES_STATFS + RES_QUOTA;
443
Steven Whitehouse16615be2007-09-17 10:59:52 +0100444 error = gfs2_trans_begin(sdp, rblocks,
445 PAGE_CACHE_SIZE/sdp->sd_sb.sb_bsize);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000446 if (error)
Steven Whitehousea867bb22007-07-17 10:29:02 +0100447 goto out_trans_fail;
David Teiglandb3b94fa2006-01-16 16:50:04 +0000448
449 if (gfs2_is_stuffed(ip)) {
Steven Whitehouse7765ec22007-10-16 01:25:07 -0700450 if (pos + len > sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode)) {
Steven Whitehousef25ef0c2006-07-26 10:51:20 -0400451 error = gfs2_unstuff_dinode(ip, page);
Steven Whitehouse5c4e9e02006-02-15 12:26:19 +0000452 if (error == 0)
453 goto prepare_write;
454 } else if (!PageUptodate(page))
David Teiglandb3b94fa2006-01-16 16:50:04 +0000455 error = stuffed_readpage(ip, page);
Steven Whitehouse5c4e9e02006-02-15 12:26:19 +0000456 goto out;
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000457 }
458
Steven Whitehouse5c4e9e02006-02-15 12:26:19 +0000459prepare_write:
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000460 error = block_prepare_write(page, from, to, gfs2_get_block);
461
462out:
463 if (error) {
464 gfs2_trans_end(sdp);
Steven Whitehousea867bb22007-07-17 10:29:02 +0100465out_trans_fail:
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000466 if (alloc_required) {
467 gfs2_inplace_release(ip);
468out_qunlock:
469 gfs2_quota_unlock(ip);
470out_alloc_put:
471 gfs2_alloc_put(ip);
472 }
Steven Whitehouse7765ec22007-10-16 01:25:07 -0700473out_putpage:
474 page_cache_release(page);
475 if (pos + len > ip->i_inode.i_size)
476 vmtruncate(&ip->i_inode, ip->i_inode.i_size);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000477out_unlock:
478 gfs2_glock_dq_m(1, &ip->i_gh);
479out_uninit:
480 gfs2_holder_uninit(&ip->i_gh);
481 }
David Teiglandb3b94fa2006-01-16 16:50:04 +0000482
483 return error;
484}
485
486/**
Robert Peterson7ae8fa82007-05-09 09:37:57 -0500487 * adjust_fs_space - Adjusts the free space available due to gfs2_grow
488 * @inode: the rindex inode
489 */
490static void adjust_fs_space(struct inode *inode)
491{
492 struct gfs2_sbd *sdp = inode->i_sb->s_fs_info;
493 struct gfs2_statfs_change_host *m_sc = &sdp->sd_statfs_master;
494 struct gfs2_statfs_change_host *l_sc = &sdp->sd_statfs_local;
495 u64 fs_total, new_free;
496
497 /* Total up the file system space, according to the latest rindex. */
498 fs_total = gfs2_ri_total(sdp);
499
500 spin_lock(&sdp->sd_statfs_spin);
501 if (fs_total > (m_sc->sc_total + l_sc->sc_total))
502 new_free = fs_total - (m_sc->sc_total + l_sc->sc_total);
503 else
504 new_free = 0;
505 spin_unlock(&sdp->sd_statfs_spin);
Robert Peterson6c532672007-05-10 16:54:38 -0500506 fs_warn(sdp, "File system extended by %llu blocks.\n",
507 (unsigned long long)new_free);
Robert Peterson7ae8fa82007-05-09 09:37:57 -0500508 gfs2_statfs_change(sdp, new_free, new_free, 0);
509}
510
511/**
Steven Whitehouse7765ec22007-10-16 01:25:07 -0700512 * gfs2_stuffed_write_end - Write end for stuffed files
513 * @inode: The inode
514 * @dibh: The buffer_head containing the on-disk inode
515 * @pos: The file position
516 * @len: The length of the write
517 * @copied: How much was actually copied by the VFS
518 * @page: The page
519 *
520 * This copies the data from the page into the inode block after
521 * the inode data structure itself.
David Teiglandb3b94fa2006-01-16 16:50:04 +0000522 *
523 * Returns: errno
524 */
Steven Whitehouse7765ec22007-10-16 01:25:07 -0700525static int gfs2_stuffed_write_end(struct inode *inode, struct buffer_head *dibh,
526 loff_t pos, unsigned len, unsigned copied,
527 struct page *page)
David Teiglandb3b94fa2006-01-16 16:50:04 +0000528{
Steven Whitehousefeaa7bb2006-06-14 15:32:57 -0400529 struct gfs2_inode *ip = GFS2_I(inode);
530 struct gfs2_sbd *sdp = GFS2_SB(inode);
Steven Whitehouse7765ec22007-10-16 01:25:07 -0700531 u64 to = pos + copied;
532 void *kaddr;
533 unsigned char *buf = dibh->b_data + sizeof(struct gfs2_dinode);
534 struct gfs2_dinode *di = (struct gfs2_dinode *)dibh->b_data;
David Teiglandb3b94fa2006-01-16 16:50:04 +0000535
Steven Whitehouse7765ec22007-10-16 01:25:07 -0700536 BUG_ON((pos + len) > (dibh->b_size - sizeof(struct gfs2_dinode)));
537 kaddr = kmap_atomic(page, KM_USER0);
538 memcpy(buf + pos, kaddr + pos, copied);
539 memset(kaddr + pos + copied, 0, len - copied);
540 flush_dcache_page(page);
541 kunmap_atomic(kaddr, KM_USER0);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000542
Steven Whitehouse7765ec22007-10-16 01:25:07 -0700543 if (!PageUptodate(page))
David Teiglandb3b94fa2006-01-16 16:50:04 +0000544 SetPageUptodate(page);
Steven Whitehouse7765ec22007-10-16 01:25:07 -0700545 unlock_page(page);
546 page_cache_release(page);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000547
Steven Whitehouse7765ec22007-10-16 01:25:07 -0700548 if (inode->i_size < to) {
549 i_size_write(inode, to);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000550 ip->i_di.di_size = inode->i_size;
Steven Whitehouse48516ce2006-10-02 12:39:19 -0400551 di->di_size = cpu_to_be64(inode->i_size);
Steven Whitehouse7765ec22007-10-16 01:25:07 -0700552 mark_inode_dirty(inode);
Steven Whitehouse48516ce2006-10-02 12:39:19 -0400553 }
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000554
Robert Peterson7ae8fa82007-05-09 09:37:57 -0500555 if (inode == sdp->sd_rindex)
556 adjust_fs_space(inode);
557
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000558 brelse(dibh);
559 gfs2_trans_end(sdp);
Steven Whitehouse7765ec22007-10-16 01:25:07 -0700560 gfs2_glock_dq(&ip->i_gh);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000561 gfs2_holder_uninit(&ip->i_gh);
Steven Whitehouse7765ec22007-10-16 01:25:07 -0700562 return copied;
563}
David Teiglandb3b94fa2006-01-16 16:50:04 +0000564
Steven Whitehouse7765ec22007-10-16 01:25:07 -0700565/**
566 * gfs2_write_end
567 * @file: The file to write to
568 * @mapping: The address space to write to
569 * @pos: The file position
570 * @len: The length of the data
571 * @copied:
572 * @page: The page that has been written
573 * @fsdata: The fsdata (unused in GFS2)
574 *
575 * The main write_end function for GFS2. We have a separate one for
576 * stuffed files as they are slightly different, otherwise we just
577 * put our locking around the VFS provided functions.
578 *
579 * Returns: errno
580 */
581
582static int gfs2_write_end(struct file *file, struct address_space *mapping,
583 loff_t pos, unsigned len, unsigned copied,
584 struct page *page, void *fsdata)
585{
586 struct inode *inode = page->mapping->host;
587 struct gfs2_inode *ip = GFS2_I(inode);
588 struct gfs2_sbd *sdp = GFS2_SB(inode);
589 struct buffer_head *dibh;
590 struct gfs2_alloc *al = &ip->i_alloc;
591 struct gfs2_dinode *di;
592 unsigned int from = pos & (PAGE_CACHE_SIZE - 1);
593 unsigned int to = from + len;
594 int ret;
595
596 BUG_ON(gfs2_glock_is_locked_by_me(ip->i_gl) == 0);
597
598 ret = gfs2_meta_inode_buffer(ip, &dibh);
599 if (unlikely(ret)) {
600 unlock_page(page);
601 page_cache_release(page);
602 goto failed;
603 }
604
605 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
606
607 if (gfs2_is_stuffed(ip))
608 return gfs2_stuffed_write_end(inode, dibh, pos, len, copied, page);
609
610 if (sdp->sd_args.ar_data == GFS2_DATA_ORDERED || gfs2_is_jdata(ip))
611 gfs2_page_add_databufs(ip, page, from, to);
612
613 ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata);
614
615 if (likely(ret >= 0)) {
616 copied = ret;
617 if ((pos + copied) > inode->i_size) {
618 di = (struct gfs2_dinode *)dibh->b_data;
619 ip->i_di.di_size = inode->i_size;
620 di->di_size = cpu_to_be64(inode->i_size);
621 mark_inode_dirty(inode);
622 }
623 }
624
625 if (inode == sdp->sd_rindex)
626 adjust_fs_space(inode);
627
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000628 brelse(dibh);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000629 gfs2_trans_end(sdp);
Steven Whitehouse7765ec22007-10-16 01:25:07 -0700630failed:
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000631 if (al->al_requested) {
632 gfs2_inplace_release(ip);
633 gfs2_quota_unlock(ip);
634 gfs2_alloc_put(ip);
635 }
Steven Whitehouse7765ec22007-10-16 01:25:07 -0700636 gfs2_glock_dq(&ip->i_gh);
Steven Whitehouse18ec7d52006-02-08 11:50:51 +0000637 gfs2_holder_uninit(&ip->i_gh);
Steven Whitehouse7765ec22007-10-16 01:25:07 -0700638 return ret;
David Teiglandb3b94fa2006-01-16 16:50:04 +0000639}
640
641/**
Robert Peterson8fb68592007-06-12 11:24:36 -0500642 * gfs2_set_page_dirty - Page dirtying function
643 * @page: The page to dirty
644 *
645 * Returns: 1 if it dirtyed the page, or 0 otherwise
646 */
647
648static int gfs2_set_page_dirty(struct page *page)
649{
650 struct gfs2_inode *ip = GFS2_I(page->mapping->host);
651 struct gfs2_sbd *sdp = GFS2_SB(page->mapping->host);
652
653 if (sdp->sd_args.ar_data == GFS2_DATA_ORDERED || gfs2_is_jdata(ip))
654 SetPageChecked(page);
655 return __set_page_dirty_buffers(page);
656}
657
658/**
David Teiglandb3b94fa2006-01-16 16:50:04 +0000659 * gfs2_bmap - Block map function
660 * @mapping: Address space info
661 * @lblock: The block to map
662 *
663 * Returns: The disk address for the block or 0 on hole or error
664 */
665
666static sector_t gfs2_bmap(struct address_space *mapping, sector_t lblock)
667{
Steven Whitehousefeaa7bb2006-06-14 15:32:57 -0400668 struct gfs2_inode *ip = GFS2_I(mapping->host);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000669 struct gfs2_holder i_gh;
670 sector_t dblock = 0;
671 int error;
672
David Teiglandb3b94fa2006-01-16 16:50:04 +0000673 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh);
674 if (error)
675 return 0;
676
677 if (!gfs2_is_stuffed(ip))
Steven Whitehouse4ff14672006-01-30 09:39:10 +0000678 dblock = generic_block_bmap(mapping, lblock, gfs2_get_block);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000679
680 gfs2_glock_dq_uninit(&i_gh);
681
682 return dblock;
683}
684
Steven Whitehoused7b616e2007-09-02 10:48:13 +0100685static void gfs2_discard(struct gfs2_sbd *sdp, struct buffer_head *bh)
686{
687 struct gfs2_bufdata *bd;
688
689 lock_buffer(bh);
690 gfs2_log_lock(sdp);
691 clear_buffer_dirty(bh);
692 bd = bh->b_private;
693 if (bd) {
Steven Whitehouse16615be2007-09-17 10:59:52 +0100694 if (!list_empty(&bd->bd_le.le_list) && !buffer_pinned(bh))
695 list_del_init(&bd->bd_le.le_list);
696 else
697 gfs2_remove_from_journal(bh, current->journal_info, 0);
Steven Whitehoused7b616e2007-09-02 10:48:13 +0100698 }
699 bh->b_bdev = NULL;
700 clear_buffer_mapped(bh);
701 clear_buffer_req(bh);
702 clear_buffer_new(bh);
703 gfs2_log_unlock(sdp);
704 unlock_buffer(bh);
705}
706
Steven Whitehouse8628de02006-03-31 16:48:41 -0500707static void gfs2_invalidatepage(struct page *page, unsigned long offset)
David Teiglandb3b94fa2006-01-16 16:50:04 +0000708{
Steven Whitehoused7b616e2007-09-02 10:48:13 +0100709 struct gfs2_sbd *sdp = GFS2_SB(page->mapping->host);
710 struct buffer_head *bh, *head;
711 unsigned long pos = 0;
712
David Teiglandb3b94fa2006-01-16 16:50:04 +0000713 BUG_ON(!PageLocked(page));
Robert Peterson8fb68592007-06-12 11:24:36 -0500714 if (offset == 0)
715 ClearPageChecked(page);
Steven Whitehoused7b616e2007-09-02 10:48:13 +0100716 if (!page_has_buffers(page))
717 goto out;
David Teiglandb3b94fa2006-01-16 16:50:04 +0000718
Steven Whitehoused7b616e2007-09-02 10:48:13 +0100719 bh = head = page_buffers(page);
720 do {
721 if (offset <= pos)
722 gfs2_discard(sdp, bh);
723 pos += bh->b_size;
724 bh = bh->b_this_page;
725 } while (bh != head);
726out:
727 if (offset == 0)
728 try_to_release_page(page, 0);
David Teiglandb3b94fa2006-01-16 16:50:04 +0000729}
730
Steven Whitehousec7b33832006-12-14 18:24:26 +0000731/**
732 * gfs2_ok_for_dio - check that dio is valid on this file
733 * @ip: The inode
734 * @rw: READ or WRITE
735 * @offset: The offset at which we are reading or writing
736 *
737 * Returns: 0 (to ignore the i/o request and thus fall back to buffered i/o)
738 * 1 (to accept the i/o request)
739 */
740static int gfs2_ok_for_dio(struct gfs2_inode *ip, int rw, loff_t offset)
741{
742 /*
743 * Should we return an error here? I can't see that O_DIRECT for
744 * a journaled file makes any sense. For now we'll silently fall
745 * back to buffered I/O, likewise we do the same for stuffed
746 * files since they are (a) small and (b) unaligned.
747 */
748 if (gfs2_is_jdata(ip))
749 return 0;
750
751 if (gfs2_is_stuffed(ip))
752 return 0;
753
754 if (offset > i_size_read(&ip->i_inode))
755 return 0;
756 return 1;
757}
758
759
760
Steven Whitehousea9e5f4d2006-07-25 17:24:12 -0400761static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb,
762 const struct iovec *iov, loff_t offset,
763 unsigned long nr_segs)
Steven Whitehoused1665e42006-02-14 11:54:42 +0000764{
765 struct file *file = iocb->ki_filp;
766 struct inode *inode = file->f_mapping->host;
Steven Whitehousefeaa7bb2006-06-14 15:32:57 -0400767 struct gfs2_inode *ip = GFS2_I(inode);
Steven Whitehoused1665e42006-02-14 11:54:42 +0000768 struct gfs2_holder gh;
769 int rv;
770
771 /*
Steven Whitehousec7b33832006-12-14 18:24:26 +0000772 * Deferred lock, even if its a write, since we do no allocation
773 * on this path. All we need change is atime, and this lock mode
774 * ensures that other nodes have flushed their buffered read caches
775 * (i.e. their page cache entries for this inode). We do not,
776 * unfortunately have the option of only flushing a range like
777 * the VFS does.
Steven Whitehoused1665e42006-02-14 11:54:42 +0000778 */
Steven Whitehousec7b33832006-12-14 18:24:26 +0000779 gfs2_holder_init(ip->i_gl, LM_ST_DEFERRED, GL_ATIME, &gh);
Steven Whitehousedcd24792006-11-16 11:08:16 -0500780 rv = gfs2_glock_nq_atime(&gh);
Steven Whitehoused1665e42006-02-14 11:54:42 +0000781 if (rv)
Steven Whitehousec7b33832006-12-14 18:24:26 +0000782 return rv;
783 rv = gfs2_ok_for_dio(ip, rw, offset);
784 if (rv != 1)
785 goto out; /* dio not valid, fall back to buffered i/o */
Steven Whitehoused1665e42006-02-14 11:54:42 +0000786
Steven Whitehousec7b33832006-12-14 18:24:26 +0000787 rv = blockdev_direct_IO_no_locking(rw, iocb, inode, inode->i_sb->s_bdev,
788 iov, offset, nr_segs,
789 gfs2_get_block_direct, NULL);
Steven Whitehoused1665e42006-02-14 11:54:42 +0000790out:
791 gfs2_glock_dq_m(1, &gh);
792 gfs2_holder_uninit(&gh);
Steven Whitehoused1665e42006-02-14 11:54:42 +0000793 return rv;
794}
795
796/**
Steven Whitehouse623d9352006-08-31 12:14:44 -0400797 * gfs2_releasepage - free the metadata associated with a page
Steven Whitehouse4340fe62006-07-11 09:46:33 -0400798 * @page: the page that's being released
799 * @gfp_mask: passed from Linux VFS, ignored by us
800 *
801 * Call try_to_free_buffers() if the buffers in this page can be
802 * released.
803 *
804 * Returns: 0
805 */
806
807int gfs2_releasepage(struct page *page, gfp_t gfp_mask)
808{
809 struct inode *aspace = page->mapping->host;
810 struct gfs2_sbd *sdp = aspace->i_sb->s_fs_info;
811 struct buffer_head *bh, *head;
812 struct gfs2_bufdata *bd;
Steven Whitehouse4340fe62006-07-11 09:46:33 -0400813
814 if (!page_has_buffers(page))
Steven Whitehouse891ba6d2007-09-20 15:26:33 +0100815 return 0;
Steven Whitehouse4340fe62006-07-11 09:46:33 -0400816
Steven Whitehousebb3b0e32007-08-16 16:03:57 +0100817 gfs2_log_lock(sdp);
Steven Whitehouse4340fe62006-07-11 09:46:33 -0400818 head = bh = page_buffers(page);
819 do {
Steven Whitehousebb3b0e32007-08-16 16:03:57 +0100820 if (atomic_read(&bh->b_count))
821 goto cannot_release;
822 bd = bh->b_private;
823 if (bd && bd->bd_ail)
824 goto cannot_release;
Steven Whitehouse4340fe62006-07-11 09:46:33 -0400825 gfs2_assert_warn(sdp, !buffer_pinned(bh));
Steven Whitehouse623d9352006-08-31 12:14:44 -0400826 gfs2_assert_warn(sdp, !buffer_dirty(bh));
Steven Whitehousebb3b0e32007-08-16 16:03:57 +0100827 bh = bh->b_this_page;
828 } while(bh != head);
829 gfs2_log_unlock(sdp);
Steven Whitehouse4340fe62006-07-11 09:46:33 -0400830
Steven Whitehousebb3b0e32007-08-16 16:03:57 +0100831 head = bh = page_buffers(page);
832 do {
Steven Whitehouse623d9352006-08-31 12:14:44 -0400833 gfs2_log_lock(sdp);
Steven Whitehouse4340fe62006-07-11 09:46:33 -0400834 bd = bh->b_private;
835 if (bd) {
836 gfs2_assert_warn(sdp, bd->bd_bh == bh);
837 gfs2_assert_warn(sdp, list_empty(&bd->bd_list_tr));
Steven Whitehoused7b616e2007-09-02 10:48:13 +0100838 if (!list_empty(&bd->bd_le.le_list)) {
839 if (!buffer_pinned(bh))
840 list_del_init(&bd->bd_le.le_list);
841 else
842 bd = NULL;
843 }
844 if (bd)
845 bd->bd_bh = NULL;
Steven Whitehouse4340fe62006-07-11 09:46:33 -0400846 bh->b_private = NULL;
847 }
Steven Whitehouse623d9352006-08-31 12:14:44 -0400848 gfs2_log_unlock(sdp);
849 if (bd)
850 kmem_cache_free(gfs2_bufdata_cachep, bd);
Steven Whitehouse4340fe62006-07-11 09:46:33 -0400851
852 bh = bh->b_this_page;
Steven Whitehouse166afcc2006-08-24 15:59:40 -0400853 } while (bh != head);
Steven Whitehouse4340fe62006-07-11 09:46:33 -0400854
Steven Whitehouse4340fe62006-07-11 09:46:33 -0400855 return try_to_free_buffers(page);
Steven Whitehousebb3b0e32007-08-16 16:03:57 +0100856cannot_release:
857 gfs2_log_unlock(sdp);
858 return 0;
Steven Whitehouse4340fe62006-07-11 09:46:33 -0400859}
860
Steven Whitehouse66de0452006-07-03 13:37:30 -0400861const struct address_space_operations gfs2_file_aops = {
David Teiglandb3b94fa2006-01-16 16:50:04 +0000862 .writepage = gfs2_writepage,
Steven Whitehousea8d638e2007-01-15 13:52:17 +0000863 .writepages = gfs2_writepages,
David Teiglandb3b94fa2006-01-16 16:50:04 +0000864 .readpage = gfs2_readpage,
Steven Whitehousefd88de562006-05-05 16:59:11 -0400865 .readpages = gfs2_readpages,
David Teiglandb3b94fa2006-01-16 16:50:04 +0000866 .sync_page = block_sync_page,
Steven Whitehouse7765ec22007-10-16 01:25:07 -0700867 .write_begin = gfs2_write_begin,
868 .write_end = gfs2_write_end,
Robert Peterson8fb68592007-06-12 11:24:36 -0500869 .set_page_dirty = gfs2_set_page_dirty,
David Teiglandb3b94fa2006-01-16 16:50:04 +0000870 .bmap = gfs2_bmap,
871 .invalidatepage = gfs2_invalidatepage,
Steven Whitehouse4340fe62006-07-11 09:46:33 -0400872 .releasepage = gfs2_releasepage,
David Teiglandb3b94fa2006-01-16 16:50:04 +0000873 .direct_IO = gfs2_direct_IO,
874};
875