Lines Matching +full:add +full:- +full:disk
1 // SPDX-License-Identifier: GPL-2.0+
5 * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation.
12 * This file adds the cache of on-disk blocks to be moved in garbage
13 * collection. The disk blocks are held with dummy inodes (called
38 * nilfs_gccache_submit_read_data() - add data buffer and submit read request
39 * @inode - gc inode
40 * @blkoff - dummy offset treated as the key for the page cache
41 * @pbn - physical block number of the block
42 * @vbn - virtual block number of the block, 0 for non-virtual block
43 * @out_bh - indirect pointer to a buffer_head struct to receive the results
51 * * %-EIO - I/O error (including metadata corruption).
52 * * %-ENOENT - The block specified with @pbn does not exist.
53 * * %-ENOMEM - Insufficient memory available.
62 bh = nilfs_grab_buffer(inode, inode->i_mapping, blkoff, 0); in nilfs_gccache_submit_read_data()
64 return -ENOMEM; in nilfs_gccache_submit_read_data()
70 struct the_nilfs *nilfs = inode->i_sb->s_fs_info; in nilfs_gccache_submit_read_data()
72 err = nilfs_dat_translate(nilfs->ns_dat, vbn, &pbn); in nilfs_gccache_submit_read_data()
73 if (unlikely(err)) /* -EIO, -ENOMEM, -ENOENT */ in nilfs_gccache_submit_read_data()
85 bh->b_blocknr = pbn; in nilfs_gccache_submit_read_data()
86 bh->b_end_io = end_buffer_read_sync; in nilfs_gccache_submit_read_data()
90 bh->b_blocknr = vbn; in nilfs_gccache_submit_read_data()
96 folio_unlock(bh->b_folio); in nilfs_gccache_submit_read_data()
97 folio_put(bh->b_folio); in nilfs_gccache_submit_read_data()
104 * nilfs_gccache_submit_read_node() - add node buffer and submit read request
105 * @inode - gc inode
106 * @pbn - physical block number for the block
107 * @vbn - virtual block number for the block
108 * @out_bh - indirect pointer to a buffer_head struct to receive the results
112 * caller to avoid translation of the disk block address.
116 * * %-EIO - I/O error (including metadata corruption).
117 * * %-ENOENT - Invalid virtual block address.
118 * * %-ENOMEM - Insufficient memory available.
123 struct inode *btnc_inode = NILFS_I(inode)->i_assoc_inode; in nilfs_gccache_submit_read_node()
126 ret = nilfs_btnode_submit_block(btnc_inode->i_mapping, vbn ? : pbn, pbn, in nilfs_gccache_submit_read_node()
128 if (ret == -EEXIST) /* internal code (cache hit) */ in nilfs_gccache_submit_read_node()
137 struct inode *inode = bh->b_folio->mapping->host; in nilfs_gccache_wait_and_mark_dirty()
139 nilfs_err(inode->i_sb, in nilfs_gccache_wait_and_mark_dirty()
142 inode->i_ino, (unsigned long long)bh->b_blocknr); in nilfs_gccache_wait_and_mark_dirty()
143 return -EIO; in nilfs_gccache_wait_and_mark_dirty()
146 return -EEXIST; in nilfs_gccache_wait_and_mark_dirty()
150 return -EIO; in nilfs_gccache_wait_and_mark_dirty()
160 inode->i_mode = S_IFREG; in nilfs_init_gcinode()
161 mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS); in nilfs_init_gcinode()
162 inode->i_mapping->a_ops = &nilfs_buffer_cache_aops; in nilfs_init_gcinode()
164 ii->i_flags = 0; in nilfs_init_gcinode()
165 nilfs_bmap_init_gc(ii->i_bmap); in nilfs_init_gcinode()
171 * nilfs_remove_all_gcinodes() - remove all unprocessed gc inodes
176 struct list_head *head = &nilfs->ns_gc_inodes; in nilfs_remove_all_gcinodes()
181 list_del_init(&ii->i_dirty); in nilfs_remove_all_gcinodes()
182 truncate_inode_pages(&ii->vfs_inode.i_data, 0); in nilfs_remove_all_gcinodes()
183 nilfs_btnode_cache_clear(ii->i_assoc_inode->i_mapping); in nilfs_remove_all_gcinodes()
184 iput(&ii->vfs_inode); in nilfs_remove_all_gcinodes()