direct.c (e473c1f265f429427e09531435ceaf0fdbb86d15) | direct.c (3033342a0b76048e32ce1faebfa85cf8f1aa93b5) |
---|---|
1/* 2 * direct.c - NILFS direct block pointer. 3 * 4 * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or --- 228 unchanged lines hidden (view full) --- 237 ptrs[n] = ptr; 238 n++; 239 } 240 } 241 return n; 242} 243 244int nilfs_direct_delete_and_convert(struct nilfs_bmap *bmap, | 1/* 2 * direct.c - NILFS direct block pointer. 3 * 4 * Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or --- 228 unchanged lines hidden (view full) --- 237 ptrs[n] = ptr; 238 n++; 239 } 240 } 241 return n; 242} 243 244int nilfs_direct_delete_and_convert(struct nilfs_bmap *bmap, |
245 __u64 key, __u64 *keys, __u64 *ptrs, 246 int n, __u64 low, __u64 high) | 245 __u64 key, __u64 *keys, __u64 *ptrs, int n) |
247{ 248 struct nilfs_direct *direct; 249 __le64 *dptrs; 250 int ret, i, j; 251 252 /* no need to allocate any resource for conversion */ 253 254 /* delete */ --- 13 unchanged lines hidden (view full) --- 268 dptrs[i] = (i != key) ? 269 nilfs_bmap_ptr_to_dptr(ptrs[j]) : 270 NILFS_BMAP_INVALID_PTR; 271 j++; 272 } else 273 dptrs[i] = NILFS_BMAP_INVALID_PTR; 274 } 275 | 246{ 247 struct nilfs_direct *direct; 248 __le64 *dptrs; 249 int ret, i, j; 250 251 /* no need to allocate any resource for conversion */ 252 253 /* delete */ --- 13 unchanged lines hidden (view full) --- 267 dptrs[i] = (i != key) ? 268 nilfs_bmap_ptr_to_dptr(ptrs[j]) : 269 NILFS_BMAP_INVALID_PTR; 270 j++; 271 } else 272 dptrs[i] = NILFS_BMAP_INVALID_PTR; 273 } 274 |
276 nilfs_direct_init(bmap, low, high); 277 | 275 nilfs_direct_init(bmap); |
278 return 0; 279} 280 281static int nilfs_direct_propagate_v(struct nilfs_direct *direct, 282 struct buffer_head *bh) 283{ 284 union nilfs_bmap_ptr_req oldreq, newreq; 285 __u64 key; --- 119 unchanged lines hidden (view full) --- 405 406static const struct nilfs_direct_operations nilfs_direct_ops_p = { 407 .dop_find_target = NULL, 408 .dop_set_target = NULL, 409 .dop_propagate = NULL, 410 .dop_assign = nilfs_direct_assign_p, 411}; 412 | 276 return 0; 277} 278 279static int nilfs_direct_propagate_v(struct nilfs_direct *direct, 280 struct buffer_head *bh) 281{ 282 union nilfs_bmap_ptr_req oldreq, newreq; 283 __u64 key; --- 119 unchanged lines hidden (view full) --- 403 404static const struct nilfs_direct_operations nilfs_direct_ops_p = { 405 .dop_find_target = NULL, 406 .dop_set_target = NULL, 407 .dop_propagate = NULL, 408 .dop_assign = nilfs_direct_assign_p, 409}; 410 |
413int nilfs_direct_init(struct nilfs_bmap *bmap, __u64 low, __u64 high) | 411int nilfs_direct_init(struct nilfs_bmap *bmap) |
414{ | 412{ |
415 struct nilfs_direct *direct; | 413 struct nilfs_direct *direct = (struct nilfs_direct *)bmap; |
416 | 414 |
417 direct = (struct nilfs_direct *)bmap; | |
418 bmap->b_ops = &nilfs_direct_ops; | 415 bmap->b_ops = &nilfs_direct_ops; |
419 bmap->b_low = low; 420 bmap->b_high = high; | |
421 switch (bmap->b_inode->i_ino) { 422 case NILFS_DAT_INO: 423 direct->d_ops = &nilfs_direct_ops_p; 424 break; 425 default: 426 direct->d_ops = &nilfs_direct_ops_v; 427 break; 428 } 429 430 return 0; 431} | 416 switch (bmap->b_inode->i_ino) { 417 case NILFS_DAT_INO: 418 direct->d_ops = &nilfs_direct_ops_p; 419 break; 420 default: 421 direct->d_ops = &nilfs_direct_ops_v; 422 break; 423 } 424 425 return 0; 426} |