diff options
Diffstat (limited to 'fs/nilfs2/cpfile.c')
-rw-r--r-- | fs/nilfs2/cpfile.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/nilfs2/cpfile.c b/fs/nilfs2/cpfile.c index 50dff147744f..218b34418508 100644 --- a/fs/nilfs2/cpfile.c +++ b/fs/nilfs2/cpfile.c | |||
@@ -382,13 +382,13 @@ static void nilfs_cpfile_checkpoint_to_cpinfo(struct inode *cpfile, | |||
382 | ci->ci_next = le64_to_cpu(cp->cp_snapshot_list.ssl_next); | 382 | ci->ci_next = le64_to_cpu(cp->cp_snapshot_list.ssl_next); |
383 | } | 383 | } |
384 | 384 | ||
385 | static ssize_t nilfs_cpfile_do_get_cpinfo(struct inode *cpfile, __u64 cno, | 385 | static ssize_t nilfs_cpfile_do_get_cpinfo(struct inode *cpfile, __u64 *cnop, |
386 | struct nilfs_cpinfo *ci, size_t nci) | 386 | struct nilfs_cpinfo *ci, size_t nci) |
387 | { | 387 | { |
388 | struct nilfs_checkpoint *cp; | 388 | struct nilfs_checkpoint *cp; |
389 | struct buffer_head *bh; | 389 | struct buffer_head *bh; |
390 | size_t cpsz = NILFS_MDT(cpfile)->mi_entry_size; | 390 | size_t cpsz = NILFS_MDT(cpfile)->mi_entry_size; |
391 | __u64 cur_cno = nilfs_mdt_cno(cpfile); | 391 | __u64 cur_cno = nilfs_mdt_cno(cpfile), cno = *cnop; |
392 | void *kaddr; | 392 | void *kaddr; |
393 | int n, ret; | 393 | int n, ret; |
394 | int ncps, i; | 394 | int ncps, i; |
@@ -416,6 +416,8 @@ static ssize_t nilfs_cpfile_do_get_cpinfo(struct inode *cpfile, __u64 cno, | |||
416 | } | 416 | } |
417 | 417 | ||
418 | ret = n; | 418 | ret = n; |
419 | if (n > 0) | ||
420 | *cnop = ci[n - 1].ci_cno + 1; | ||
419 | 421 | ||
420 | out: | 422 | out: |
421 | up_read(&NILFS_MDT(cpfile)->mi_sem); | 423 | up_read(&NILFS_MDT(cpfile)->mi_sem); |
@@ -510,7 +512,7 @@ ssize_t nilfs_cpfile_get_cpinfo(struct inode *cpfile, __u64 *cnop, int mode, | |||
510 | { | 512 | { |
511 | switch (mode) { | 513 | switch (mode) { |
512 | case NILFS_CHECKPOINT: | 514 | case NILFS_CHECKPOINT: |
513 | return nilfs_cpfile_do_get_cpinfo(cpfile, *cnop, ci, nci); | 515 | return nilfs_cpfile_do_get_cpinfo(cpfile, cnop, ci, nci); |
514 | case NILFS_SNAPSHOT: | 516 | case NILFS_SNAPSHOT: |
515 | return nilfs_cpfile_do_get_ssinfo(cpfile, cnop, ci, nci); | 517 | return nilfs_cpfile_do_get_ssinfo(cpfile, cnop, ci, nci); |
516 | default: | 518 | default: |
@@ -526,13 +528,14 @@ ssize_t nilfs_cpfile_get_cpinfo(struct inode *cpfile, __u64 *cnop, int mode, | |||
526 | int nilfs_cpfile_delete_checkpoint(struct inode *cpfile, __u64 cno) | 528 | int nilfs_cpfile_delete_checkpoint(struct inode *cpfile, __u64 cno) |
527 | { | 529 | { |
528 | struct nilfs_cpinfo ci; | 530 | struct nilfs_cpinfo ci; |
531 | __u64 tcno = cno; | ||
529 | ssize_t nci; | 532 | ssize_t nci; |
530 | int ret; | 533 | int ret; |
531 | 534 | ||
532 | /* checkpoint number 0 is invalid */ | 535 | /* checkpoint number 0 is invalid */ |
533 | if (cno == 0) | 536 | if (cno == 0) |
534 | return -ENOENT; | 537 | return -ENOENT; |
535 | nci = nilfs_cpfile_do_get_cpinfo(cpfile, cno, &ci, 1); | 538 | nci = nilfs_cpfile_do_get_cpinfo(cpfile, &tcno, &ci, 1); |
536 | if (nci < 0) | 539 | if (nci < 0) |
537 | return nci; | 540 | return nci; |
538 | else if (nci == 0 || ci.ci_cno != cno) | 541 | else if (nci == 0 || ci.ci_cno != cno) |