Commit e0f5cb89 authored by Richard Russon's avatar Richard Russon

Merge flatcap.org:/home/flatcap/backup/bk/ntfs-2.6

into flatcap.org:/home/flatcap/backup/bk/ntfs-2.6-devel
parents e7f10a52 73e62ce4
......@@ -21,6 +21,14 @@ ToDo/Notes:
- Enable the code for setting the NT4 compatibility flag when we start
making NTFS 1.2 specific modifications.
2.1.18-WIP
- Remove vol->nr_mft_records as it was pretty meaningless and optimize
the calculation of total/free inodes as used by statfs().
- Fix scheduling latencies in ntfs_fill_super() by dropping the BKL
because the code itself is using the ntfs_lock semaphore which
provides safe locking. (Ingo Molnar)
2.1.17 - Fix bugs in mount time error code paths and other updates.
- Implement bitmap modification code (fs/ntfs/bitmap.[hc]). This
......
......@@ -6,7 +6,7 @@ ntfs-objs := aops.o attrib.o collate.o compress.o debug.o dir.o file.o \
index.o inode.o mft.o mst.o namei.o super.o sysctl.o unistr.o \
upcase.o
EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.17\"
EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.18-WIP\"
ifeq ($(CONFIG_NTFS_DEBUG),y)
EXTRA_CFLAGS += -DDEBUG
......
......@@ -127,7 +127,7 @@ void __ntfs_debug (const char *file, int line, const char *function,
va_start(args, fmt);
vsnprintf(err_buf, sizeof(err_buf), fmt, args);
va_end(args);
printk(KERN_DEBUG "NTFS-fs DEBUG (%s, %d): %s: %s\n",
printk(KERN_DEBUG "NTFS-fs DEBUG (%s, %d): %s(): %s\n",
file, line, flen ? function : "", err_buf);
spin_unlock(&err_buf_lock);
}
......
......@@ -1900,8 +1900,6 @@ int ntfs_read_inode_mount(struct inode *vi)
/* Are we in the first extent? */
if (!next_vcn) {
u64 ll;
if (attr->data.non_resident.lowest_vcn) {
ntfs_error(sb, "First extent of $DATA "
"attribute has non zero "
......@@ -1920,17 +1918,15 @@ int ntfs_read_inode_mount(struct inode *vi)
non_resident.initialized_size);
ni->allocated_size = sle64_to_cpu(
attr->data.non_resident.allocated_size);
/* Set the number of mft records. */
ll = vi->i_size >> vol->mft_record_size_bits;
/*
* Verify the number of mft records does not exceed
* 2^32 - 1.
*/
if (ll >= (1ULL << 32)) {
if ((vi->i_size >> vol->mft_record_size_bits) >=
(1ULL << 32)) {
ntfs_error(sb, "$MFT is too big! Aborting.");
goto put_err_out;
}
vol->nr_mft_records = ll;
/*
* We have got the first extent of the runlist for
* $MFT which means it is now relatively safe to call
......
......@@ -418,7 +418,8 @@ MFT_RECORD *map_extent_mft_record(ntfs_inode *base_ni, MFT_REF mref,
m = ERR_PTR(-ENOMEM);
goto unm_err_out;
}
if (base_ni->ext.extent_ntfs_inos) {
if (base_ni->nr_extents) {
BUG_ON(!base_ni->ext.extent_ntfs_inos);
memcpy(tmp, base_ni->ext.extent_ntfs_inos, new_size -
4 * sizeof(ntfs_inode *));
kfree(base_ni->ext.extent_ntfs_inos);
......
......@@ -29,6 +29,7 @@
#include <linux/buffer_head.h>
#include <linux/vfs.h>
#include <linux/moduleparam.h>
#include <linux/smp_lock.h>
#include "ntfs.h"
#include "sysctl.h"
......@@ -2013,7 +2014,7 @@ static s64 get_nr_free_clusters(ntfs_volume *vol)
*/
static unsigned long __get_nr_free_mft_records(ntfs_volume *vol)
{
s64 nr_free = vol->nr_mft_records;
s64 nr_free;
u32 *kaddr;
struct address_space *mapping = vol->mftbmp_ino->i_mapping;
filler_t *readpage = (filler_t*)mapping->a_ops->readpage;
......@@ -2022,13 +2023,16 @@ static unsigned long __get_nr_free_mft_records(ntfs_volume *vol)
unsigned int max_size;
ntfs_debug("Entering.");
/* Number of mft records in file system (at this point in time). */
nr_free = vol->mft_ino->i_size >> vol->mft_record_size_bits;
/*
* Convert the number of bits into bytes rounded up, then convert into
* multiples of PAGE_CACHE_SIZE, rounding up so that if we have one
* full and one partial page max_index = 2.
* Convert the maximum number of set bits into bytes rounded up, then
* convert into multiples of PAGE_CACHE_SIZE, rounding up so that if we
* have one full and one partial page max_index = 2.
*/
max_index = (((vol->nr_mft_records + 7) >> 3) + PAGE_CACHE_SIZE - 1) >>
PAGE_CACHE_SHIFT;
max_index = ((((NTFS_I(vol->mft_ino)->initialized_size >>
vol->mft_record_size_bits) + 7) >> 3) +
PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
/* Use multiples of 4 bytes. */
max_size = PAGE_CACHE_SIZE >> 2;
ntfs_debug("Reading $MFT/$BITMAP, max_index = 0x%lx, max_size = "
......@@ -2123,9 +2127,9 @@ static int ntfs_statfs(struct super_block *sb, struct kstatfs *sfs)
sfs->f_bavail = sfs->f_bfree = size;
/* Serialize accesses to the inode bitmap. */
down_read(&vol->mftbmp_lock);
/* Total file nodes in file system (at this moment in time). */
/* Number of inodes in file system (at this point in time). */
sfs->f_files = vol->mft_ino->i_size >> vol->mft_record_size_bits;
/* Free file nodes in fs (based on current total count). */
/* Free inodes in fs (based on current total count). */
sfs->f_ffree = __get_nr_free_mft_records(vol);
up_read(&vol->mftbmp_lock);
/*
......@@ -2288,6 +2292,8 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent)
vol->fmask = 0177;
vol->dmask = 0077;
unlock_kernel();
/* Important to get the mount options dealt with now. */
if (!parse_options(vol, (char*)opt))
goto err_out_now;
......@@ -2424,6 +2430,7 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent)
}
up(&ntfs_lock);
sb->s_export_op = &ntfs_export_ops;
lock_kernel();
return 0;
}
ntfs_error(sb, "Failed to allocate root directory.");
......@@ -2527,6 +2534,7 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent)
}
/* Errors at this stage are irrelevant. */
err_out_now:
lock_kernel();
sb->s_fs_info = NULL;
kfree(vol);
ntfs_debug("Failed, returning -EINVAL.");
......
......@@ -95,9 +95,6 @@ typedef struct {
struct inode *mftbmp_ino; /* Attribute inode for $MFT/$BITMAP. */
struct rw_semaphore mftbmp_lock; /* Lock for serializing accesses to the
mft record bitmap ($MFT/$BITMAP). */
unsigned long nr_mft_records; /* Number of mft records == number of
bits in mft bitmap. */
#ifdef NTFS_RW
struct inode *mftmirr_ino; /* The VFS inode of $MFTMirr. */
int mftmirr_size; /* Size of mft mirror in mft records. */
......
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