Lines Matching refs:vol

36 int ntfs_cluster_free_from_rl_nolock(struct ntfs_volume *vol,  in ntfs_cluster_free_from_rl_nolock()  argument
39 struct inode *lcnbmp_vi = vol->lcnbmp_ino; in ntfs_cluster_free_from_rl_nolock()
47 if (!NVolFreeClusterKnown(vol)) in ntfs_cluster_free_from_rl_nolock()
48 wait_event(vol->free_waitq, NVolFreeClusterKnown(vol)); in ntfs_cluster_free_from_rl_nolock()
61 ntfs_inc_free_clusters(vol, nr_freed); in ntfs_cluster_free_from_rl_nolock()
183 struct runlist_element *ntfs_cluster_alloc(struct ntfs_volume *vol, const s64 start_vcn, in ntfs_cluster_alloc() argument
209 lcnbmp_vi = vol->lcnbmp_ino; in ntfs_cluster_alloc()
220 if (!NVolFreeClusterKnown(vol)) in ntfs_cluster_alloc()
221 wait_event(vol->free_waitq, NVolFreeClusterKnown(vol)); in ntfs_cluster_alloc()
222 free_clusters = atomic64_read(&vol->free_clusters); in ntfs_cluster_alloc()
225 down_write(&vol->lcnbmp_lock); in ntfs_cluster_alloc()
227 free_clusters -= atomic64_read(&vol->dirty_clusters); in ntfs_cluster_alloc()
257 zone_start = vol->data1_zone_pos; in ntfs_cluster_alloc()
259 zone_start = vol->mft_zone_pos; in ntfs_cluster_alloc()
272 if (!zone_start || zone_start == vol->mft_zone_start || in ntfs_cluster_alloc()
273 zone_start == vol->mft_zone_end) in ntfs_cluster_alloc()
276 if (zone_start < vol->mft_zone_start) { in ntfs_cluster_alloc()
277 zone_end = vol->mft_zone_start; in ntfs_cluster_alloc()
281 } else if (zone_start < vol->mft_zone_end) { in ntfs_cluster_alloc()
282 zone_end = vol->mft_zone_end; in ntfs_cluster_alloc()
285 zone_end = vol->nr_clusters; in ntfs_cluster_alloc()
306 ((s64)vol->nr_clusters + 7) >> 3); in ntfs_cluster_alloc()
340 if (vol->lcn_empty_bits_per_page[index] == 0) in ntfs_cluster_alloc()
346 ntfs_error(vol->sb, "Failed to map page."); in ntfs_cluster_alloc()
393 ntfs_error(vol->sb, "Failed to allocate memory."); in ntfs_cluster_alloc()
409 ntfs_dec_free_clusters(vol, 1); in ntfs_cluster_alloc()
410 ntfs_set_lcn_empty_bits(vol, index, 1, 1); in ntfs_cluster_alloc()
459 vol->mft_zone_pos); in ntfs_cluster_alloc()
460 if (tc >= vol->mft_zone_end) { in ntfs_cluster_alloc()
461 vol->mft_zone_pos = in ntfs_cluster_alloc()
462 vol->mft_lcn; in ntfs_cluster_alloc()
463 if (!vol->mft_zone_end) in ntfs_cluster_alloc()
464 vol->mft_zone_pos = 0; in ntfs_cluster_alloc()
466 vol->mft_zone_pos || in ntfs_cluster_alloc()
467 tc > vol->mft_zone_pos) in ntfs_cluster_alloc()
468 && tc >= vol->mft_lcn) in ntfs_cluster_alloc()
469 vol->mft_zone_pos = tc; in ntfs_cluster_alloc()
471 vol->mft_zone_pos); in ntfs_cluster_alloc()
475 vol->data1_zone_pos); in ntfs_cluster_alloc()
476 if (tc >= vol->nr_clusters) in ntfs_cluster_alloc()
477 vol->data1_zone_pos = in ntfs_cluster_alloc()
478 vol->mft_zone_end; in ntfs_cluster_alloc()
480 vol->data1_zone_pos || in ntfs_cluster_alloc()
481 tc > vol->data1_zone_pos) in ntfs_cluster_alloc()
482 && tc >= vol->mft_zone_end) in ntfs_cluster_alloc()
483 vol->data1_zone_pos = tc; in ntfs_cluster_alloc()
485 vol->data1_zone_pos); in ntfs_cluster_alloc()
489 vol->data2_zone_pos); in ntfs_cluster_alloc()
490 if (tc >= vol->mft_zone_start) in ntfs_cluster_alloc()
491 vol->data2_zone_pos = 0; in ntfs_cluster_alloc()
493 vol->data2_zone_pos || in ntfs_cluster_alloc()
494 tc > vol->data2_zone_pos) in ntfs_cluster_alloc()
495 vol->data2_zone_pos = tc; in ntfs_cluster_alloc()
497 vol->data2_zone_pos); in ntfs_cluster_alloc()
511 zone_start = vol->mft_zone_pos; in ntfs_cluster_alloc()
513 zone_start = vol->data1_zone_pos; in ntfs_cluster_alloc()
515 zone_start = vol->data2_zone_pos; in ntfs_cluster_alloc()
517 if (!zone_start || zone_start == vol->mft_zone_start || in ntfs_cluster_alloc()
518 zone_start == vol->mft_zone_end) in ntfs_cluster_alloc()
544 zone_start = vol->mft_zone_start; in ntfs_cluster_alloc()
547 zone_start = vol->mft_zone_end; in ntfs_cluster_alloc()
580 vol->mft_zone_pos); in ntfs_cluster_alloc()
583 if (tc >= vol->mft_zone_end) { in ntfs_cluster_alloc()
584 vol->mft_zone_pos = in ntfs_cluster_alloc()
585 vol->mft_lcn; in ntfs_cluster_alloc()
586 if (!vol->mft_zone_end) in ntfs_cluster_alloc()
587 vol->mft_zone_pos = 0; in ntfs_cluster_alloc()
589 vol->mft_zone_pos || in ntfs_cluster_alloc()
590 tc > vol->mft_zone_pos) in ntfs_cluster_alloc()
591 && tc >= vol->mft_lcn) in ntfs_cluster_alloc()
592 vol->mft_zone_pos = tc; in ntfs_cluster_alloc()
594 vol->mft_zone_pos); in ntfs_cluster_alloc()
599 vol->data1_zone_pos; in ntfs_cluster_alloc()
600 zone_end = vol->nr_clusters; in ntfs_cluster_alloc()
601 if (zone_start == vol->mft_zone_end) in ntfs_cluster_alloc()
604 vol->data1_zone_pos = zone_start = in ntfs_cluster_alloc()
605 vol->mft_zone_end; in ntfs_cluster_alloc()
616 vol->data1_zone_pos); in ntfs_cluster_alloc()
619 if (tc >= vol->nr_clusters) in ntfs_cluster_alloc()
620 vol->data1_zone_pos = in ntfs_cluster_alloc()
621 vol->mft_zone_end; in ntfs_cluster_alloc()
623 vol->data1_zone_pos || in ntfs_cluster_alloc()
624 tc > vol->data1_zone_pos) in ntfs_cluster_alloc()
625 && tc >= vol->mft_zone_end) in ntfs_cluster_alloc()
626 vol->data1_zone_pos = tc; in ntfs_cluster_alloc()
628 vol->data1_zone_pos); in ntfs_cluster_alloc()
633 vol->data2_zone_pos; in ntfs_cluster_alloc()
634 zone_end = vol->mft_zone_start; in ntfs_cluster_alloc()
638 vol->data2_zone_pos = zone_start = in ntfs_cluster_alloc()
650 vol->data2_zone_pos); in ntfs_cluster_alloc()
653 if (tc >= vol->mft_zone_start) in ntfs_cluster_alloc()
654 vol->data2_zone_pos = 0; in ntfs_cluster_alloc()
656 vol->data2_zone_pos || in ntfs_cluster_alloc()
657 tc > vol->data2_zone_pos) in ntfs_cluster_alloc()
658 vol->data2_zone_pos = tc; in ntfs_cluster_alloc()
660 vol->data2_zone_pos); in ntfs_cluster_alloc()
686 mft_zone_size = vol->mft_zone_end - vol->mft_zone_start; in ntfs_cluster_alloc()
688 vol->mft_zone_start, vol->mft_zone_end, in ntfs_cluster_alloc()
697 zone_end = vol->mft_zone_end; in ntfs_cluster_alloc()
700 vol->mft_zone_end = vol->mft_zone_start + mft_zone_size; in ntfs_cluster_alloc()
702 vol->data2_zone_pos = vol->mft_zone_start = in ntfs_cluster_alloc()
703 vol->mft_zone_end = 0; in ntfs_cluster_alloc()
704 if (vol->mft_zone_pos >= vol->mft_zone_end) { in ntfs_cluster_alloc()
705 vol->mft_zone_pos = vol->mft_lcn; in ntfs_cluster_alloc()
706 if (!vol->mft_zone_end) in ntfs_cluster_alloc()
707 vol->mft_zone_pos = 0; in ntfs_cluster_alloc()
710 vol->data1_zone_pos = vol->mft_zone_end; in ntfs_cluster_alloc()
715 mft_zone_size, vol->mft_zone_start, in ntfs_cluster_alloc()
716 vol->mft_zone_end, vol->mft_zone_pos, in ntfs_cluster_alloc()
718 vol->data1_zone_pos); in ntfs_cluster_alloc()
745 ntfs_release_dirty_clusters(vol, rl->length); in ntfs_cluster_alloc()
750 ntfs_error(vol->sb, in ntfs_cluster_alloc()
761 err2 = ntfs_cluster_free_from_rl_nolock(vol, rl); in ntfs_cluster_alloc()
763 ntfs_error(vol->sb, in ntfs_cluster_alloc()
766 NVolSetErrors(vol); in ntfs_cluster_alloc()
772 vol->data1_zone_pos); in ntfs_cluster_alloc()
773 atomic64_set(&vol->dirty_clusters, 0); in ntfs_cluster_alloc()
776 up_write(&vol->lcnbmp_lock); in ntfs_cluster_alloc()
846 struct ntfs_volume *vol; in __ntfs_cluster_free() local
855 vol = ni->vol; in __ntfs_cluster_free()
856 lcnbmp_vi = vol->lcnbmp_ino; in __ntfs_cluster_free()
860 if (!NVolFreeClusterKnown(vol)) in __ntfs_cluster_free()
861 wait_event(vol->free_waitq, NVolFreeClusterKnown(vol)); in __ntfs_cluster_free()
872 down_write(&vol->lcnbmp_lock); in __ntfs_cluster_free()
882 up_write(&vol->lcnbmp_lock); in __ntfs_cluster_free()
889 ntfs_error(vol->sb, in __ntfs_cluster_free()
896 ntfs_error(vol->sb, "First runlist element has invalid lcn, aborting."); in __ntfs_cluster_free()
914 ntfs_error(vol->sb, in __ntfs_cluster_free()
943 ntfs_error(vol->sb, in __ntfs_cluster_free()
949 ntfs_error(vol->sb, in __ntfs_cluster_free()
967 ntfs_error(vol->sb, "Failed to clear subsequent run."); in __ntfs_cluster_free()
980 ntfs_inc_free_clusters(vol, real_freed); in __ntfs_cluster_free()
982 up_write(&vol->lcnbmp_lock); in __ntfs_cluster_free()
988 if (NVolDiscard(vol) && !is_rollback) { in __ntfs_cluster_free()
990 u32 gran = bdev_discard_granularity(vol->sb->s_bdev); in __ntfs_cluster_free()
1005 start_sector = ALIGN(NTFS_CLU_TO_B(vol, rl->lcn + rl_off), in __ntfs_cluster_free()
1007 end_sector = ALIGN_DOWN(NTFS_CLU_TO_B(vol, in __ntfs_cluster_free()
1011 ret = blkdev_issue_discard(vol->sb->s_bdev, start_sector, in __ntfs_cluster_free()
1033 up_write(&vol->lcnbmp_lock); in __ntfs_cluster_free()
1044 ntfs_error(vol->sb, in __ntfs_cluster_free()
1047 NVolSetErrors(vol); in __ntfs_cluster_free()
1049 ntfs_dec_free_clusters(vol, delta); in __ntfs_cluster_free()
1051 up_write(&vol->lcnbmp_lock); in __ntfs_cluster_free()
1053 ntfs_error(vol->sb, "Aborting (error %i).", err); in __ntfs_cluster_free()