Commit b1c51d26 authored by Anton Altaparmakov's avatar Anton Altaparmakov

NTFS: Determine the mft mirror size as the number of mirrored mft records

      and store it in ntfs_volume->mftmirr_size (fs/ntfs/super.c).
parent 2722e5dd
...@@ -35,6 +35,8 @@ ToDo: ...@@ -35,6 +35,8 @@ ToDo:
fs/ntfs/inode.h and use it to declare NInoTest{Set,Clear}Dirty. fs/ntfs/inode.h and use it to declare NInoTest{Set,Clear}Dirty.
- Move typedefs for ntfs_attr and test_t from fs/ntfs/inode.c to - Move typedefs for ntfs_attr and test_t from fs/ntfs/inode.c to
fs/ntfs/inode.h so they can be used elsewhere. fs/ntfs/inode.h so they can be used elsewhere.
- Determine the mft mirror size as the number of mirrored mft records
and store it in ntfs_volume->mftmirr_size (fs/ntfs/super.c).
2.1.7 - Enable NFS exporting of mounted NTFS volumes. 2.1.7 - Enable NFS exporting of mounted NTFS volumes.
......
...@@ -45,7 +45,7 @@ static inline void unmap_extent_mft_record(ntfs_inode *ni) ...@@ -45,7 +45,7 @@ static inline void unmap_extent_mft_record(ntfs_inode *ni)
#ifdef NTFS_RW #ifdef NTFS_RW
/* /**
* flush_dcache_mft_record_page - flush_dcache_page() for mft records * flush_dcache_mft_record_page - flush_dcache_page() for mft records
* @ni: ntfs inode structure of mft record * @ni: ntfs inode structure of mft record
* *
......
...@@ -657,6 +657,20 @@ static BOOL parse_ntfs_boot_sector(ntfs_volume *vol, const NTFS_BOOT_SECTOR *b) ...@@ -657,6 +657,20 @@ static BOOL parse_ntfs_boot_sector(ntfs_volume *vol, const NTFS_BOOT_SECTOR *b)
} }
vol->mftmirr_lcn = ll; vol->mftmirr_lcn = ll;
ntfs_debug("vol->mftmirr_lcn = 0x%Lx", (long long)vol->mftmirr_lcn); ntfs_debug("vol->mftmirr_lcn = 0x%Lx", (long long)vol->mftmirr_lcn);
/*
* Work out the size of the mft mirror in number of mft records. If the
* cluster size is less than or equal to the size taken by four mft
* records, the mft mirror stores the first four mft records. If the
* cluster size is bigger than the size taken by four mft records, the
* mft mirror contains as many mft records as will fit into one
* cluster.
*/
if (vol->cluster_size <= (4 << vol->mft_record_size_bits))
vol->mftmirr_size = 4;
else
vol->mftmirr_size = vol->cluster_size >>
vol->mft_record_size_bits;
ntfs_debug("vol->mftmirr_size = %i", vol->mftmirr_size);
vol->serial_no = le64_to_cpu(b->volume_serial_number); vol->serial_no = le64_to_cpu(b->volume_serial_number);
ntfs_debug("vol->serial_no = 0x%Lx", ntfs_debug("vol->serial_no = 0x%Lx",
(unsigned long long)vol->serial_no); (unsigned long long)vol->serial_no);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* volume.h - Defines for volume structures in NTFS Linux kernel driver. Part * volume.h - Defines for volume structures in NTFS Linux kernel driver. Part
* of the Linux-NTFS project. * of the Linux-NTFS project.
* *
* Copyright (c) 2001,2002 Anton Altaparmakov. * Copyright (c) 2001-2004 Anton Altaparmakov.
* Copyright (c) 2002 Richard Russon. * Copyright (c) 2002 Richard Russon.
* *
* This program/include file is free software; you can redistribute it and/or * This program/include file is free software; you can redistribute it and/or
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#define _LINUX_NTFS_VOLUME_H #define _LINUX_NTFS_VOLUME_H
#include "types.h" #include "types.h"
#include "layout.h"
/* /*
* The NTFS in memory super block structure. * The NTFS in memory super block structure.
...@@ -83,13 +84,17 @@ typedef struct { ...@@ -83,13 +84,17 @@ typedef struct {
bits in mft bitmap. */ bits in mft bitmap. */
struct inode *mftmirr_ino; /* The VFS inode of $MFTMirr. */ struct inode *mftmirr_ino; /* The VFS inode of $MFTMirr. */
int mftmirr_size; /* Size of mft mirror in mft records. */
struct inode *lcnbmp_ino; /* The VFS inode of $Bitmap. */ struct inode *lcnbmp_ino; /* The VFS inode of $Bitmap. */
struct rw_semaphore lcnbmp_lock; /* Lock for serializing accesses to the struct rw_semaphore lcnbmp_lock; /* Lock for serializing accesses to the
cluster bitmap ($Bitmap/$DATA). */ cluster bitmap ($Bitmap/$DATA). */
struct inode *vol_ino; /* The VFS inode of $Volume. */ struct inode *vol_ino; /* The VFS inode of $Volume. */
unsigned long vol_flags; /* Volume flags (VOLUME_*). */ VOLUME_FLAGS vol_flags; /* Volume flags (VOLUME_*). */
u8 major_ver; /* Ntfs major version of volume. */ u8 major_ver; /* Ntfs major version of volume. */
u8 minor_ver; /* Ntfs minor version of volume. */ u8 minor_ver; /* Ntfs minor version of volume. */
struct inode *root_ino; /* The VFS inode of the root struct inode *root_ino; /* The VFS inode of the root
directory. */ directory. */
struct inode *secure_ino; /* The VFS inode of $Secure (NTFS3.0+ struct inode *secure_ino; /* The VFS inode of $Secure (NTFS3.0+
...@@ -133,4 +138,3 @@ NVOL_FNS(ShowSystemFiles) ...@@ -133,4 +138,3 @@ NVOL_FNS(ShowSystemFiles)
NVOL_FNS(CaseSensitive) NVOL_FNS(CaseSensitive)
#endif /* _LINUX_NTFS_VOLUME_H */ #endif /* _LINUX_NTFS_VOLUME_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment