Lines Matching refs:vol

39 	ntfs_volume *vol = ni->vol;  in map_mft_record_page()  local
40 struct inode *mft_vi = vol->mft_ino; in map_mft_record_page()
52 index = (u64)ni->mft_no << vol->mft_record_size_bits >> in map_mft_record_page()
54 ofs = (ni->mft_no << vol->mft_record_size_bits) & ~PAGE_MASK; in map_mft_record_page()
63 vol->mft_record_size) { in map_mft_record_page()
65 ntfs_error(vol->sb, "Attempt to read mft record 0x%lx, " in map_mft_record_page()
82 ntfs_error(vol->sb, "Mft record 0x%lx is corrupt. " in map_mft_record_page()
86 NVolSetErrors(vol); in map_mft_record_page()
162 ntfs_error(ni->vol->sb, "Failed with error code %lu.", -PTR_ERR(m)); in map_mft_record()
282 ntfs_error(base_ni->vol->sb, "Found stale extent mft " in map_extent_mft_record()
288 ntfs_error(base_ni->vol->sb, "Failed to map extent " in map_extent_mft_record()
293 ni = ntfs_new_extent_inode(base_ni->vol->sb, mft_no); in map_extent_mft_record()
299 ni->vol = base_ni->vol; in map_extent_mft_record()
313 ntfs_error(base_ni->vol->sb, "Found stale extent mft " in map_extent_mft_record()
326 ntfs_error(base_ni->vol->sb, "Failed to allocate " in map_extent_mft_record()
427 static int ntfs_sync_mft_mirror_umount(ntfs_volume *vol, in ntfs_sync_mft_mirror_umount() argument
430 BUG_ON(vol->mftmirr_ino); in ntfs_sync_mft_mirror_umount()
431 ntfs_error(vol->sb, "Umount time mft mirror syncing is not " in ntfs_sync_mft_mirror_umount()
454 int ntfs_sync_mft_mirror(ntfs_volume *vol, const unsigned long mft_no, in ntfs_sync_mft_mirror() argument
458 unsigned int blocksize = vol->sb->s_blocksize; in ntfs_sync_mft_mirror()
459 int max_bhs = vol->mft_record_size / blocksize; in ntfs_sync_mft_mirror()
466 unsigned char blocksize_bits = vol->sb->s_blocksize_bits; in ntfs_sync_mft_mirror()
472 if (unlikely(!vol->mftmirr_ino)) { in ntfs_sync_mft_mirror()
474 err = ntfs_sync_mft_mirror_umount(vol, mft_no, m); in ntfs_sync_mft_mirror()
480 page = ntfs_map_page(vol->mftmirr_ino->i_mapping, mft_no >> in ntfs_sync_mft_mirror()
481 (PAGE_SHIFT - vol->mft_record_size_bits)); in ntfs_sync_mft_mirror()
483 ntfs_error(vol->sb, "Failed to map mft mirror page."); in ntfs_sync_mft_mirror()
491 page_ofs = (mft_no << vol->mft_record_size_bits) & ~PAGE_MASK; in ntfs_sync_mft_mirror()
495 memcpy(kmirr, m, vol->mft_record_size); in ntfs_sync_mft_mirror()
515 m_end = m_start + vol->mft_record_size; in ntfs_sync_mft_mirror()
529 bh->b_bdev = vol->sb->s_bdev; in ntfs_sync_mft_mirror()
531 vcn = ((VCN)mft_no << vol->mft_record_size_bits) + in ntfs_sync_mft_mirror()
533 vcn_ofs = vcn & vol->cluster_size_mask; in ntfs_sync_mft_mirror()
534 vcn >>= vol->cluster_size_bits; in ntfs_sync_mft_mirror()
536 down_read(&NTFS_I(vol->mftmirr_ino)-> in ntfs_sync_mft_mirror()
538 rl = NTFS_I(vol->mftmirr_ino)->runlist.rl; in ntfs_sync_mft_mirror()
553 vol->cluster_size_bits) + in ntfs_sync_mft_mirror()
558 ntfs_error(vol->sb, "Cannot write mft mirror " in ntfs_sync_mft_mirror()
574 up_read(&NTFS_I(vol->mftmirr_ino)->runlist.lock); in ntfs_sync_mft_mirror()
617 ntfs_error(vol->sb, "I/O error while writing mft mirror " in ntfs_sync_mft_mirror()
620 ntfs_error(vol->sb, "Failed to synchronize $MFTMirr (error " in ntfs_sync_mft_mirror()
624 NVolSetErrors(vol); in ntfs_sync_mft_mirror()
662 ntfs_volume *vol = ni->vol; in write_mft_record_nolock() local
664 unsigned int blocksize = vol->sb->s_blocksize; in write_mft_record_nolock()
665 unsigned char blocksize_bits = vol->sb->s_blocksize_bits; in write_mft_record_nolock()
666 int max_bhs = vol->mft_record_size / blocksize; in write_mft_record_nolock()
695 m_end = m_start + vol->mft_record_size; in write_mft_record_nolock()
722 bh->b_bdev = vol->sb->s_bdev; in write_mft_record_nolock()
724 vcn = ((VCN)ni->mft_no << vol->mft_record_size_bits) + in write_mft_record_nolock()
726 vcn_ofs = vcn & vol->cluster_size_mask; in write_mft_record_nolock()
727 vcn >>= vol->cluster_size_bits; in write_mft_record_nolock()
729 down_read(&NTFS_I(vol->mft_ino)->runlist.lock); in write_mft_record_nolock()
730 rl = NTFS_I(vol->mft_ino)->runlist.rl; in write_mft_record_nolock()
741 vol->cluster_size_bits) + in write_mft_record_nolock()
746 ntfs_error(vol->sb, "Cannot write mft record " in write_mft_record_nolock()
761 up_read(&NTFS_I(vol->mft_ino)->runlist.lock); in write_mft_record_nolock()
767 err = pre_write_mst_fixup((NTFS_RECORD*)m, vol->mft_record_size); in write_mft_record_nolock()
769 ntfs_error(vol->sb, "Failed to apply mst fixups!"); in write_mft_record_nolock()
786 if (!sync && ni->mft_no < vol->mftmirr_size) in write_mft_record_nolock()
787 ntfs_sync_mft_mirror(vol, ni->mft_no, m, sync); in write_mft_record_nolock()
804 if (sync && ni->mft_no < vol->mftmirr_size) in write_mft_record_nolock()
805 ntfs_sync_mft_mirror(vol, ni->mft_no, m, sync); in write_mft_record_nolock()
811 ntfs_error(vol->sb, "I/O error while writing mft record " in write_mft_record_nolock()
832 ntfs_error(vol->sb, "Not enough memory to write mft record. " in write_mft_record_nolock()
837 NVolSetErrors(vol); in write_mft_record_nolock()
920 bool ntfs_may_write_mft_record(ntfs_volume *vol, const unsigned long mft_no, in ntfs_may_write_mft_record() argument
923 struct super_block *sb = vol->sb; in ntfs_may_write_mft_record()
924 struct inode *mft_vi = vol->mft_ino; in ntfs_may_write_mft_record()
1126 static int ntfs_mft_bitmap_find_and_alloc_free_rec_nolock(ntfs_volume *vol, in ntfs_mft_bitmap_find_and_alloc_free_rec_nolock() argument
1139 mftbmp_mapping = vol->mftbmp_ino->i_mapping; in ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1144 read_lock_irqsave(&NTFS_I(vol->mft_ino)->size_lock, flags); in ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1145 pass_end = NTFS_I(vol->mft_ino)->allocated_size >> in ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1146 vol->mft_record_size_bits; in ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1147 read_unlock_irqrestore(&NTFS_I(vol->mft_ino)->size_lock, flags); in ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1148 read_lock_irqsave(&NTFS_I(vol->mftbmp_ino)->size_lock, flags); in ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1149 ll = NTFS_I(vol->mftbmp_ino)->initialized_size << 3; in ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1150 read_unlock_irqrestore(&NTFS_I(vol->mftbmp_ino)->size_lock, flags); in ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1155 data_pos = vol->mft_data_pos; in ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1190 ntfs_error(vol->sb, "Failed to read mft " in ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1273 static int ntfs_mft_bitmap_extend_allocation_nolock(ntfs_volume *vol) in ntfs_mft_bitmap_extend_allocation_nolock() argument
1294 mft_ni = NTFS_I(vol->mft_ino); in ntfs_mft_bitmap_extend_allocation_nolock()
1295 mftbmp_ni = NTFS_I(vol->mftbmp_ino); in ntfs_mft_bitmap_extend_allocation_nolock()
1305 (ll - 1) >> vol->cluster_size_bits, NULL); in ntfs_mft_bitmap_extend_allocation_nolock()
1308 ntfs_error(vol->sb, "Failed to determine last allocated " in ntfs_mft_bitmap_extend_allocation_nolock()
1325 page = ntfs_map_page(vol->lcnbmp_ino->i_mapping, in ntfs_mft_bitmap_extend_allocation_nolock()
1329 ntfs_error(vol->sb, "Failed to read from lcn bitmap."); in ntfs_mft_bitmap_extend_allocation_nolock()
1334 down_write(&vol->lcnbmp_lock); in ntfs_mft_bitmap_extend_allocation_nolock()
1340 up_write(&vol->lcnbmp_lock); in ntfs_mft_bitmap_extend_allocation_nolock()
1348 up_write(&vol->lcnbmp_lock); in ntfs_mft_bitmap_extend_allocation_nolock()
1351 rl2 = ntfs_cluster_alloc(vol, rl[1].vcn, 1, lcn, DATA_ZONE, in ntfs_mft_bitmap_extend_allocation_nolock()
1355 ntfs_error(vol->sb, "Failed to allocate a cluster for " in ntfs_mft_bitmap_extend_allocation_nolock()
1362 ntfs_error(vol->sb, "Failed to merge runlists for mft " in ntfs_mft_bitmap_extend_allocation_nolock()
1364 if (ntfs_cluster_free_from_rl(vol, rl2)) { in ntfs_mft_bitmap_extend_allocation_nolock()
1365 ntfs_error(vol->sb, "Failed to deallocate " in ntfs_mft_bitmap_extend_allocation_nolock()
1367 NVolSetErrors(vol); in ntfs_mft_bitmap_extend_allocation_nolock()
1385 ntfs_error(vol->sb, "Failed to map mft record."); in ntfs_mft_bitmap_extend_allocation_nolock()
1391 ntfs_error(vol->sb, "Failed to get search context."); in ntfs_mft_bitmap_extend_allocation_nolock()
1399 ntfs_error(vol->sb, "Failed to find last attribute extent of " in ntfs_mft_bitmap_extend_allocation_nolock()
1415 mp_size = ntfs_get_size_for_mapping_pairs(vol, rl2, ll, -1); in ntfs_mft_bitmap_extend_allocation_nolock()
1417 ntfs_error(vol->sb, "Get size for mapping pairs failed for " in ntfs_mft_bitmap_extend_allocation_nolock()
1430 ntfs_error(vol->sb, "Failed to resize attribute " in ntfs_mft_bitmap_extend_allocation_nolock()
1439 ntfs_error(vol->sb, "Not enough space in this mft record to " in ntfs_mft_bitmap_extend_allocation_nolock()
1447 ret = ntfs_mapping_pairs_build(vol, (u8*)a + in ntfs_mft_bitmap_extend_allocation_nolock()
1451 ntfs_error(vol->sb, "Failed to build mapping pairs array for " in ntfs_mft_bitmap_extend_allocation_nolock()
1473 ntfs_error(vol->sb, "Failed to find first attribute " in ntfs_mft_bitmap_extend_allocation_nolock()
1480 mftbmp_ni->allocated_size += vol->cluster_size; in ntfs_mft_bitmap_extend_allocation_nolock()
1497 ntfs_error(vol->sb, "Failed to find last attribute extent of " in ntfs_mft_bitmap_extend_allocation_nolock()
1500 mftbmp_ni->allocated_size += vol->cluster_size; in ntfs_mft_bitmap_extend_allocation_nolock()
1509 NVolSetErrors(vol); in ntfs_mft_bitmap_extend_allocation_nolock()
1526 down_write(&vol->lcnbmp_lock); in ntfs_mft_bitmap_extend_allocation_nolock()
1527 if (ntfs_bitmap_clear_bit(vol->lcnbmp_ino, lcn)) { in ntfs_mft_bitmap_extend_allocation_nolock()
1528 ntfs_error(vol->sb, "Failed to free allocated cluster.%s", es); in ntfs_mft_bitmap_extend_allocation_nolock()
1529 NVolSetErrors(vol); in ntfs_mft_bitmap_extend_allocation_nolock()
1531 up_write(&vol->lcnbmp_lock); in ntfs_mft_bitmap_extend_allocation_nolock()
1533 if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( in ntfs_mft_bitmap_extend_allocation_nolock()
1538 ntfs_error(vol->sb, "Failed to restore mapping pairs " in ntfs_mft_bitmap_extend_allocation_nolock()
1540 NVolSetErrors(vol); in ntfs_mft_bitmap_extend_allocation_nolock()
1543 ntfs_error(vol->sb, "Failed to restore attribute " in ntfs_mft_bitmap_extend_allocation_nolock()
1545 NVolSetErrors(vol); in ntfs_mft_bitmap_extend_allocation_nolock()
1572 static int ntfs_mft_bitmap_extend_initialized_nolock(ntfs_volume *vol) in ntfs_mft_bitmap_extend_initialized_nolock() argument
1584 mft_ni = NTFS_I(vol->mft_ino); in ntfs_mft_bitmap_extend_initialized_nolock()
1585 mftbmp_vi = vol->mftbmp_ino; in ntfs_mft_bitmap_extend_initialized_nolock()
1590 ntfs_error(vol->sb, "Failed to map mft record."); in ntfs_mft_bitmap_extend_initialized_nolock()
1595 ntfs_error(vol->sb, "Failed to get search context."); in ntfs_mft_bitmap_extend_initialized_nolock()
1602 ntfs_error(vol->sb, "Failed to find first attribute extent of " in ntfs_mft_bitmap_extend_initialized_nolock()
1638 ntfs_error(vol->sb, "Failed to write to mft bitmap."); in ntfs_mft_bitmap_extend_initialized_nolock()
1642 ntfs_error(vol->sb, "Failed to map mft record.%s", es); in ntfs_mft_bitmap_extend_initialized_nolock()
1643 NVolSetErrors(vol); in ntfs_mft_bitmap_extend_initialized_nolock()
1648 ntfs_error(vol->sb, "Failed to get search context.%s", es); in ntfs_mft_bitmap_extend_initialized_nolock()
1649 NVolSetErrors(vol); in ntfs_mft_bitmap_extend_initialized_nolock()
1654 ntfs_error(vol->sb, "Failed to find first attribute extent of " in ntfs_mft_bitmap_extend_initialized_nolock()
1656 NVolSetErrors(vol); in ntfs_mft_bitmap_extend_initialized_nolock()
1709 static int ntfs_mft_data_extend_allocation_nolock(ntfs_volume *vol) in ntfs_mft_data_extend_allocation_nolock() argument
1725 mft_ni = NTFS_I(vol->mft_ino); in ntfs_mft_data_extend_allocation_nolock()
1736 (ll - 1) >> vol->cluster_size_bits, NULL); in ntfs_mft_data_extend_allocation_nolock()
1739 ntfs_error(vol->sb, "Failed to determine last allocated " in ntfs_mft_data_extend_allocation_nolock()
1750 min_nr = vol->mft_record_size >> vol->cluster_size_bits; in ntfs_mft_data_extend_allocation_nolock()
1754 nr = vol->mft_record_size << 4 >> vol->cluster_size_bits; in ntfs_mft_data_extend_allocation_nolock()
1761 if (unlikely((ll + (nr << vol->cluster_size_bits)) >> in ntfs_mft_data_extend_allocation_nolock()
1762 vol->mft_record_size_bits >= (1ll << 32))) { in ntfs_mft_data_extend_allocation_nolock()
1764 if (unlikely((ll + (nr << vol->cluster_size_bits)) >> in ntfs_mft_data_extend_allocation_nolock()
1765 vol->mft_record_size_bits >= (1ll << 32))) { in ntfs_mft_data_extend_allocation_nolock()
1766 ntfs_warning(vol->sb, "Cannot allocate mft record " in ntfs_mft_data_extend_allocation_nolock()
1777 rl2 = ntfs_cluster_alloc(vol, old_last_vcn, nr, lcn, MFT_ZONE, in ntfs_mft_data_extend_allocation_nolock()
1782 ntfs_error(vol->sb, "Failed to allocate the minimal " in ntfs_mft_data_extend_allocation_nolock()
1800 ntfs_error(vol->sb, "Failed to merge runlists for mft data " in ntfs_mft_data_extend_allocation_nolock()
1802 if (ntfs_cluster_free_from_rl(vol, rl2)) { in ntfs_mft_data_extend_allocation_nolock()
1803 ntfs_error(vol->sb, "Failed to deallocate clusters " in ntfs_mft_data_extend_allocation_nolock()
1805 NVolSetErrors(vol); in ntfs_mft_data_extend_allocation_nolock()
1818 ntfs_error(vol->sb, "Failed to map mft record."); in ntfs_mft_data_extend_allocation_nolock()
1824 ntfs_error(vol->sb, "Failed to get search context."); in ntfs_mft_data_extend_allocation_nolock()
1831 ntfs_error(vol->sb, "Failed to find last attribute extent of " in ntfs_mft_data_extend_allocation_nolock()
1847 mp_size = ntfs_get_size_for_mapping_pairs(vol, rl2, ll, -1); in ntfs_mft_data_extend_allocation_nolock()
1849 ntfs_error(vol->sb, "Get size for mapping pairs failed for " in ntfs_mft_data_extend_allocation_nolock()
1862 ntfs_error(vol->sb, "Failed to resize attribute " in ntfs_mft_data_extend_allocation_nolock()
1876 ntfs_error(vol->sb, "Not enough space in this mft record to " in ntfs_mft_data_extend_allocation_nolock()
1884 ret = ntfs_mapping_pairs_build(vol, (u8*)a + in ntfs_mft_data_extend_allocation_nolock()
1888 ntfs_error(vol->sb, "Failed to build mapping pairs array of " in ntfs_mft_data_extend_allocation_nolock()
1912 ntfs_error(vol->sb, "Failed to find first attribute " in ntfs_mft_data_extend_allocation_nolock()
1919 mft_ni->allocated_size += nr << vol->cluster_size_bits; in ntfs_mft_data_extend_allocation_nolock()
1935 ntfs_error(vol->sb, "Failed to find last attribute extent of " in ntfs_mft_data_extend_allocation_nolock()
1938 mft_ni->allocated_size += nr << vol->cluster_size_bits; in ntfs_mft_data_extend_allocation_nolock()
1947 NVolSetErrors(vol); in ntfs_mft_data_extend_allocation_nolock()
1954 ntfs_error(vol->sb, "Failed to free clusters from mft data " in ntfs_mft_data_extend_allocation_nolock()
1956 NVolSetErrors(vol); in ntfs_mft_data_extend_allocation_nolock()
1959 if (ntfs_rl_truncate_nolock(vol, &mft_ni->runlist, old_last_vcn)) { in ntfs_mft_data_extend_allocation_nolock()
1960 ntfs_error(vol->sb, "Failed to truncate mft data attribute " in ntfs_mft_data_extend_allocation_nolock()
1962 NVolSetErrors(vol); in ntfs_mft_data_extend_allocation_nolock()
1965 if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( in ntfs_mft_data_extend_allocation_nolock()
1970 ntfs_error(vol->sb, "Failed to restore mapping pairs " in ntfs_mft_data_extend_allocation_nolock()
1972 NVolSetErrors(vol); in ntfs_mft_data_extend_allocation_nolock()
1975 ntfs_error(vol->sb, "Failed to restore attribute " in ntfs_mft_data_extend_allocation_nolock()
1977 NVolSetErrors(vol); in ntfs_mft_data_extend_allocation_nolock()
1982 ntfs_error(vol->sb, "Failed to restore attribute search " in ntfs_mft_data_extend_allocation_nolock()
1984 NVolSetErrors(vol); in ntfs_mft_data_extend_allocation_nolock()
2007 static int ntfs_mft_record_layout(const ntfs_volume *vol, const s64 mft_no, in ntfs_mft_record_layout() argument
2014 ntfs_error(vol->sb, "Mft record number 0x%llx exceeds " in ntfs_mft_record_layout()
2019 memset(m, 0, vol->mft_record_size); in ntfs_mft_record_layout()
2021 if (vol->major_ver < 3 || (vol->major_ver == 3 && !vol->minor_ver)) in ntfs_mft_record_layout()
2033 if (vol->mft_record_size >= NTFS_BLOCK_SIZE) in ntfs_mft_record_layout()
2034 m->usa_count = cpu_to_le16(vol->mft_record_size / in ntfs_mft_record_layout()
2038 ntfs_warning(vol->sb, "Sector size is bigger than mft record " in ntfs_mft_record_layout()
2064 m->bytes_allocated = cpu_to_le32(vol->mft_record_size); in ntfs_mft_record_layout()
2086 static int ntfs_mft_record_format(const ntfs_volume *vol, const s64 mft_no) in ntfs_mft_record_format() argument
2089 struct inode *mft_vi = vol->mft_ino; in ntfs_mft_record_format()
2101 index = mft_no << vol->mft_record_size_bits >> PAGE_SHIFT; in ntfs_mft_record_format()
2102 ofs = (mft_no << vol->mft_record_size_bits) & ~PAGE_MASK; in ntfs_mft_record_format()
2107 if (unlikely(index > end_index || ofs + vol->mft_record_size >= in ntfs_mft_record_format()
2109 ntfs_error(vol->sb, "Tried to format non-existing mft " in ntfs_mft_record_format()
2117 ntfs_error(vol->sb, "Failed to map page containing mft record " in ntfs_mft_record_format()
2125 err = ntfs_mft_record_layout(vol, mft_no, m); in ntfs_mft_record_format()
2127 ntfs_error(vol->sb, "Failed to layout mft record 0x%llx.", in ntfs_mft_record_format()
2238 ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, const int mode, in ntfs_mft_record_alloc() argument
2271 mft_ni = NTFS_I(vol->mft_ino); in ntfs_mft_record_alloc()
2272 mftbmp_ni = NTFS_I(vol->mftbmp_ino); in ntfs_mft_record_alloc()
2273 down_write(&vol->mftbmp_lock); in ntfs_mft_record_alloc()
2274 bit = ntfs_mft_bitmap_find_and_alloc_free_rec_nolock(vol, base_ni); in ntfs_mft_record_alloc()
2281 up_write(&vol->mftbmp_lock); in ntfs_mft_record_alloc()
2293 ll = mft_ni->initialized_size >> vol->mft_record_size_bits; in ntfs_mft_record_alloc()
2321 (long long)i_size_read(vol->mftbmp_ino), in ntfs_mft_record_alloc()
2327 err = ntfs_mft_bitmap_extend_allocation_nolock(vol); in ntfs_mft_record_alloc()
2329 up_write(&vol->mftbmp_lock); in ntfs_mft_record_alloc()
2338 (long long)i_size_read(vol->mftbmp_ino), in ntfs_mft_record_alloc()
2348 err = ntfs_mft_bitmap_extend_initialized_nolock(vol); in ntfs_mft_record_alloc()
2350 up_write(&vol->mftbmp_lock); in ntfs_mft_record_alloc()
2359 (long long)i_size_read(vol->mftbmp_ino), in ntfs_mft_record_alloc()
2367 err = ntfs_bitmap_set_bit(vol->mftbmp_ino, bit); in ntfs_mft_record_alloc()
2369 ntfs_error(vol->sb, "Failed to allocate bit in mft bitmap."); in ntfs_mft_record_alloc()
2370 up_write(&vol->mftbmp_lock); in ntfs_mft_record_alloc()
2383 ll = (bit + 1) << vol->mft_record_size_bits; in ntfs_mft_record_alloc()
2403 (long long)i_size_read(vol->mft_ino), in ntfs_mft_record_alloc()
2407 err = ntfs_mft_data_extend_allocation_nolock(vol); in ntfs_mft_record_alloc()
2409 ntfs_error(vol->sb, "Failed to extend mft data " in ntfs_mft_record_alloc()
2418 (long long)i_size_read(vol->mft_ino), in ntfs_mft_record_alloc()
2431 old_data_size = vol->mft_ino->i_size; in ntfs_mft_record_alloc()
2436 vol->mft_record_size; in ntfs_mft_record_alloc()
2437 mft_no = mft_ni->initialized_size >> vol->mft_record_size_bits; in ntfs_mft_record_alloc()
2438 if (new_initialized_size > i_size_read(vol->mft_ino)) in ntfs_mft_record_alloc()
2439 i_size_write(vol->mft_ino, new_initialized_size); in ntfs_mft_record_alloc()
2443 err = ntfs_mft_record_format(vol, mft_no); in ntfs_mft_record_alloc()
2445 ntfs_error(vol->sb, "Failed to format mft record."); in ntfs_mft_record_alloc()
2456 ntfs_error(vol->sb, "Failed to map mft record."); in ntfs_mft_record_alloc()
2462 ntfs_error(vol->sb, "Failed to get search context."); in ntfs_mft_record_alloc()
2470 ntfs_error(vol->sb, "Failed to find first attribute extent of " in ntfs_mft_record_alloc()
2481 cpu_to_sle64(i_size_read(vol->mft_ino)); in ntfs_mft_record_alloc()
2493 (long long)i_size_read(vol->mft_ino), in ntfs_mft_record_alloc()
2495 BUG_ON(i_size_read(vol->mft_ino) > mft_ni->allocated_size); in ntfs_mft_record_alloc()
2496 BUG_ON(mft_ni->initialized_size > i_size_read(vol->mft_ino)); in ntfs_mft_record_alloc()
2508 up_write(&vol->mftbmp_lock); in ntfs_mft_record_alloc()
2513 index = bit << vol->mft_record_size_bits >> PAGE_SHIFT; in ntfs_mft_record_alloc()
2514 ofs = (bit << vol->mft_record_size_bits) & ~PAGE_MASK; in ntfs_mft_record_alloc()
2516 page = ntfs_map_page(vol->mft_ino->i_mapping, index); in ntfs_mft_record_alloc()
2518 ntfs_error(vol->sb, "Failed to map page containing allocated " in ntfs_mft_record_alloc()
2532 ntfs_error(vol->sb, "Mft record 0x%llx was marked " in ntfs_mft_record_alloc()
2541 NVolSetErrors(vol); in ntfs_mft_record_alloc()
2553 err = ntfs_mft_record_layout(vol, bit, m); in ntfs_mft_record_alloc()
2555 ntfs_error(vol->sb, "Failed to layout allocated mft " in ntfs_mft_record_alloc()
2590 ntfs_error(vol->sb, "Failed to map allocated extent " in ntfs_mft_record_alloc()
2624 vi = new_inode(vol->sb); in ntfs_mft_record_alloc()
2640 vi->i_uid = vol->uid; in ntfs_mft_record_alloc()
2641 vi->i_gid = vol->gid; in ntfs_mft_record_alloc()
2652 vi->i_mode &= ~vol->dmask; in ntfs_mft_record_alloc()
2662 if (vol->cluster_size <= ni->itype.index.block_size) { in ntfs_mft_record_alloc()
2663 ni->itype.index.vcn_size = vol->cluster_size; in ntfs_mft_record_alloc()
2665 vol->cluster_size_bits; in ntfs_mft_record_alloc()
2667 ni->itype.index.vcn_size = vol->sector_size; in ntfs_mft_record_alloc()
2669 vol->sector_size_bits; in ntfs_mft_record_alloc()
2673 vi->i_mode &= ~vol->fmask; in ntfs_mft_record_alloc()
2719 vol->mft_data_pos = bit + 1; in ntfs_mft_record_alloc()
2732 i_size_write(vol->mft_ino, old_data_size); in ntfs_mft_record_alloc()
2736 down_write(&vol->mftbmp_lock); in ntfs_mft_record_alloc()
2738 if (ntfs_bitmap_clear_bit(vol->mftbmp_ino, bit)) { in ntfs_mft_record_alloc()
2739 ntfs_error(vol->sb, "Failed to clear bit in mft bitmap.%s", es); in ntfs_mft_record_alloc()
2740 NVolSetErrors(vol); in ntfs_mft_record_alloc()
2742 up_write(&vol->mftbmp_lock); in ntfs_mft_record_alloc()
2746 ntfs_warning(vol->sb, "Cannot allocate mft record because the maximum " in ntfs_mft_record_alloc()
2748 up_write(&vol->mftbmp_lock); in ntfs_mft_record_alloc()
2776 ntfs_volume *vol = ni->vol; in ntfs_extent_mft_record_free() local
2799 ntfs_error(vol->sb, "Tried to free busy extent inode 0x%lx, " in ntfs_extent_mft_record_free()
2822 ntfs_error(vol->sb, "Extent inode 0x%lx is not attached to " in ntfs_extent_mft_record_free()
2853 ntfs_error(vol->sb, "Failed to write mft record 0x%lx, not " in ntfs_extent_mft_record_free()
2863 down_write(&vol->mftbmp_lock); in ntfs_extent_mft_record_free()
2864 err = ntfs_bitmap_clear_bit(vol->mftbmp_ino, mft_no); in ntfs_extent_mft_record_free()
2865 up_write(&vol->mftbmp_lock); in ntfs_extent_mft_record_free()
2872 ntfs_error(vol->sb, "Failed to clear bit in mft bitmap.%s", es); in ntfs_extent_mft_record_free()
2873 NVolSetErrors(vol); in ntfs_extent_mft_record_free()
2885 ntfs_error(vol->sb, "Failed to allocate internal " in ntfs_extent_mft_record_free()
2888 NVolSetErrors(vol); in ntfs_extent_mft_record_free()