hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/fs/jfs/inode.c
....@@ -1,20 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (C) International Business Machines Corp., 2000-2004
34 * Portions Copyright (C) Christoph Hellwig, 2001-2002
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
13
- * the GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program; if not, write to the Free Software
17
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
185 */
196
207 #include <linux/fs.h>
....@@ -31,6 +18,7 @@
3118 #include "jfs_extent.h"
3219 #include "jfs_unicode.h"
3320 #include "jfs_debug.h"
21
+#include "jfs_dmap.h"
3422
3523
3624 struct inode *jfs_iget(struct super_block *sb, unsigned long ino)
....@@ -150,24 +138,26 @@
150138
151139 void jfs_evict_inode(struct inode *inode)
152140 {
141
+ struct jfs_inode_info *ji = JFS_IP(inode);
142
+
153143 jfs_info("In jfs_evict_inode, inode = 0x%p", inode);
154144
155145 if (!inode->i_nlink && !is_bad_inode(inode)) {
156146 dquot_initialize(inode);
157147
158148 if (JFS_IP(inode)->fileset == FILESYSTEM_I) {
149
+ struct inode *ipimap = JFS_SBI(inode->i_sb)->ipimap;
159150 truncate_inode_pages_final(&inode->i_data);
160151
161152 if (test_cflag(COMMIT_Freewmap, inode))
162153 jfs_free_zero_link(inode);
163154
164
- if (JFS_SBI(inode->i_sb)->ipimap)
155
+ if (ipimap && JFS_IP(ipimap)->i_imap)
165156 diFree(inode);
166157
167158 /*
168159 * Free the inode from the quota allocation.
169160 */
170
- dquot_initialize(inode);
171161 dquot_free_inode(inode);
172162 }
173163 } else {
....@@ -175,6 +165,16 @@
175165 }
176166 clear_inode(inode);
177167 dquot_drop(inode);
168
+
169
+ BUG_ON(!list_empty(&ji->anon_inode_list));
170
+
171
+ spin_lock_irq(&ji->ag_lock);
172
+ if (ji->active_ag != -1) {
173
+ struct bmap *bmap = JFS_SBI(inode->i_sb)->bmap;
174
+ atomic_dec(&bmap->db_active[ji->active_ag]);
175
+ ji->active_ag = -1;
176
+ }
177
+ spin_unlock_irq(&ji->ag_lock);
178178 }
179179
180180 void jfs_dirty_inode(struct inode *inode, int flags)
....@@ -298,10 +298,9 @@
298298 return mpage_readpage(page, jfs_get_block);
299299 }
300300
301
-static int jfs_readpages(struct file *file, struct address_space *mapping,
302
- struct list_head *pages, unsigned nr_pages)
301
+static void jfs_readahead(struct readahead_control *rac)
303302 {
304
- return mpage_readpages(mapping, pages, nr_pages, jfs_get_block);
303
+ mpage_readahead(rac, jfs_get_block);
305304 }
306305
307306 static void jfs_write_failed(struct address_space *mapping, loff_t to)
....@@ -360,7 +359,7 @@
360359
361360 const struct address_space_operations jfs_aops = {
362361 .readpage = jfs_readpage,
363
- .readpages = jfs_readpages,
362
+ .readahead = jfs_readahead,
364363 .writepage = jfs_writepage,
365364 .writepages = jfs_writepages,
366365 .write_begin = jfs_write_begin,