diff options
Diffstat (limited to 'fs/nilfs2/dat.c')
-rw-r--r-- | fs/nilfs2/dat.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/fs/nilfs2/dat.c b/fs/nilfs2/dat.c index 1827f62c772d..0b2710e2d565 100644 --- a/fs/nilfs2/dat.c +++ b/fs/nilfs2/dat.c | |||
@@ -376,36 +376,37 @@ int nilfs_dat_translate(struct inode *dat, __u64 vblocknr, sector_t *blocknrp) | |||
376 | return ret; | 376 | return ret; |
377 | } | 377 | } |
378 | 378 | ||
379 | ssize_t nilfs_dat_get_vinfo(struct inode *dat, struct nilfs_vinfo *vinfo, | 379 | ssize_t nilfs_dat_get_vinfo(struct inode *dat, void *buf, unsigned visz, |
380 | size_t nvi) | 380 | size_t nvi) |
381 | { | 381 | { |
382 | struct buffer_head *entry_bh; | 382 | struct buffer_head *entry_bh; |
383 | struct nilfs_dat_entry *entry; | 383 | struct nilfs_dat_entry *entry; |
384 | struct nilfs_vinfo *vinfo = buf; | ||
384 | __u64 first, last; | 385 | __u64 first, last; |
385 | void *kaddr; | 386 | void *kaddr; |
386 | unsigned long entries_per_block = NILFS_MDT(dat)->mi_entries_per_block; | 387 | unsigned long entries_per_block = NILFS_MDT(dat)->mi_entries_per_block; |
387 | int i, j, n, ret; | 388 | int i, j, n, ret; |
388 | 389 | ||
389 | for (i = 0; i < nvi; i += n) { | 390 | for (i = 0; i < nvi; i += n) { |
390 | ret = nilfs_palloc_get_entry_block(dat, vinfo[i].vi_vblocknr, | 391 | ret = nilfs_palloc_get_entry_block(dat, vinfo->vi_vblocknr, |
391 | 0, &entry_bh); | 392 | 0, &entry_bh); |
392 | if (ret < 0) | 393 | if (ret < 0) |
393 | return ret; | 394 | return ret; |
394 | kaddr = kmap_atomic(entry_bh->b_page, KM_USER0); | 395 | kaddr = kmap_atomic(entry_bh->b_page, KM_USER0); |
395 | /* last virtual block number in this block */ | 396 | /* last virtual block number in this block */ |
396 | first = vinfo[i].vi_vblocknr; | 397 | first = vinfo->vi_vblocknr; |
397 | do_div(first, entries_per_block); | 398 | do_div(first, entries_per_block); |
398 | first *= entries_per_block; | 399 | first *= entries_per_block; |
399 | last = first + entries_per_block - 1; | 400 | last = first + entries_per_block - 1; |
400 | for (j = i, n = 0; | 401 | for (j = i, n = 0; |
401 | j < nvi && vinfo[j].vi_vblocknr >= first && | 402 | j < nvi && vinfo->vi_vblocknr >= first && |
402 | vinfo[j].vi_vblocknr <= last; | 403 | vinfo->vi_vblocknr <= last; |
403 | j++, n++) { | 404 | j++, n++, vinfo = (void *)vinfo + visz) { |
404 | entry = nilfs_palloc_block_get_entry( | 405 | entry = nilfs_palloc_block_get_entry( |
405 | dat, vinfo[j].vi_vblocknr, entry_bh, kaddr); | 406 | dat, vinfo->vi_vblocknr, entry_bh, kaddr); |
406 | vinfo[j].vi_start = le64_to_cpu(entry->de_start); | 407 | vinfo->vi_start = le64_to_cpu(entry->de_start); |
407 | vinfo[j].vi_end = le64_to_cpu(entry->de_end); | 408 | vinfo->vi_end = le64_to_cpu(entry->de_end); |
408 | vinfo[j].vi_blocknr = le64_to_cpu(entry->de_blocknr); | 409 | vinfo->vi_blocknr = le64_to_cpu(entry->de_blocknr); |
409 | } | 410 | } |
410 | kunmap_atomic(kaddr, KM_USER0); | 411 | kunmap_atomic(kaddr, KM_USER0); |
411 | brelse(entry_bh); | 412 | brelse(entry_bh); |