Blame view

fs/jfs/inode.c 9.79 KB
1a59d1b8e   Thomas Gleixner   treewide: Replace...
1
  // SPDX-License-Identifier: GPL-2.0-or-later
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2
3
4
  /*
   *   Copyright (C) International Business Machines Corp., 2000-2004
   *   Portions Copyright (C) Christoph Hellwig, 2001-2002
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
5
6
7
8
9
10
11
   */
  
  #include <linux/fs.h>
  #include <linux/mpage.h>
  #include <linux/buffer_head.h>
  #include <linux/pagemap.h>
  #include <linux/quotaops.h>
e2e40f2c1   Christoph Hellwig   fs: move struct k...
12
  #include <linux/uio.h>
a9185b41a   Christoph Hellwig   pass writeback_co...
13
  #include <linux/writeback.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
14
  #include "jfs_incore.h"
1868f4aa5   Dave Kleikamp   JFS: fix sparse w...
15
  #include "jfs_inode.h"
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
16
17
18
19
20
  #include "jfs_filsys.h"
  #include "jfs_imap.h"
  #include "jfs_extent.h"
  #include "jfs_unicode.h"
  #include "jfs_debug.h"
b3b4a6e35   Al Viro   jfs: switch to ->...
21
  #include "jfs_dmap.h"
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
22

eab1df71a   David Howells   iget: stop JFS fr...
23
  struct inode *jfs_iget(struct super_block *sb, unsigned long ino)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
24
  {
eab1df71a   David Howells   iget: stop JFS fr...
25
26
27
28
29
30
31
32
33
34
35
36
37
  	struct inode *inode;
  	int ret;
  
  	inode = iget_locked(sb, ino);
  	if (!inode)
  		return ERR_PTR(-ENOMEM);
  	if (!(inode->i_state & I_NEW))
  		return inode;
  
  	ret = diRead(inode);
  	if (ret < 0) {
  		iget_failed(inode);
  		return ERR_PTR(ret);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
38
39
40
41
42
43
44
45
46
47
48
49
  	}
  
  	if (S_ISREG(inode->i_mode)) {
  		inode->i_op = &jfs_file_inode_operations;
  		inode->i_fop = &jfs_file_operations;
  		inode->i_mapping->a_ops = &jfs_aops;
  	} else if (S_ISDIR(inode->i_mode)) {
  		inode->i_op = &jfs_dir_inode_operations;
  		inode->i_fop = &jfs_dir_operations;
  	} else if (S_ISLNK(inode->i_mode)) {
  		if (inode->i_size >= IDATASIZE) {
  			inode->i_op = &page_symlink_inode_operations;
21fc61c73   Al Viro   don't put symlink...
50
  			inode_nohighmem(inode);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
51
  			inode->i_mapping->a_ops = &jfs_aops;
d69e83d99   Dave Kleikamp   jfs: ensure symli...
52
  		} else {
c7f2e1f0a   Dmitry Monakhov   jfs: add jfs spec...
53
  			inode->i_op = &jfs_fast_symlink_inode_operations;
ad476fedc   Al Viro   jfs: switch to si...
54
  			inode->i_link = JFS_IP(inode)->i_inline;
d69e83d99   Dave Kleikamp   jfs: ensure symli...
55
56
57
58
  			/*
  			 * The inline data should be null-terminated, but
  			 * don't let on-disk corruption crash the kernel
  			 */
ad476fedc   Al Viro   jfs: switch to si...
59
  			inode->i_link[inode->i_size] = '\0';
d69e83d99   Dave Kleikamp   jfs: ensure symli...
60
  		}
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
61
62
63
64
  	} else {
  		inode->i_op = &jfs_file_inode_operations;
  		init_special_inode(inode, inode->i_mode, inode->i_rdev);
  	}
eab1df71a   David Howells   iget: stop JFS fr...
65
66
  	unlock_new_inode(inode);
  	return inode;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
  }
  
  /*
   * Workhorse of both fsync & write_inode
   */
  int jfs_commit_inode(struct inode *inode, int wait)
  {
  	int rc = 0;
  	tid_t tid;
  	static int noisy = 5;
  
  	jfs_info("In jfs_commit_inode, inode = 0x%p", inode);
  
  	/*
  	 * Don't commit if inode has been committed since last being
  	 * marked dirty, or if it has been deleted.
  	 */
  	if (inode->i_nlink == 0 || !test_cflag(COMMIT_Dirty, inode))
  		return 0;
  
  	if (isReadOnly(inode)) {
  		/* kernel allows writes to devices on read-only
  		 * partitions and may think inode is dirty
  		 */
  		if (!special_file(inode->i_mode) && noisy) {
6ed71e981   Joe Perches   jfs: Coalesce som...
92
93
  			jfs_err("jfs_commit_inode(0x%p) called on read-only volume",
  				inode);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
94
95
96
97
98
99
100
  			jfs_err("Is remount racy?");
  			noisy--;
  		}
  		return 0;
  	}
  
  	tid = txBegin(inode->i_sb, COMMIT_INODE);
1de87444f   Ingo Molnar   JFS: semaphore to...
101
  	mutex_lock(&JFS_IP(inode)->commit_mutex);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
102
103
  
  	/*
1de87444f   Ingo Molnar   JFS: semaphore to...
104
  	 * Retest inode state after taking commit_mutex
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
105
106
107
108
109
  	 */
  	if (inode->i_nlink && test_cflag(COMMIT_Dirty, inode))
  		rc = txCommit(tid, 1, &inode, wait ? COMMIT_SYNC : 0);
  
  	txEnd(tid);
1de87444f   Ingo Molnar   JFS: semaphore to...
110
  	mutex_unlock(&JFS_IP(inode)->commit_mutex);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
111
112
  	return rc;
  }
a9185b41a   Christoph Hellwig   pass writeback_co...
113
  int jfs_write_inode(struct inode *inode, struct writeback_control *wbc)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
114
  {
a9185b41a   Christoph Hellwig   pass writeback_co...
115
  	int wait = wbc->sync_mode == WB_SYNC_ALL;
73aaa22d5   Dave Kleikamp   jfs: fix a couple...
116
  	if (inode->i_nlink == 0)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
117
118
119
120
121
122
  		return 0;
  	/*
  	 * If COMMIT_DIRTY is not set, the inode isn't really dirty.
  	 * It has been committed since the last change, but was still
  	 * on the dirty inode list.
  	 */
f7f31adf0   Colin Ian King   jfs: fix indentat...
123
  	if (!test_cflag(COMMIT_Dirty, inode)) {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
124
125
126
  		/* Make sure committed changes hit the disk */
  		jfs_flush_journal(JFS_SBI(inode->i_sb)->log, wait);
  		return 0;
f7f31adf0   Colin Ian King   jfs: fix indentat...
127
  	}
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
128
129
130
131
132
133
134
  
  	if (jfs_commit_inode(inode, wait)) {
  		jfs_err("jfs_write_inode: jfs_commit_inode failed!");
  		return -EIO;
  	} else
  		return 0;
  }
62aff86fd   Al Viro   switch jfs to ->e...
135
  void jfs_evict_inode(struct inode *inode)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
136
  {
b3b4a6e35   Al Viro   jfs: switch to ->...
137
  	struct jfs_inode_info *ji = JFS_IP(inode);
62aff86fd   Al Viro   switch jfs to ->e...
138
  	jfs_info("In jfs_evict_inode, inode = 0x%p", inode);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
139

62aff86fd   Al Viro   switch jfs to ->e...
140
  	if (!inode->i_nlink && !is_bad_inode(inode)) {
871a29315   Christoph Hellwig   dquot: cleanup dq...
141
  		dquot_initialize(inode);
907f4554e   Christoph Hellwig   dquot: move dquot...
142

62aff86fd   Al Viro   switch jfs to ->e...
143
  		if (JFS_IP(inode)->fileset == FILESYSTEM_I) {
91b0abe36   Johannes Weiner   mm + fs: store sh...
144
  			truncate_inode_pages_final(&inode->i_data);
fef266580   Mark Fasheh   [PATCH] update fi...
145

62aff86fd   Al Viro   switch jfs to ->e...
146
147
  			if (test_cflag(COMMIT_Freewmap, inode))
  				jfs_free_zero_link(inode);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
148

62aff86fd   Al Viro   switch jfs to ->e...
149
  			diFree(inode);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
150

62aff86fd   Al Viro   switch jfs to ->e...
151
152
153
  			/*
  			 * Free the inode from the quota allocation.
  			 */
62aff86fd   Al Viro   switch jfs to ->e...
154
155
156
  			dquot_free_inode(inode);
  		}
  	} else {
91b0abe36   Johannes Weiner   mm + fs: store sh...
157
  		truncate_inode_pages_final(&inode->i_data);
b1b5d7f9b   Dave Kleikamp   JFS: jfs_delete_i...
158
  	}
dbd5768f8   Jan Kara   vfs: Rename end_w...
159
  	clear_inode(inode);
62aff86fd   Al Viro   switch jfs to ->e...
160
  	dquot_drop(inode);
b3b4a6e35   Al Viro   jfs: switch to ->...
161
162
163
164
165
166
167
168
169
170
  
  	BUG_ON(!list_empty(&ji->anon_inode_list));
  
  	spin_lock_irq(&ji->ag_lock);
  	if (ji->active_ag != -1) {
  		struct bmap *bmap = JFS_SBI(inode->i_sb)->bmap;
  		atomic_dec(&bmap->db_active[ji->active_ag]);
  		ji->active_ag = -1;
  	}
  	spin_unlock_irq(&ji->ag_lock);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
171
  }
aa3857295   Christoph Hellwig   fs: pass exact ty...
172
  void jfs_dirty_inode(struct inode *inode, int flags)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
  {
  	static int noisy = 5;
  
  	if (isReadOnly(inode)) {
  		if (!special_file(inode->i_mode) && noisy) {
  			/* kernel allows writes to devices on read-only
  			 * partitions and may try to mark inode dirty
  			 */
  			jfs_err("jfs_dirty_inode called on read-only volume");
  			jfs_err("Is remount racy?");
  			noisy--;
  		}
  		return;
  	}
  
  	set_cflag(COMMIT_Dirty, inode);
  }
115ff50ba   Dave Kleikamp   JFS: Quota suppor...
190
191
  int jfs_get_block(struct inode *ip, sector_t lblock,
  		  struct buffer_head *bh_result, int create)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
192
193
194
  {
  	s64 lblock64 = lblock;
  	int rc = 0;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
195
196
197
  	xad_t xad;
  	s64 xaddr;
  	int xflag;
115ff50ba   Dave Kleikamp   JFS: Quota suppor...
198
  	s32 xlen = bh_result->b_size >> ip->i_blkbits;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
199
200
  
  	/*
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
201
202
  	 * Take appropriate lock on inode
  	 */
7fab479be   Dave Kleikamp   [PATCH] JFS: Supp...
203
  	if (create)
82d5b9a7c   Dave Kleikamp   JFS: Add lockdep ...
204
  		IWRITE_LOCK(ip, RDWRLOCK_NORMAL);
7fab479be   Dave Kleikamp   [PATCH] JFS: Supp...
205
  	else
82d5b9a7c   Dave Kleikamp   JFS: Add lockdep ...
206
  		IREAD_LOCK(ip, RDWRLOCK_NORMAL);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
207
208
  
  	if (((lblock64 << ip->i_sb->s_blocksize_bits) < ip->i_size) &&
115ff50ba   Dave Kleikamp   JFS: Quota suppor...
209
  	    (!xtLookup(ip, lblock64, xlen, &xflag, &xaddr, &xlen, 0)) &&
6628465e3   Dave Kleikamp   [PATCH] JFS: Don'...
210
  	    xaddr) {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
  		if (xflag & XAD_NOTRECORDED) {
  			if (!create)
  				/*
  				 * Allocated but not recorded, read treats
  				 * this as a hole
  				 */
  				goto unlock;
  #ifdef _JFS_4K
  			XADoffset(&xad, lblock64);
  			XADlength(&xad, xlen);
  			XADaddress(&xad, xaddr);
  #else				/* _JFS_4K */
  			/*
  			 * As long as block size = 4K, this isn't a problem.
  			 * We should mark the whole page not ABNR, but how
  			 * will we know to mark the other blocks BH_New?
  			 */
  			BUG();
  #endif				/* _JFS_4K */
  			rc = extRecord(ip, &xad);
  			if (rc)
  				goto unlock;
  			set_buffer_new(bh_result);
  		}
  
  		map_bh(bh_result, ip->i_sb, xaddr);
  		bh_result->b_size = xlen << ip->i_blkbits;
  		goto unlock;
  	}
  	if (!create)
  		goto unlock;
  
  	/*
  	 * Allocate a new block
  	 */
  #ifdef _JFS_4K
  	if ((rc = extHint(ip, lblock64 << ip->i_sb->s_blocksize_bits, &xad)))
  		goto unlock;
4d81715fc   Richard Knutsson   [PATCH] fs/jfs: C...
249
  	rc = extAlloc(ip, xlen, lblock64, &xad, false);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
  	if (rc)
  		goto unlock;
  
  	set_buffer_new(bh_result);
  	map_bh(bh_result, ip->i_sb, addressXAD(&xad));
  	bh_result->b_size = lengthXAD(&xad) << ip->i_blkbits;
  
  #else				/* _JFS_4K */
  	/*
  	 * We need to do whatever it takes to keep all but the last buffers
  	 * in 4K pages - see jfs_write.c
  	 */
  	BUG();
  #endif				/* _JFS_4K */
  
        unlock:
  	/*
  	 * Release lock on inode
  	 */
7fab479be   Dave Kleikamp   [PATCH] JFS: Supp...
269
270
271
272
  	if (create)
  		IWRITE_UNLOCK(ip);
  	else
  		IREAD_UNLOCK(ip);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
273
274
  	return rc;
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
275
276
  static int jfs_writepage(struct page *page, struct writeback_control *wbc)
  {
d5c5f84ba   Nick Piggin   jfs: convert to n...
277
  	return block_write_full_page(page, jfs_get_block, wbc);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
  }
  
  static int jfs_writepages(struct address_space *mapping,
  			struct writeback_control *wbc)
  {
  	return mpage_writepages(mapping, wbc, jfs_get_block);
  }
  
  static int jfs_readpage(struct file *file, struct page *page)
  {
  	return mpage_readpage(page, jfs_get_block);
  }
  
  static int jfs_readpages(struct file *file, struct address_space *mapping,
  		struct list_head *pages, unsigned nr_pages)
  {
  	return mpage_readpages(mapping, pages, nr_pages, jfs_get_block);
  }
86dd07d66   Marco Stornelli   jfs: drop vmtruncate
296
297
298
299
300
  static void jfs_write_failed(struct address_space *mapping, loff_t to)
  {
  	struct inode *inode = mapping->host;
  
  	if (to > inode->i_size) {
7caef2676   Kirill A. Shutemov   truncate: drop 'o...
301
  		truncate_pagecache(inode, inode->i_size);
86dd07d66   Marco Stornelli   jfs: drop vmtruncate
302
303
304
  		jfs_truncate(inode);
  	}
  }
d5c5f84ba   Nick Piggin   jfs: convert to n...
305
306
307
  static int jfs_write_begin(struct file *file, struct address_space *mapping,
  				loff_t pos, unsigned len, unsigned flags,
  				struct page **pagep, void **fsdata)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
308
  {
ea0f04e59   Christoph Hellwig   get rid of nobh_w...
309
310
311
  	int ret;
  
  	ret = nobh_write_begin(mapping, pos, len, flags, pagep, fsdata,
d5c5f84ba   Nick Piggin   jfs: convert to n...
312
  				jfs_get_block);
86dd07d66   Marco Stornelli   jfs: drop vmtruncate
313
314
  	if (unlikely(ret))
  		jfs_write_failed(mapping, pos + len);
ea0f04e59   Christoph Hellwig   get rid of nobh_w...
315
316
  
  	return ret;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
317
318
319
320
321
322
  }
  
  static sector_t jfs_bmap(struct address_space *mapping, sector_t block)
  {
  	return generic_block_bmap(mapping, block, jfs_get_block);
  }
c8b8e32d7   Christoph Hellwig   direct-io: elimin...
323
  static ssize_t jfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
324
325
  {
  	struct file *file = iocb->ki_filp;
86dd07d66   Marco Stornelli   jfs: drop vmtruncate
326
  	struct address_space *mapping = file->f_mapping;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
327
  	struct inode *inode = file->f_mapping->host;
a6cbcd4a4   Al Viro   get rid of pointl...
328
  	size_t count = iov_iter_count(iter);
eafdc7d19   Christoph Hellwig   sort out blockdev...
329
  	ssize_t ret;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
330

c8b8e32d7   Christoph Hellwig   direct-io: elimin...
331
  	ret = blockdev_direct_IO(iocb, inode, iter, jfs_get_block);
eafdc7d19   Christoph Hellwig   sort out blockdev...
332
333
334
335
336
  
  	/*
  	 * In case of error extending write may have instantiated a few
  	 * blocks outside i_size. Trim these off again.
  	 */
6f6737631   Omar Sandoval   direct_IO: use io...
337
  	if (unlikely(iov_iter_rw(iter) == WRITE && ret < 0)) {
eafdc7d19   Christoph Hellwig   sort out blockdev...
338
  		loff_t isize = i_size_read(inode);
c8b8e32d7   Christoph Hellwig   direct-io: elimin...
339
  		loff_t end = iocb->ki_pos + count;
eafdc7d19   Christoph Hellwig   sort out blockdev...
340
341
  
  		if (end > isize)
86dd07d66   Marco Stornelli   jfs: drop vmtruncate
342
  			jfs_write_failed(mapping, end);
eafdc7d19   Christoph Hellwig   sort out blockdev...
343
344
345
  	}
  
  	return ret;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
346
  }
f5e54d6e5   Christoph Hellwig   [PATCH] mark addr...
347
  const struct address_space_operations jfs_aops = {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
348
349
350
351
  	.readpage	= jfs_readpage,
  	.readpages	= jfs_readpages,
  	.writepage	= jfs_writepage,
  	.writepages	= jfs_writepages,
d5c5f84ba   Nick Piggin   jfs: convert to n...
352
  	.write_begin	= jfs_write_begin,
03158cd7e   Nick Piggin   fs: restore nobh
353
  	.write_end	= nobh_write_end,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
  	.bmap		= jfs_bmap,
  	.direct_IO	= jfs_direct_IO,
  };
  
  /*
   * Guts of jfs_truncate.  Called with locks already held.  Can be called
   * with directory for truncating directory index table.
   */
  void jfs_truncate_nolock(struct inode *ip, loff_t length)
  {
  	loff_t newsize;
  	tid_t tid;
  
  	ASSERT(length >= 0);
  
  	if (test_cflag(COMMIT_Nolink, ip)) {
  		xtTruncate(0, ip, length, COMMIT_WMAP);
  		return;
  	}
  
  	do {
  		tid = txBegin(ip->i_sb, 0);
  
  		/*
1de87444f   Ingo Molnar   JFS: semaphore to...
378
  		 * The commit_mutex cannot be taken before txBegin.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
379
380
381
382
  		 * txBegin may block and there is a chance the inode
  		 * could be marked dirty and need to be committed
  		 * before txBegin unblocks
  		 */
1de87444f   Ingo Molnar   JFS: semaphore to...
383
  		mutex_lock(&JFS_IP(ip)->commit_mutex);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
384
385
386
387
388
  
  		newsize = xtTruncate(tid, ip, length,
  				     COMMIT_TRUNCATE | COMMIT_PWMAP);
  		if (newsize < 0) {
  			txEnd(tid);
1de87444f   Ingo Molnar   JFS: semaphore to...
389
  			mutex_unlock(&JFS_IP(ip)->commit_mutex);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
390
391
  			break;
  		}
078cd8279   Deepa Dinamani   fs: Replace CURRE...
392
  		ip->i_mtime = ip->i_ctime = current_time(ip);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
393
394
395
396
  		mark_inode_dirty(ip);
  
  		txCommit(tid, 1, &ip, 0);
  		txEnd(tid);
1de87444f   Ingo Molnar   JFS: semaphore to...
397
  		mutex_unlock(&JFS_IP(ip)->commit_mutex);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
398
399
400
401
402
403
  	} while (newsize > length);	/* Truncate isn't always atomic */
  }
  
  void jfs_truncate(struct inode *ip)
  {
  	jfs_info("jfs_truncate: size = 0x%lx", (ulong) ip->i_size);
03158cd7e   Nick Piggin   fs: restore nobh
404
  	nobh_truncate_page(ip->i_mapping, ip->i_size, jfs_get_block);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
405

82d5b9a7c   Dave Kleikamp   JFS: Add lockdep ...
406
  	IWRITE_LOCK(ip, RDWRLOCK_NORMAL);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
407
408
409
  	jfs_truncate_nolock(ip, ip->i_size);
  	IWRITE_UNLOCK(ip);
  }