.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) International Business Machines Corp., 2000-2004 |
---|
3 | 4 | * 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 |
---|
18 | 5 | */ |
---|
19 | 6 | |
---|
20 | 7 | #include <linux/fs.h> |
---|
.. | .. |
---|
31 | 18 | #include "jfs_extent.h" |
---|
32 | 19 | #include "jfs_unicode.h" |
---|
33 | 20 | #include "jfs_debug.h" |
---|
| 21 | +#include "jfs_dmap.h" |
---|
34 | 22 | |
---|
35 | 23 | |
---|
36 | 24 | struct inode *jfs_iget(struct super_block *sb, unsigned long ino) |
---|
.. | .. |
---|
150 | 138 | |
---|
151 | 139 | void jfs_evict_inode(struct inode *inode) |
---|
152 | 140 | { |
---|
| 141 | + struct jfs_inode_info *ji = JFS_IP(inode); |
---|
| 142 | + |
---|
153 | 143 | jfs_info("In jfs_evict_inode, inode = 0x%p", inode); |
---|
154 | 144 | |
---|
155 | 145 | if (!inode->i_nlink && !is_bad_inode(inode)) { |
---|
156 | 146 | dquot_initialize(inode); |
---|
157 | 147 | |
---|
158 | 148 | if (JFS_IP(inode)->fileset == FILESYSTEM_I) { |
---|
| 149 | + struct inode *ipimap = JFS_SBI(inode->i_sb)->ipimap; |
---|
159 | 150 | truncate_inode_pages_final(&inode->i_data); |
---|
160 | 151 | |
---|
161 | 152 | if (test_cflag(COMMIT_Freewmap, inode)) |
---|
162 | 153 | jfs_free_zero_link(inode); |
---|
163 | 154 | |
---|
164 | | - if (JFS_SBI(inode->i_sb)->ipimap) |
---|
| 155 | + if (ipimap && JFS_IP(ipimap)->i_imap) |
---|
165 | 156 | diFree(inode); |
---|
166 | 157 | |
---|
167 | 158 | /* |
---|
168 | 159 | * Free the inode from the quota allocation. |
---|
169 | 160 | */ |
---|
170 | | - dquot_initialize(inode); |
---|
171 | 161 | dquot_free_inode(inode); |
---|
172 | 162 | } |
---|
173 | 163 | } else { |
---|
.. | .. |
---|
175 | 165 | } |
---|
176 | 166 | clear_inode(inode); |
---|
177 | 167 | 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); |
---|
178 | 178 | } |
---|
179 | 179 | |
---|
180 | 180 | void jfs_dirty_inode(struct inode *inode, int flags) |
---|
.. | .. |
---|
298 | 298 | return mpage_readpage(page, jfs_get_block); |
---|
299 | 299 | } |
---|
300 | 300 | |
---|
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) |
---|
303 | 302 | { |
---|
304 | | - return mpage_readpages(mapping, pages, nr_pages, jfs_get_block); |
---|
| 303 | + mpage_readahead(rac, jfs_get_block); |
---|
305 | 304 | } |
---|
306 | 305 | |
---|
307 | 306 | static void jfs_write_failed(struct address_space *mapping, loff_t to) |
---|
.. | .. |
---|
360 | 359 | |
---|
361 | 360 | const struct address_space_operations jfs_aops = { |
---|
362 | 361 | .readpage = jfs_readpage, |
---|
363 | | - .readpages = jfs_readpages, |
---|
| 362 | + .readahead = jfs_readahead, |
---|
364 | 363 | .writepage = jfs_writepage, |
---|
365 | 364 | .writepages = jfs_writepages, |
---|
366 | 365 | .write_begin = jfs_write_begin, |
---|