blob: 1eb561a10e265e8d7233c1effbb8e0294da6d439 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Nathan Scott7b718762005-11-02 14:58:39 +11002 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 *
Nathan Scott7b718762005-11-02 14:58:39 +11005 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 * published by the Free Software Foundation.
8 *
Nathan Scott7b718762005-11-02 14:58:39 +11009 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
Linus Torvalds1da177e2005-04-16 15:20:36 -070013 *
Nathan Scott7b718762005-11-02 14:58:39 +110014 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Linus Torvalds1da177e2005-04-16 15:20:36 -070017 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#include "xfs.h"
Christoph Hellwigdda35b82010-02-15 09:44:46 +000019#include "xfs_fs.h"
Nathan Scotta844f452005-11-02 14:38:42 +110020#include "xfs_bit.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#include "xfs_log.h"
Nathan Scotta844f452005-11-02 14:38:42 +110022#include "xfs_inum.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#include "xfs_sb.h"
Nathan Scotta844f452005-11-02 14:38:42 +110024#include "xfs_ag.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070025#include "xfs_dir2.h"
26#include "xfs_trans.h"
27#include "xfs_dmapi.h"
28#include "xfs_mount.h"
29#include "xfs_bmap_btree.h"
30#include "xfs_alloc_btree.h"
31#include "xfs_ialloc_btree.h"
32#include "xfs_alloc.h"
33#include "xfs_btree.h"
34#include "xfs_attr_sf.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070035#include "xfs_dir2_sf.h"
36#include "xfs_dinode.h"
37#include "xfs_inode.h"
Christoph Hellwigdda35b82010-02-15 09:44:46 +000038#include "xfs_bmap.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070039#include "xfs_error.h"
40#include "xfs_rw.h"
Christoph Hellwig739bfb22007-08-29 10:58:01 +100041#include "xfs_vnodeops.h"
Christoph Hellwigf999a5b2008-11-28 14:23:32 +110042#include "xfs_da_btree.h"
Christoph Hellwigddcd8562008-12-03 07:55:34 -050043#include "xfs_ioctl.h"
Christoph Hellwigdda35b82010-02-15 09:44:46 +000044#include "xfs_trace.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070045
46#include <linux/dcache.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070047
Alexey Dobriyanf0f37e2f2009-09-27 22:29:37 +040048static const struct vm_operations_struct xfs_file_vm_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -070049
Christoph Hellwigdda35b82010-02-15 09:44:46 +000050/*
51 * xfs_iozero
52 *
53 * xfs_iozero clears the specified range of buffer supplied,
54 * and marks all the affected blocks as valid and modified. If
55 * an affected block is not allocated, it will be allocated. If
56 * an affected block is not completely overwritten, and is not
57 * valid before the operation, it will be read from disk before
58 * being partially zeroed.
59 */
60STATIC int
61xfs_iozero(
62 struct xfs_inode *ip, /* inode */
63 loff_t pos, /* offset in file */
64 size_t count) /* size of data to zero */
65{
66 struct page *page;
67 struct address_space *mapping;
68 int status;
69
70 mapping = VFS_I(ip)->i_mapping;
71 do {
72 unsigned offset, bytes;
73 void *fsdata;
74
75 offset = (pos & (PAGE_CACHE_SIZE -1)); /* Within page */
76 bytes = PAGE_CACHE_SIZE - offset;
77 if (bytes > count)
78 bytes = count;
79
80 status = pagecache_write_begin(NULL, mapping, pos, bytes,
81 AOP_FLAG_UNINTERRUPTIBLE,
82 &page, &fsdata);
83 if (status)
84 break;
85
86 zero_user(page, offset, bytes);
87
88 status = pagecache_write_end(NULL, mapping, pos, bytes, bytes,
89 page, fsdata);
90 WARN_ON(status <= 0); /* can't return less than zero! */
91 pos += bytes;
92 count -= bytes;
93 status = 0;
94 } while (count);
95
96 return (-status);
97}
98
Christoph Hellwig00258e32010-02-15 09:44:47 +000099STATIC ssize_t
100xfs_file_aio_read(
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000101 struct kiocb *iocb,
102 const struct iovec *iovp,
Christoph Hellwig00258e32010-02-15 09:44:47 +0000103 unsigned long nr_segs,
104 loff_t pos)
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000105{
106 struct file *file = iocb->ki_filp;
107 struct inode *inode = file->f_mapping->host;
Christoph Hellwig00258e32010-02-15 09:44:47 +0000108 struct xfs_inode *ip = XFS_I(inode);
109 struct xfs_mount *mp = ip->i_mount;
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000110 size_t size = 0;
111 ssize_t ret = 0;
Christoph Hellwig00258e32010-02-15 09:44:47 +0000112 int ioflags = 0;
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000113 xfs_fsize_t n;
114 unsigned long seg;
115
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000116 XFS_STATS_INC(xs_read_calls);
117
Christoph Hellwig00258e32010-02-15 09:44:47 +0000118 BUG_ON(iocb->ki_pos != pos);
119
120 if (unlikely(file->f_flags & O_DIRECT))
121 ioflags |= IO_ISDIRECT;
122 if (file->f_mode & FMODE_NOCMTIME)
123 ioflags |= IO_INVIS;
124
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000125 /* START copy & waste from filemap.c */
Christoph Hellwig00258e32010-02-15 09:44:47 +0000126 for (seg = 0; seg < nr_segs; seg++) {
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000127 const struct iovec *iv = &iovp[seg];
128
129 /*
130 * If any segment has a negative length, or the cumulative
131 * length ever wraps negative then return -EINVAL.
132 */
133 size += iv->iov_len;
134 if (unlikely((ssize_t)(size|iv->iov_len) < 0))
135 return XFS_ERROR(-EINVAL);
136 }
137 /* END copy & waste from filemap.c */
138
139 if (unlikely(ioflags & IO_ISDIRECT)) {
140 xfs_buftarg_t *target =
141 XFS_IS_REALTIME_INODE(ip) ?
142 mp->m_rtdev_targp : mp->m_ddev_targp;
Christoph Hellwig00258e32010-02-15 09:44:47 +0000143 if ((iocb->ki_pos & target->bt_smask) ||
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000144 (size & target->bt_smask)) {
Christoph Hellwig00258e32010-02-15 09:44:47 +0000145 if (iocb->ki_pos == ip->i_size)
146 return 0;
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000147 return -XFS_ERROR(EINVAL);
148 }
149 }
150
Christoph Hellwig00258e32010-02-15 09:44:47 +0000151 n = XFS_MAXIOFFSET(mp) - iocb->ki_pos;
152 if (n <= 0 || size == 0)
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000153 return 0;
154
155 if (n < size)
156 size = n;
157
158 if (XFS_FORCED_SHUTDOWN(mp))
159 return -EIO;
160
161 if (unlikely(ioflags & IO_ISDIRECT))
162 mutex_lock(&inode->i_mutex);
163 xfs_ilock(ip, XFS_IOLOCK_SHARED);
164
165 if (DM_EVENT_ENABLED(ip, DM_EVENT_READ) && !(ioflags & IO_INVIS)) {
166 int dmflags = FILP_DELAY_FLAG(file) | DM_SEM_FLAG_RD(ioflags);
167 int iolock = XFS_IOLOCK_SHARED;
168
Christoph Hellwig00258e32010-02-15 09:44:47 +0000169 ret = -XFS_SEND_DATA(mp, DM_EVENT_READ, ip, iocb->ki_pos, size,
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000170 dmflags, &iolock);
171 if (ret) {
172 xfs_iunlock(ip, XFS_IOLOCK_SHARED);
173 if (unlikely(ioflags & IO_ISDIRECT))
174 mutex_unlock(&inode->i_mutex);
175 return ret;
176 }
177 }
178
179 if (unlikely(ioflags & IO_ISDIRECT)) {
Christoph Hellwig00258e32010-02-15 09:44:47 +0000180 if (inode->i_mapping->nrpages) {
181 ret = -xfs_flushinval_pages(ip,
182 (iocb->ki_pos & PAGE_CACHE_MASK),
183 -1, FI_REMAPF_LOCKED);
184 }
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000185 mutex_unlock(&inode->i_mutex);
186 if (ret) {
187 xfs_iunlock(ip, XFS_IOLOCK_SHARED);
188 return ret;
189 }
190 }
191
Christoph Hellwig00258e32010-02-15 09:44:47 +0000192 trace_xfs_file_read(ip, size, iocb->ki_pos, ioflags);
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000193
Christoph Hellwig00258e32010-02-15 09:44:47 +0000194 ret = generic_file_aio_read(iocb, iovp, nr_segs, iocb->ki_pos);
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000195 if (ret > 0)
196 XFS_STATS_ADD(xs_read_bytes, ret);
197
198 xfs_iunlock(ip, XFS_IOLOCK_SHARED);
199 return ret;
200}
201
Christoph Hellwig00258e32010-02-15 09:44:47 +0000202STATIC ssize_t
203xfs_file_splice_read(
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000204 struct file *infilp,
205 loff_t *ppos,
206 struct pipe_inode_info *pipe,
207 size_t count,
Christoph Hellwig00258e32010-02-15 09:44:47 +0000208 unsigned int flags)
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000209{
Christoph Hellwig00258e32010-02-15 09:44:47 +0000210 struct xfs_inode *ip = XFS_I(infilp->f_mapping->host);
211 struct xfs_mount *mp = ip->i_mount;
212 int ioflags = 0;
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000213 ssize_t ret;
214
215 XFS_STATS_INC(xs_read_calls);
Christoph Hellwig00258e32010-02-15 09:44:47 +0000216
217 if (infilp->f_mode & FMODE_NOCMTIME)
218 ioflags |= IO_INVIS;
219
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000220 if (XFS_FORCED_SHUTDOWN(ip->i_mount))
221 return -EIO;
222
223 xfs_ilock(ip, XFS_IOLOCK_SHARED);
224
225 if (DM_EVENT_ENABLED(ip, DM_EVENT_READ) && !(ioflags & IO_INVIS)) {
226 int iolock = XFS_IOLOCK_SHARED;
227 int error;
228
229 error = XFS_SEND_DATA(mp, DM_EVENT_READ, ip, *ppos, count,
230 FILP_DELAY_FLAG(infilp), &iolock);
231 if (error) {
232 xfs_iunlock(ip, XFS_IOLOCK_SHARED);
233 return -error;
234 }
235 }
236
237 trace_xfs_file_splice_read(ip, count, *ppos, ioflags);
238
239 ret = generic_file_splice_read(infilp, ppos, pipe, count, flags);
240 if (ret > 0)
241 XFS_STATS_ADD(xs_read_bytes, ret);
242
243 xfs_iunlock(ip, XFS_IOLOCK_SHARED);
244 return ret;
245}
246
Christoph Hellwig00258e32010-02-15 09:44:47 +0000247STATIC ssize_t
248xfs_file_splice_write(
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000249 struct pipe_inode_info *pipe,
250 struct file *outfilp,
251 loff_t *ppos,
252 size_t count,
Christoph Hellwig00258e32010-02-15 09:44:47 +0000253 unsigned int flags)
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000254{
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000255 struct inode *inode = outfilp->f_mapping->host;
Christoph Hellwig00258e32010-02-15 09:44:47 +0000256 struct xfs_inode *ip = XFS_I(inode);
257 struct xfs_mount *mp = ip->i_mount;
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000258 xfs_fsize_t isize, new_size;
Christoph Hellwig00258e32010-02-15 09:44:47 +0000259 int ioflags = 0;
260 ssize_t ret;
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000261
262 XFS_STATS_INC(xs_write_calls);
Christoph Hellwig00258e32010-02-15 09:44:47 +0000263
264 if (outfilp->f_mode & FMODE_NOCMTIME)
265 ioflags |= IO_INVIS;
266
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000267 if (XFS_FORCED_SHUTDOWN(ip->i_mount))
268 return -EIO;
269
270 xfs_ilock(ip, XFS_IOLOCK_EXCL);
271
272 if (DM_EVENT_ENABLED(ip, DM_EVENT_WRITE) && !(ioflags & IO_INVIS)) {
273 int iolock = XFS_IOLOCK_EXCL;
274 int error;
275
276 error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, ip, *ppos, count,
277 FILP_DELAY_FLAG(outfilp), &iolock);
278 if (error) {
279 xfs_iunlock(ip, XFS_IOLOCK_EXCL);
280 return -error;
281 }
282 }
283
284 new_size = *ppos + count;
285
286 xfs_ilock(ip, XFS_ILOCK_EXCL);
287 if (new_size > ip->i_size)
288 ip->i_new_size = new_size;
289 xfs_iunlock(ip, XFS_ILOCK_EXCL);
290
291 trace_xfs_file_splice_write(ip, count, *ppos, ioflags);
292
293 ret = generic_file_splice_write(pipe, outfilp, ppos, count, flags);
294 if (ret > 0)
295 XFS_STATS_ADD(xs_write_bytes, ret);
296
297 isize = i_size_read(inode);
298 if (unlikely(ret < 0 && ret != -EFAULT && *ppos > isize))
299 *ppos = isize;
300
301 if (*ppos > ip->i_size) {
302 xfs_ilock(ip, XFS_ILOCK_EXCL);
303 if (*ppos > ip->i_size)
304 ip->i_size = *ppos;
305 xfs_iunlock(ip, XFS_ILOCK_EXCL);
306 }
307
308 if (ip->i_new_size) {
309 xfs_ilock(ip, XFS_ILOCK_EXCL);
310 ip->i_new_size = 0;
311 if (ip->i_d.di_size > ip->i_size)
312 ip->i_d.di_size = ip->i_size;
313 xfs_iunlock(ip, XFS_ILOCK_EXCL);
314 }
315 xfs_iunlock(ip, XFS_IOLOCK_EXCL);
316 return ret;
317}
318
319/*
320 * This routine is called to handle zeroing any space in the last
321 * block of the file that is beyond the EOF. We do this since the
322 * size is being increased without writing anything to that block
323 * and we don't want anyone to read the garbage on the disk.
324 */
325STATIC int /* error (positive) */
326xfs_zero_last_block(
327 xfs_inode_t *ip,
328 xfs_fsize_t offset,
329 xfs_fsize_t isize)
330{
331 xfs_fileoff_t last_fsb;
332 xfs_mount_t *mp = ip->i_mount;
333 int nimaps;
334 int zero_offset;
335 int zero_len;
336 int error = 0;
337 xfs_bmbt_irec_t imap;
338
339 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
340
341 zero_offset = XFS_B_FSB_OFFSET(mp, isize);
342 if (zero_offset == 0) {
343 /*
344 * There are no extra bytes in the last block on disk to
345 * zero, so return.
346 */
347 return 0;
348 }
349
350 last_fsb = XFS_B_TO_FSBT(mp, isize);
351 nimaps = 1;
352 error = xfs_bmapi(NULL, ip, last_fsb, 1, 0, NULL, 0, &imap,
353 &nimaps, NULL, NULL);
354 if (error) {
355 return error;
356 }
357 ASSERT(nimaps > 0);
358 /*
359 * If the block underlying isize is just a hole, then there
360 * is nothing to zero.
361 */
362 if (imap.br_startblock == HOLESTARTBLOCK) {
363 return 0;
364 }
365 /*
366 * Zero the part of the last block beyond the EOF, and write it
367 * out sync. We need to drop the ilock while we do this so we
368 * don't deadlock when the buffer cache calls back to us.
369 */
370 xfs_iunlock(ip, XFS_ILOCK_EXCL);
371
372 zero_len = mp->m_sb.sb_blocksize - zero_offset;
373 if (isize + zero_len > offset)
374 zero_len = offset - isize;
375 error = xfs_iozero(ip, isize, zero_len);
376
377 xfs_ilock(ip, XFS_ILOCK_EXCL);
378 ASSERT(error >= 0);
379 return error;
380}
381
382/*
383 * Zero any on disk space between the current EOF and the new,
384 * larger EOF. This handles the normal case of zeroing the remainder
385 * of the last block in the file and the unusual case of zeroing blocks
386 * out beyond the size of the file. This second case only happens
387 * with fixed size extents and when the system crashes before the inode
388 * size was updated but after blocks were allocated. If fill is set,
389 * then any holes in the range are filled and zeroed. If not, the holes
390 * are left alone as holes.
391 */
392
393int /* error (positive) */
394xfs_zero_eof(
395 xfs_inode_t *ip,
396 xfs_off_t offset, /* starting I/O offset */
397 xfs_fsize_t isize) /* current inode size */
398{
399 xfs_mount_t *mp = ip->i_mount;
400 xfs_fileoff_t start_zero_fsb;
401 xfs_fileoff_t end_zero_fsb;
402 xfs_fileoff_t zero_count_fsb;
403 xfs_fileoff_t last_fsb;
404 xfs_fileoff_t zero_off;
405 xfs_fsize_t zero_len;
406 int nimaps;
407 int error = 0;
408 xfs_bmbt_irec_t imap;
409
410 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_IOLOCK_EXCL));
411 ASSERT(offset > isize);
412
413 /*
414 * First handle zeroing the block on which isize resides.
415 * We only zero a part of that block so it is handled specially.
416 */
417 error = xfs_zero_last_block(ip, offset, isize);
418 if (error) {
419 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_IOLOCK_EXCL));
420 return error;
421 }
422
423 /*
424 * Calculate the range between the new size and the old
425 * where blocks needing to be zeroed may exist. To get the
426 * block where the last byte in the file currently resides,
427 * we need to subtract one from the size and truncate back
428 * to a block boundary. We subtract 1 in case the size is
429 * exactly on a block boundary.
430 */
431 last_fsb = isize ? XFS_B_TO_FSBT(mp, isize - 1) : (xfs_fileoff_t)-1;
432 start_zero_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)isize);
433 end_zero_fsb = XFS_B_TO_FSBT(mp, offset - 1);
434 ASSERT((xfs_sfiloff_t)last_fsb < (xfs_sfiloff_t)start_zero_fsb);
435 if (last_fsb == end_zero_fsb) {
436 /*
437 * The size was only incremented on its last block.
438 * We took care of that above, so just return.
439 */
440 return 0;
441 }
442
443 ASSERT(start_zero_fsb <= end_zero_fsb);
444 while (start_zero_fsb <= end_zero_fsb) {
445 nimaps = 1;
446 zero_count_fsb = end_zero_fsb - start_zero_fsb + 1;
447 error = xfs_bmapi(NULL, ip, start_zero_fsb, zero_count_fsb,
448 0, NULL, 0, &imap, &nimaps, NULL, NULL);
449 if (error) {
450 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_IOLOCK_EXCL));
451 return error;
452 }
453 ASSERT(nimaps > 0);
454
455 if (imap.br_state == XFS_EXT_UNWRITTEN ||
456 imap.br_startblock == HOLESTARTBLOCK) {
457 /*
458 * This loop handles initializing pages that were
459 * partially initialized by the code below this
460 * loop. It basically zeroes the part of the page
461 * that sits on a hole and sets the page as P_HOLE
462 * and calls remapf if it is a mapped file.
463 */
464 start_zero_fsb = imap.br_startoff + imap.br_blockcount;
465 ASSERT(start_zero_fsb <= (end_zero_fsb + 1));
466 continue;
467 }
468
469 /*
470 * There are blocks we need to zero.
471 * Drop the inode lock while we're doing the I/O.
472 * We'll still have the iolock to protect us.
473 */
474 xfs_iunlock(ip, XFS_ILOCK_EXCL);
475
476 zero_off = XFS_FSB_TO_B(mp, start_zero_fsb);
477 zero_len = XFS_FSB_TO_B(mp, imap.br_blockcount);
478
479 if ((zero_off + zero_len) > offset)
480 zero_len = offset - zero_off;
481
482 error = xfs_iozero(ip, zero_off, zero_len);
483 if (error) {
484 goto out_lock;
485 }
486
487 start_zero_fsb = imap.br_startoff + imap.br_blockcount;
488 ASSERT(start_zero_fsb <= (end_zero_fsb + 1));
489
490 xfs_ilock(ip, XFS_ILOCK_EXCL);
491 }
492
493 return 0;
494
495out_lock:
496 xfs_ilock(ip, XFS_ILOCK_EXCL);
497 ASSERT(error >= 0);
498 return error;
499}
500
Christoph Hellwig00258e32010-02-15 09:44:47 +0000501STATIC ssize_t
502xfs_file_aio_write(
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000503 struct kiocb *iocb,
504 const struct iovec *iovp,
Christoph Hellwig00258e32010-02-15 09:44:47 +0000505 unsigned long nr_segs,
506 loff_t pos)
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000507{
508 struct file *file = iocb->ki_filp;
509 struct address_space *mapping = file->f_mapping;
510 struct inode *inode = mapping->host;
Christoph Hellwig00258e32010-02-15 09:44:47 +0000511 struct xfs_inode *ip = XFS_I(inode);
512 struct xfs_mount *mp = ip->i_mount;
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000513 ssize_t ret = 0, error = 0;
Christoph Hellwig00258e32010-02-15 09:44:47 +0000514 int ioflags = 0;
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000515 xfs_fsize_t isize, new_size;
516 int iolock;
517 int eventsent = 0;
518 size_t ocount = 0, count;
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000519 int need_i_mutex;
520
521 XFS_STATS_INC(xs_write_calls);
522
Christoph Hellwig00258e32010-02-15 09:44:47 +0000523 BUG_ON(iocb->ki_pos != pos);
524
525 if (unlikely(file->f_flags & O_DIRECT))
526 ioflags |= IO_ISDIRECT;
527 if (file->f_mode & FMODE_NOCMTIME)
528 ioflags |= IO_INVIS;
529
530 error = generic_segment_checks(iovp, &nr_segs, &ocount, VERIFY_READ);
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000531 if (error)
532 return error;
533
534 count = ocount;
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000535 if (count == 0)
536 return 0;
537
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000538 xfs_wait_for_freeze(mp, SB_FREEZE_WRITE);
539
540 if (XFS_FORCED_SHUTDOWN(mp))
541 return -EIO;
542
543relock:
544 if (ioflags & IO_ISDIRECT) {
545 iolock = XFS_IOLOCK_SHARED;
546 need_i_mutex = 0;
547 } else {
548 iolock = XFS_IOLOCK_EXCL;
549 need_i_mutex = 1;
550 mutex_lock(&inode->i_mutex);
551 }
552
Christoph Hellwig00258e32010-02-15 09:44:47 +0000553 xfs_ilock(ip, XFS_ILOCK_EXCL|iolock);
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000554
555start:
556 error = -generic_write_checks(file, &pos, &count,
557 S_ISBLK(inode->i_mode));
558 if (error) {
Christoph Hellwig00258e32010-02-15 09:44:47 +0000559 xfs_iunlock(ip, XFS_ILOCK_EXCL|iolock);
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000560 goto out_unlock_mutex;
561 }
562
Christoph Hellwig00258e32010-02-15 09:44:47 +0000563 if ((DM_EVENT_ENABLED(ip, DM_EVENT_WRITE) &&
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000564 !(ioflags & IO_INVIS) && !eventsent)) {
565 int dmflags = FILP_DELAY_FLAG(file);
566
567 if (need_i_mutex)
568 dmflags |= DM_FLAGS_IMUX;
569
Christoph Hellwig00258e32010-02-15 09:44:47 +0000570 xfs_iunlock(ip, XFS_ILOCK_EXCL);
571 error = XFS_SEND_DATA(ip->i_mount, DM_EVENT_WRITE, ip,
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000572 pos, count, dmflags, &iolock);
573 if (error) {
574 goto out_unlock_internal;
575 }
Christoph Hellwig00258e32010-02-15 09:44:47 +0000576 xfs_ilock(ip, XFS_ILOCK_EXCL);
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000577 eventsent = 1;
578
579 /*
580 * The iolock was dropped and reacquired in XFS_SEND_DATA
581 * so we have to recheck the size when appending.
582 * We will only "goto start;" once, since having sent the
583 * event prevents another call to XFS_SEND_DATA, which is
584 * what allows the size to change in the first place.
585 */
Christoph Hellwig00258e32010-02-15 09:44:47 +0000586 if ((file->f_flags & O_APPEND) && pos != ip->i_size)
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000587 goto start;
588 }
589
590 if (ioflags & IO_ISDIRECT) {
591 xfs_buftarg_t *target =
Christoph Hellwig00258e32010-02-15 09:44:47 +0000592 XFS_IS_REALTIME_INODE(ip) ?
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000593 mp->m_rtdev_targp : mp->m_ddev_targp;
594
595 if ((pos & target->bt_smask) || (count & target->bt_smask)) {
Christoph Hellwig00258e32010-02-15 09:44:47 +0000596 xfs_iunlock(ip, XFS_ILOCK_EXCL|iolock);
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000597 return XFS_ERROR(-EINVAL);
598 }
599
Christoph Hellwig00258e32010-02-15 09:44:47 +0000600 if (!need_i_mutex && (mapping->nrpages || pos > ip->i_size)) {
601 xfs_iunlock(ip, XFS_ILOCK_EXCL|iolock);
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000602 iolock = XFS_IOLOCK_EXCL;
603 need_i_mutex = 1;
604 mutex_lock(&inode->i_mutex);
Christoph Hellwig00258e32010-02-15 09:44:47 +0000605 xfs_ilock(ip, XFS_ILOCK_EXCL|iolock);
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000606 goto start;
607 }
608 }
609
610 new_size = pos + count;
Christoph Hellwig00258e32010-02-15 09:44:47 +0000611 if (new_size > ip->i_size)
612 ip->i_new_size = new_size;
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000613
614 if (likely(!(ioflags & IO_INVIS)))
615 file_update_time(file);
616
617 /*
618 * If the offset is beyond the size of the file, we have a couple
619 * of things to do. First, if there is already space allocated
620 * we need to either create holes or zero the disk or ...
621 *
622 * If there is a page where the previous size lands, we need
623 * to zero it out up to the new size.
624 */
625
Christoph Hellwig00258e32010-02-15 09:44:47 +0000626 if (pos > ip->i_size) {
627 error = xfs_zero_eof(ip, pos, ip->i_size);
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000628 if (error) {
Christoph Hellwig00258e32010-02-15 09:44:47 +0000629 xfs_iunlock(ip, XFS_ILOCK_EXCL);
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000630 goto out_unlock_internal;
631 }
632 }
Christoph Hellwig00258e32010-02-15 09:44:47 +0000633 xfs_iunlock(ip, XFS_ILOCK_EXCL);
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000634
635 /*
636 * If we're writing the file then make sure to clear the
637 * setuid and setgid bits if the process is not being run
638 * by root. This keeps people from modifying setuid and
639 * setgid binaries.
640 */
641 error = -file_remove_suid(file);
642 if (unlikely(error))
643 goto out_unlock_internal;
644
645 /* We can write back this queue in page reclaim */
646 current->backing_dev_info = mapping->backing_dev_info;
647
648 if ((ioflags & IO_ISDIRECT)) {
649 if (mapping->nrpages) {
650 WARN_ON(need_i_mutex == 0);
Christoph Hellwig00258e32010-02-15 09:44:47 +0000651 error = xfs_flushinval_pages(ip,
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000652 (pos & PAGE_CACHE_MASK),
653 -1, FI_REMAPF_LOCKED);
654 if (error)
655 goto out_unlock_internal;
656 }
657
658 if (need_i_mutex) {
659 /* demote the lock now the cached pages are gone */
Christoph Hellwig00258e32010-02-15 09:44:47 +0000660 xfs_ilock_demote(ip, XFS_IOLOCK_EXCL);
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000661 mutex_unlock(&inode->i_mutex);
662
663 iolock = XFS_IOLOCK_SHARED;
664 need_i_mutex = 0;
665 }
666
Christoph Hellwig00258e32010-02-15 09:44:47 +0000667 trace_xfs_file_direct_write(ip, count, iocb->ki_pos, ioflags);
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000668 ret = generic_file_direct_write(iocb, iovp,
Christoph Hellwig00258e32010-02-15 09:44:47 +0000669 &nr_segs, pos, &iocb->ki_pos, count, ocount);
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000670
671 /*
672 * direct-io write to a hole: fall through to buffered I/O
673 * for completing the rest of the request.
674 */
675 if (ret >= 0 && ret != count) {
676 XFS_STATS_ADD(xs_write_bytes, ret);
677
678 pos += ret;
679 count -= ret;
680
681 ioflags &= ~IO_ISDIRECT;
Christoph Hellwig00258e32010-02-15 09:44:47 +0000682 xfs_iunlock(ip, iolock);
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000683 goto relock;
684 }
685 } else {
686 int enospc = 0;
687 ssize_t ret2 = 0;
688
689write_retry:
Christoph Hellwig00258e32010-02-15 09:44:47 +0000690 trace_xfs_file_buffered_write(ip, count, iocb->ki_pos, ioflags);
691 ret2 = generic_file_buffered_write(iocb, iovp, nr_segs,
692 pos, &iocb->ki_pos, count, ret);
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000693 /*
694 * if we just got an ENOSPC, flush the inode now we
695 * aren't holding any page locks and retry *once*
696 */
697 if (ret2 == -ENOSPC && !enospc) {
Christoph Hellwig00258e32010-02-15 09:44:47 +0000698 error = xfs_flush_pages(ip, 0, -1, 0, FI_NONE);
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000699 if (error)
700 goto out_unlock_internal;
701 enospc = 1;
702 goto write_retry;
703 }
704 ret = ret2;
705 }
706
707 current->backing_dev_info = NULL;
708
709 isize = i_size_read(inode);
Christoph Hellwig00258e32010-02-15 09:44:47 +0000710 if (unlikely(ret < 0 && ret != -EFAULT && iocb->ki_pos > isize))
711 iocb->ki_pos = isize;
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000712
Christoph Hellwig00258e32010-02-15 09:44:47 +0000713 if (iocb->ki_pos > ip->i_size) {
714 xfs_ilock(ip, XFS_ILOCK_EXCL);
715 if (iocb->ki_pos > ip->i_size)
716 ip->i_size = iocb->ki_pos;
717 xfs_iunlock(ip, XFS_ILOCK_EXCL);
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000718 }
719
720 if (ret == -ENOSPC &&
Christoph Hellwig00258e32010-02-15 09:44:47 +0000721 DM_EVENT_ENABLED(ip, DM_EVENT_NOSPACE) && !(ioflags & IO_INVIS)) {
722 xfs_iunlock(ip, iolock);
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000723 if (need_i_mutex)
724 mutex_unlock(&inode->i_mutex);
Christoph Hellwig00258e32010-02-15 09:44:47 +0000725 error = XFS_SEND_NAMESP(ip->i_mount, DM_EVENT_NOSPACE, ip,
726 DM_RIGHT_NULL, ip, DM_RIGHT_NULL, NULL, NULL,
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000727 0, 0, 0); /* Delay flag intentionally unused */
728 if (need_i_mutex)
729 mutex_lock(&inode->i_mutex);
Christoph Hellwig00258e32010-02-15 09:44:47 +0000730 xfs_ilock(ip, iolock);
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000731 if (error)
732 goto out_unlock_internal;
733 goto start;
734 }
735
736 error = -ret;
737 if (ret <= 0)
738 goto out_unlock_internal;
739
740 XFS_STATS_ADD(xs_write_bytes, ret);
741
742 /* Handle various SYNC-type writes */
743 if ((file->f_flags & O_DSYNC) || IS_SYNC(inode)) {
744 loff_t end = pos + ret - 1;
745 int error2;
746
Christoph Hellwig00258e32010-02-15 09:44:47 +0000747 xfs_iunlock(ip, iolock);
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000748 if (need_i_mutex)
749 mutex_unlock(&inode->i_mutex);
750
751 error2 = filemap_write_and_wait_range(mapping, pos, end);
752 if (!error)
753 error = error2;
754 if (need_i_mutex)
755 mutex_lock(&inode->i_mutex);
Christoph Hellwig00258e32010-02-15 09:44:47 +0000756 xfs_ilock(ip, iolock);
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000757
Christoph Hellwig00258e32010-02-15 09:44:47 +0000758 error2 = xfs_fsync(ip);
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000759 if (!error)
760 error = error2;
761 }
762
763 out_unlock_internal:
Christoph Hellwig00258e32010-02-15 09:44:47 +0000764 if (ip->i_new_size) {
765 xfs_ilock(ip, XFS_ILOCK_EXCL);
766 ip->i_new_size = 0;
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000767 /*
768 * If this was a direct or synchronous I/O that failed (such
769 * as ENOSPC) then part of the I/O may have been written to
770 * disk before the error occured. In this case the on-disk
771 * file size may have been adjusted beyond the in-memory file
772 * size and now needs to be truncated back.
773 */
Christoph Hellwig00258e32010-02-15 09:44:47 +0000774 if (ip->i_d.di_size > ip->i_size)
775 ip->i_d.di_size = ip->i_size;
776 xfs_iunlock(ip, XFS_ILOCK_EXCL);
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000777 }
Christoph Hellwig00258e32010-02-15 09:44:47 +0000778 xfs_iunlock(ip, iolock);
Christoph Hellwigdda35b82010-02-15 09:44:46 +0000779 out_unlock_mutex:
780 if (need_i_mutex)
781 mutex_unlock(&inode->i_mutex);
782 return -error;
783}
784
Linus Torvalds1da177e2005-04-16 15:20:36 -0700785STATIC int
Nathan Scott3562fd42006-03-14 14:00:35 +1100786xfs_file_open(
Linus Torvalds1da177e2005-04-16 15:20:36 -0700787 struct inode *inode,
Christoph Hellwigf999a5b2008-11-28 14:23:32 +1100788 struct file *file)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700789{
Christoph Hellwigf999a5b2008-11-28 14:23:32 +1100790 if (!(file->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700791 return -EFBIG;
Christoph Hellwigf999a5b2008-11-28 14:23:32 +1100792 if (XFS_FORCED_SHUTDOWN(XFS_M(inode->i_sb)))
793 return -EIO;
794 return 0;
795}
796
797STATIC int
798xfs_dir_open(
799 struct inode *inode,
800 struct file *file)
801{
802 struct xfs_inode *ip = XFS_I(inode);
803 int mode;
804 int error;
805
806 error = xfs_file_open(inode, file);
807 if (error)
808 return error;
809
810 /*
811 * If there are any blocks, read-ahead block 0 as we're almost
812 * certain to have the next operation be a read there.
813 */
814 mode = xfs_ilock_map_shared(ip);
815 if (ip->i_d.di_nextents > 0)
816 xfs_da_reada_buf(NULL, ip, 0, XFS_DATA_FORK);
817 xfs_iunlock(ip, mode);
818 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700819}
820
Linus Torvalds1da177e2005-04-16 15:20:36 -0700821STATIC int
Nathan Scott3562fd42006-03-14 14:00:35 +1100822xfs_file_release(
Linus Torvalds1da177e2005-04-16 15:20:36 -0700823 struct inode *inode,
824 struct file *filp)
825{
Christoph Hellwig739bfb22007-08-29 10:58:01 +1000826 return -xfs_release(XFS_I(inode));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700827}
828
David Chinner978b7232008-05-19 16:29:46 +1000829/*
830 * We ignore the datasync flag here because a datasync is effectively
831 * identical to an fsync. That is, datasync implies that we need to write
832 * only the metadata needed to be able to access the data that is written
833 * if we crash after the call completes. Hence if we are writing beyond
834 * EOF we have to log the inode size change as well, which makes it a
835 * full fsync. If we don't write beyond EOF, the inode core will be
836 * clean in memory and so we don't need to log the inode, just like
837 * fsync.
838 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700839STATIC int
Nathan Scott3562fd42006-03-14 14:00:35 +1100840xfs_file_fsync(
Christoph Hellwig13e6d5c2009-08-31 21:00:31 -0300841 struct file *file,
842 struct dentry *dentry,
843 int datasync)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700844{
Christoph Hellwigd0800702009-09-26 19:55:04 +0000845 struct xfs_inode *ip = XFS_I(dentry->d_inode);
Christoph Hellwig13e6d5c2009-08-31 21:00:31 -0300846
847 xfs_iflags_clear(ip, XFS_ITRUNCATED);
848 return -xfs_fsync(ip);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700849}
850
Linus Torvalds1da177e2005-04-16 15:20:36 -0700851STATIC int
Nathan Scott3562fd42006-03-14 14:00:35 +1100852xfs_file_readdir(
Linus Torvalds1da177e2005-04-16 15:20:36 -0700853 struct file *filp,
854 void *dirent,
855 filldir_t filldir)
856{
Christoph Hellwig051e7cd2007-08-28 13:58:24 +1000857 struct inode *inode = filp->f_path.dentry->d_inode;
Christoph Hellwig739bfb22007-08-29 10:58:01 +1000858 xfs_inode_t *ip = XFS_I(inode);
Christoph Hellwig051e7cd2007-08-28 13:58:24 +1000859 int error;
860 size_t bufsize;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700861
Christoph Hellwig051e7cd2007-08-28 13:58:24 +1000862 /*
863 * The Linux API doesn't pass down the total size of the buffer
864 * we read into down to the filesystem. With the filldir concept
865 * it's not needed for correct information, but the XFS dir2 leaf
866 * code wants an estimate of the buffer size to calculate it's
867 * readahead window and size the buffers used for mapping to
868 * physical blocks.
869 *
870 * Try to give it an estimate that's good enough, maybe at some
871 * point we can change the ->readdir prototype to include the
Eric Sandeena9cc7992010-02-03 17:50:13 +0000872 * buffer size. For now we use the current glibc buffer size.
Christoph Hellwig051e7cd2007-08-28 13:58:24 +1000873 */
Eric Sandeena9cc7992010-02-03 17:50:13 +0000874 bufsize = (size_t)min_t(loff_t, 32768, ip->i_d.di_size);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700875
Christoph Hellwig739bfb22007-08-29 10:58:01 +1000876 error = xfs_readdir(ip, dirent, bufsize,
Christoph Hellwig051e7cd2007-08-28 13:58:24 +1000877 (xfs_off_t *)&filp->f_pos, filldir);
878 if (error)
879 return -error;
880 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700881}
882
Linus Torvalds1da177e2005-04-16 15:20:36 -0700883STATIC int
Nathan Scott3562fd42006-03-14 14:00:35 +1100884xfs_file_mmap(
Linus Torvalds1da177e2005-04-16 15:20:36 -0700885 struct file *filp,
886 struct vm_area_struct *vma)
887{
Nathan Scott3562fd42006-03-14 14:00:35 +1100888 vma->vm_ops = &xfs_file_vm_ops;
Nick Piggind0217ac2007-07-19 01:47:03 -0700889 vma->vm_flags |= VM_CAN_NONLINEAR;
Dean Roehrich6fac0cb2005-06-21 14:07:45 +1000890
Nathan Scottfbc14622006-06-09 14:52:13 +1000891 file_accessed(filp);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700892 return 0;
893}
894
David Chinner4f57dbc2007-07-19 16:28:17 +1000895/*
896 * mmap()d file has taken write protection fault and is being made
897 * writable. We can set the page state up correctly for a writable
898 * page, which means we can do correct delalloc accounting (ENOSPC
899 * checking!) and unwritten extent mapping.
900 */
901STATIC int
902xfs_vm_page_mkwrite(
903 struct vm_area_struct *vma,
Nick Pigginc2ec1752009-03-31 15:23:21 -0700904 struct vm_fault *vmf)
David Chinner4f57dbc2007-07-19 16:28:17 +1000905{
Nick Pigginc2ec1752009-03-31 15:23:21 -0700906 return block_page_mkwrite(vma, vmf, xfs_get_blocks);
David Chinner4f57dbc2007-07-19 16:28:17 +1000907}
908
Arjan van de Ven4b6f5d22006-03-28 01:56:42 -0800909const struct file_operations xfs_file_operations = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700910 .llseek = generic_file_llseek,
911 .read = do_sync_read,
Dean Roehrichbb3f7242005-09-02 15:43:05 +1000912 .write = do_sync_write,
Nathan Scott3562fd42006-03-14 14:00:35 +1100913 .aio_read = xfs_file_aio_read,
914 .aio_write = xfs_file_aio_write,
Nathan Scott1b895842006-03-31 13:08:59 +1000915 .splice_read = xfs_file_splice_read,
916 .splice_write = xfs_file_splice_write,
Nathan Scott3562fd42006-03-14 14:00:35 +1100917 .unlocked_ioctl = xfs_file_ioctl,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700918#ifdef CONFIG_COMPAT
Nathan Scott3562fd42006-03-14 14:00:35 +1100919 .compat_ioctl = xfs_file_compat_ioctl,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700920#endif
Nathan Scott3562fd42006-03-14 14:00:35 +1100921 .mmap = xfs_file_mmap,
922 .open = xfs_file_open,
923 .release = xfs_file_release,
924 .fsync = xfs_file_fsync,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700925#ifdef HAVE_FOP_OPEN_EXEC
Nathan Scott3562fd42006-03-14 14:00:35 +1100926 .open_exec = xfs_file_open_exec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700927#endif
928};
929
Arjan van de Ven4b6f5d22006-03-28 01:56:42 -0800930const struct file_operations xfs_dir_file_operations = {
Christoph Hellwigf999a5b2008-11-28 14:23:32 +1100931 .open = xfs_dir_open,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700932 .read = generic_read_dir,
Nathan Scott3562fd42006-03-14 14:00:35 +1100933 .readdir = xfs_file_readdir,
Al Viro59af1582008-08-24 07:24:41 -0400934 .llseek = generic_file_llseek,
Nathan Scott3562fd42006-03-14 14:00:35 +1100935 .unlocked_ioctl = xfs_file_ioctl,
Nathan Scottd3870392005-05-06 06:44:46 -0700936#ifdef CONFIG_COMPAT
Nathan Scott3562fd42006-03-14 14:00:35 +1100937 .compat_ioctl = xfs_file_compat_ioctl,
Nathan Scottd3870392005-05-06 06:44:46 -0700938#endif
Nathan Scott3562fd42006-03-14 14:00:35 +1100939 .fsync = xfs_file_fsync,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700940};
941
Alexey Dobriyanf0f37e2f2009-09-27 22:29:37 +0400942static const struct vm_operations_struct xfs_file_vm_ops = {
Nick Piggin54cb8822007-07-19 01:46:59 -0700943 .fault = filemap_fault,
David Chinner4f57dbc2007-07-19 16:28:17 +1000944 .page_mkwrite = xfs_vm_page_mkwrite,
Dean Roehrich6fac0cb2005-06-21 14:07:45 +1000945};