Lines Matching +full:key +full:-

1 // SPDX-License-Identifier: GPL-2.0+
5 * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation.
20 ((struct nilfs_direct_node *)direct->b_u.u_data + 1); in nilfs_direct_dptrs()
24 nilfs_direct_get_ptr(const struct nilfs_bmap *direct, __u64 key) in nilfs_direct_get_ptr() argument
26 return le64_to_cpu(*(nilfs_direct_dptrs(direct) + key)); in nilfs_direct_get_ptr()
30 __u64 key, __u64 ptr) in nilfs_direct_set_ptr() argument
32 *(nilfs_direct_dptrs(direct) + key) = cpu_to_le64(ptr); in nilfs_direct_set_ptr()
36 __u64 key, int level, __u64 *ptrp) in nilfs_direct_lookup() argument
40 if (key > NILFS_DIRECT_KEY_MAX || level != 1) in nilfs_direct_lookup()
41 return -ENOENT; in nilfs_direct_lookup()
42 ptr = nilfs_direct_get_ptr(direct, key); in nilfs_direct_lookup()
44 return -ENOENT; in nilfs_direct_lookup()
51 __u64 key, __u64 *ptrp, in nilfs_direct_lookup_contig() argument
59 if (key > NILFS_DIRECT_KEY_MAX) in nilfs_direct_lookup_contig()
60 return -ENOENT; in nilfs_direct_lookup_contig()
61 ptr = nilfs_direct_get_ptr(direct, key); in nilfs_direct_lookup_contig()
63 return -ENOENT; in nilfs_direct_lookup_contig()
74 NILFS_DIRECT_KEY_MAX - key + 1); in nilfs_direct_lookup_contig()
76 (ptr2 = nilfs_direct_get_ptr(direct, key + cnt)) != in nilfs_direct_lookup_contig()
92 if (ret == -ENOENT) in nilfs_direct_lookup_contig()
93 ret = -EINVAL; /* Notify bmap layer of metadata corruption */ in nilfs_direct_lookup_contig()
98 nilfs_direct_find_target_v(const struct nilfs_bmap *direct, __u64 key) in nilfs_direct_find_target_v() argument
102 ptr = nilfs_bmap_find_target_seq(direct, key); in nilfs_direct_find_target_v()
111 static int nilfs_direct_insert(struct nilfs_bmap *bmap, __u64 key, __u64 ptr) in nilfs_direct_insert() argument
118 if (key > NILFS_DIRECT_KEY_MAX) in nilfs_direct_insert()
119 return -ENOENT; in nilfs_direct_insert()
120 if (nilfs_direct_get_ptr(bmap, key) != NILFS_BMAP_INVALID_PTR) in nilfs_direct_insert()
121 return -EEXIST; in nilfs_direct_insert()
124 req.bpr_ptr = nilfs_direct_find_target_v(bmap, key); in nilfs_direct_insert()
134 nilfs_direct_set_ptr(bmap, key, req.bpr_ptr); in nilfs_direct_insert()
140 nilfs_bmap_set_target_v(bmap, key, req.bpr_ptr); in nilfs_direct_insert()
142 nilfs_inode_add_blocks(bmap->b_inode, 1); in nilfs_direct_insert()
147 static int nilfs_direct_delete(struct nilfs_bmap *bmap, __u64 key) in nilfs_direct_delete() argument
153 if (key > NILFS_DIRECT_KEY_MAX || in nilfs_direct_delete()
154 nilfs_direct_get_ptr(bmap, key) == NILFS_BMAP_INVALID_PTR) in nilfs_direct_delete()
155 return -ENOENT; in nilfs_direct_delete()
158 req.bpr_ptr = nilfs_direct_get_ptr(bmap, key); in nilfs_direct_delete()
163 nilfs_direct_set_ptr(bmap, key, NILFS_BMAP_INVALID_PTR); in nilfs_direct_delete()
164 nilfs_inode_sub_blocks(bmap->b_inode, 1); in nilfs_direct_delete()
172 __u64 key; in nilfs_direct_seek_key() local
174 for (key = start; key <= NILFS_DIRECT_KEY_MAX; key++) { in nilfs_direct_seek_key()
175 if (nilfs_direct_get_ptr(direct, key) != in nilfs_direct_seek_key()
177 *keyp = key; in nilfs_direct_seek_key()
181 return -ENOENT; in nilfs_direct_seek_key()
186 __u64 key, lastkey; in nilfs_direct_last_key() local
189 for (key = NILFS_DIRECT_KEY_MIN; key <= NILFS_DIRECT_KEY_MAX; key++) in nilfs_direct_last_key()
190 if (nilfs_direct_get_ptr(direct, key) != in nilfs_direct_last_key()
192 lastkey = key; in nilfs_direct_last_key()
195 return -ENOENT; in nilfs_direct_last_key()
202 static int nilfs_direct_check_insert(const struct nilfs_bmap *bmap, __u64 key) in nilfs_direct_check_insert() argument
204 return key > NILFS_DIRECT_KEY_MAX; in nilfs_direct_check_insert()
210 __u64 key; in nilfs_direct_gather_data() local
217 for (key = 0; key < nitems; key++) { in nilfs_direct_gather_data()
218 ptr = nilfs_direct_get_ptr(direct, key); in nilfs_direct_gather_data()
220 keys[n] = key; in nilfs_direct_gather_data()
229 __u64 key, __u64 *keys, __u64 *ptrs, int n) in nilfs_direct_delete_and_convert() argument
237 ret = bmap->b_ops->bop_delete(bmap, key); in nilfs_direct_delete_and_convert()
242 if (bmap->b_ops->bop_clear != NULL) in nilfs_direct_delete_and_convert()
243 bmap->b_ops->bop_clear(bmap); in nilfs_direct_delete_and_convert()
249 dptrs[i] = (i != key) ? in nilfs_direct_delete_and_convert()
266 __u64 key; in nilfs_direct_propagate() local
274 key = nilfs_bmap_data_get_key(bmap, bh); in nilfs_direct_propagate()
275 ptr = nilfs_direct_get_ptr(bmap, key); in nilfs_direct_propagate()
283 bmap->b_ptr_type == NILFS_BMAP_PTR_VS); in nilfs_direct_propagate()
285 nilfs_direct_set_ptr(bmap, key, newreq.pr_entry_nr); in nilfs_direct_propagate()
293 __u64 key, __u64 ptr, in nilfs_direct_assign_v() argument
306 binfo->bi_v.bi_vblocknr = cpu_to_le64(ptr); in nilfs_direct_assign_v()
307 binfo->bi_v.bi_blkoff = cpu_to_le64(key); in nilfs_direct_assign_v()
313 __u64 key, __u64 ptr, in nilfs_direct_assign_p() argument
318 nilfs_direct_set_ptr(direct, key, blocknr); in nilfs_direct_assign_p()
320 binfo->bi_dat.bi_blkoff = cpu_to_le64(key); in nilfs_direct_assign_p()
321 binfo->bi_dat.bi_level = 0; in nilfs_direct_assign_p()
322 memset(binfo->bi_dat.bi_pad, 0, sizeof(binfo->bi_dat.bi_pad)); in nilfs_direct_assign_p()
332 __u64 key; in nilfs_direct_assign() local
335 key = nilfs_bmap_data_get_key(bmap, *bh); in nilfs_direct_assign()
336 if (unlikely(key > NILFS_DIRECT_KEY_MAX)) { in nilfs_direct_assign()
337 nilfs_crit(bmap->b_inode->i_sb, in nilfs_direct_assign()
338 "%s (ino=%lu): invalid key: %llu", in nilfs_direct_assign()
340 bmap->b_inode->i_ino, (unsigned long long)key); in nilfs_direct_assign()
341 return -EINVAL; in nilfs_direct_assign()
343 ptr = nilfs_direct_get_ptr(bmap, key); in nilfs_direct_assign()
345 nilfs_crit(bmap->b_inode->i_sb, in nilfs_direct_assign()
348 bmap->b_inode->i_ino, (unsigned long long)ptr); in nilfs_direct_assign()
349 return -EINVAL; in nilfs_direct_assign()
353 nilfs_direct_assign_v(bmap, key, ptr, bh, blocknr, binfo) : in nilfs_direct_assign()
354 nilfs_direct_assign_p(bmap, key, ptr, bh, blocknr, binfo); in nilfs_direct_assign()
382 bmap->b_ops = &nilfs_direct_ops; in nilfs_direct_init()