Changes by: antona
Update of /cvsroot/linux-ntfs/ntfs-driver-tng/linux/fs/ntfs
In directory usw-pr-cvs1:/tmp/cvs-serv7469/linux/fs/ntfs
Modified Files:
Makefile attrib.c inode.c mft.c super.c
Log Message:
Mounts should now work. Note if the mount fails, you will probably have to
reboot before you can try again or bad things might happen...
Umount fails with busy inodes at the moment...
Index: Makefile
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfs-driver-tng/linux/fs/ntfs/Makefile,v
retrieving revision 1.12
retrieving revision 1.13
diff -U2 -r1.12 -r1.13
--- Makefile 2001/07/19 14:11:52 1.12
+++ Makefile 2001/07/29 02:07:16 1.13
@@ -9,5 +9,5 @@
# Uncomment this to enable debugging code.
-#EXTRA_CFLAGS += -DDEBUG
+EXTRA_CFLAGS += -DDEBUG
# Uncomment this to enable memory (de)allocation debugging.
Index: attrib.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfs-driver-tng/linux/fs/ntfs/attrib.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -U2 -r1.6 -r1.7
--- attrib.c 2001/07/15 00:26:13 1.6
+++ attrib.c 2001/07/29 02:07:16 1.7
@@ -20,5 +20,4 @@
*/
#include <linux/ntfs_fs.h>
-#include <linux/vmalloc.h>
/**
@@ -87,5 +86,5 @@
rlsize = 0;
/* Allocate first page. */
- rl = vmalloc_32(PAGE_SIZE);
+ rl = vmalloc_nofs(PAGE_SIZE);
if (!rl)
return ERR_PTR(-ENOMEM);
@@ -103,5 +102,5 @@
*/
if (((rlpos + 1) * sizeof(run_list)) % PAGE_SIZE == 0) {
- rl2 = vmalloc_32(rlsize + PAGE_SIZE);
+ rl2 = vmalloc_nofs(rlsize + PAGE_SIZE);
if (!rl2) {
if (rl)
@@ -225,9 +224,9 @@
int i;
- printk(KERN_DEBUG "\nMapping pairs array successfully "
+ printk(KERN_DEBUG "Mapping pairs array successfully "
"decompressed.\n");
printk(KERN_DEBUG "Resulting run list (values in hex):\n");
printk(KERN_DEBUG "VCN LCN "
- "Run length");
+ "Run length\n");
for (i = 0; ; i++) {
if ((rl + i)->lcn == (LCN)LCN_HOLE)
@@ -431,6 +430,6 @@
for (;; a = (ATTR_RECORD*)((char*)a + le32_to_cpu(a->length))) {
- if (p2n(a) < p2n(ctx->mrec) || (char*)a > (char*)ctx->mrec +
- le32_to_cpu(ctx->mrec->bytes_allocated))
+ if ((char*)a < (char*)ctx->mrec || (char*)a > (char*)ctx->mrec +
+ le32_to_cpu(ctx->mrec->bytes_allocated))
break;
ctx->attr = a;
@@ -549,5 +548,5 @@
ctx->is_first = TRUE;
ctx->attr = a = (ATTR_RECORD*)((char*)m + le16_to_cpu(m->attrs_offset));
- if (p2n(a) >= p2n(m) && (char*)a <= (char*)m +
+ if ((char*)a >= (char*)m && (char*)a <= (char*)m +
le32_to_cpu(m->bytes_allocated))
return find_attr(type, name, name_len, ic, upcase, upcase_len,
Index: inode.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfs-driver-tng/linux/fs/ntfs/inode.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -U2 -r1.13 -r1.14
--- inode.c 2001/07/28 17:35:55 1.13
+++ inode.c 2001/07/29 02:07:16 1.14
@@ -74,5 +74,5 @@
int err;
- ntfs_debug("Entering.\n");
+ ntfs_debug("Entering for i_ino 0x%lx.\n", vfs_ino->i_ino);
/*
* Initialize the ntfs specific part of @vfs_ino special casing
@@ -279,4 +279,10 @@
ntfs_error(vfs_ino->i_sb, __FUNCTION__ "(): failed with error "
"code %i. Marking inode as bad.", -err);
+ vfree(ntfs_ino->run_list);
+ ntfs_ino->run_list = NULL;
+ if (ntfs_ino->nr_extents > 0) {
+ kfree(ntfs_ino->extents);
+ ntfs_ino->extents = NULL;
+ }
make_bad_inode(vfs_ino);
return;
@@ -293,5 +299,5 @@
struct buffer_head *bh;
struct ntfs_inode_info *ntfs_ino;
- MFT_RECORD *m;
+ MFT_RECORD *m = NULL;
__s64 block;
unsigned int i, nr_blocks;
@@ -315,9 +321,14 @@
ntfs_error(sb, __FUNCTION__ "(): unsupported mft record size "
"%i (max 64kiB).", vol->mft_record_size);
+ goto err_out;
}
m = (MFT_RECORD*)kmalloc(max(vol->mft_record_size, sb->s_blocksize),
GFP_NOFS);
+ if (!m) {
+ ntfs_error(sb, __FUNCTION__ "(): kmalloc() failed.");
+ goto err_out;
+ }
/* Determine the first block of the $MFT/$DATA attribute. */
- block = vol->mft_lcn << vol->mft_record_size_bits >>
+ block = vol->mft_lcn << vol->cluster_size_bits >>
sb->s_blocksize_bits;
nr_blocks = vol->mft_record_size >> sb->s_blocksize_bits;
@@ -423,9 +434,11 @@
vfs_ino->i_fop = &ntfs_empty_file_ops;
vfs_ino->i_mapping->a_ops = &ntfs_empty_aops;
+out_now:
+ kfree(m);
return;
err_out:
ntfs_error(sb, __FUNCTION__ "(): failed. Marking inode as bad.");
make_bad_inode(vfs_ino);
- return;
+ goto out_now;
}
Index: mft.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfs-driver-tng/linux/fs/ntfs/mft.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -U2 -r1.14 -r1.15
--- mft.c 2001/07/28 17:35:55 1.14
+++ mft.c 2001/07/29 02:07:16 1.15
@@ -142,5 +142,5 @@
struct page *page;
- ntfs_debug("Entering.\n");
+ ntfs_debug("Executing.\n");
mark_buffer_uptodate(bh, uptodate);
/* This is a temporary buffer used for page I/O. */
@@ -284,7 +284,8 @@
* here if the volume was that big...
*/
- index = mft_ino->i_ino << vol->mft_record_size_bits;
- ofs = index & ~PAGE_CACHE_MASK;
- index >>= PAGE_CACHE_SHIFT;
+ index = (__s64)vfs_ino->i_ino << vol->mft_record_size_bits >>
+ PAGE_CACHE_SHIFT;
+ ofs = ((__s64)vfs_ino->i_ino << vol->mft_record_size_bits) &
+ ~PAGE_CACHE_MASK;
/* The maximum valid index into the page cache for $MFT's data. */
end_index = mft_ino->i_size >> PAGE_CACHE_SHIFT;
@@ -331,10 +332,13 @@
* wait if necessary. Return the mft record (the kmapped page address
* plus the offset into the page). This is to protect against races with
- * ourselves, the other map_mft_record_*() functions and the VFS.
+ * ourselves, the other map_mft_record_*() functions and the VFS. Also,
+ * set the ntfs_ino->page so that the unmap op is lightning fast.
*/
wait_for_io_completion:
- if (!PageLocked(page) && Page_Uptodate(page))
+ if (!PageLocked(page) && Page_Uptodate(page)) {
io_is_complete:
+ ntfs_ino->page = page;
return kmap(page) + ofs;
+ }
/* Wait for the page to become unlocked. */
wait_on_page(page);
@@ -399,7 +403,8 @@
if (iblock < lblock) {
/* Convert iblock into corresponding vcn and offset. */
- vcn = (VCN)iblock << blocksize_bits;
- vcn_ofs = vcn & vol->cluster_size_mask;
- vcn >>= vol->cluster_size_bits;
+ vcn = (VCN)iblock << blocksize_bits >>
+ vol->cluster_size_bits;
+ vcn_ofs = ((VCN)iblock << blocksize_bits) &
+ vol->cluster_size_mask;
/* Convert the vcn to the corresponding lcn. */
lcn = vcn_to_lcn(NTFS_I(mft_ino)->run_list, vcn);
Index: super.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfs-driver-tng/linux/fs/ntfs/super.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -U2 -r1.16 -r1.17
--- super.c 2001/07/28 17:35:55 1.16
+++ super.c 2001/07/29 02:07:16 1.17
@@ -841,4 +841,6 @@
read_inode: ntfs_read_inode_mount, /* VFS: Load inode from disk,
called from iget(). */
+ clear_inode: ntfs_clear_inode, /* VFS: Called when an inode is
+ removed from memory. */
};
@@ -890,5 +892,5 @@
struct buffer_head *bh;
struct inode *tmp_ino;
- int old_blocksize;
+ int old_blocksize, tries;
kdev_t dev = sb->s_dev;
@@ -1009,7 +1011,28 @@
* and associated address space operations to function.
*/
+ /*
+ * Poison vol->mft_ino so we know whether iget() called into our
+ * ntfs_read_inode_mount method.
+ */
+#define OGIN ((struct inode*)le32_to_cpu(0x4e49474f)) /* OGIN */
+ vol->mft_ino = OGIN;
sb->s_op = &ntfs_mount_sops;
tmp_ino = iget(vol->sb, FILE_$MFT);
+ tries = 0;
if (!tmp_ino || tmp_ino != vol->mft_ino || is_bad_inode(tmp_ino)) {
+ if (!tmp_ino)
+ ntfs_debug("!tmp_ino\n");
+ if (is_bad_inode(tmp_ino))
+ ntfs_debug("is_bad_inode(tmp_ino)\n");
+ if (tmp_ino != vol->mft_ino) {
+ if (vol->mft_ino == OGIN) {
+ ntfs_debug("iget() did not call "
+ "ntfs_read_inode_mount(), trying to "
+ "clean up this time!\n");
+ sb->s_op = &ntfs_mount_sops;
+ //force_delete(tmp_ino);
+ }
+ ntfs_debug("tmp_ino != vol->mft_ino\n");
+ }
if (!silent)
ntfs_error(sb, __FUNCTION__ "(): Failed to load "
@@ -1019,4 +1042,5 @@
goto iput_tmp_ino_err_out_now;
}
+#undef OGIN
/*
* Note: sb->s_op has already been set to &ntfs_sops by our specialized
@@ -1045,15 +1069,21 @@
ntfs_error(sb, __FUNCTION__ "(): Failed to allocate root directory.");
/* Clean up after the successful load_system_files() call from above. */
+ //sb->s_op = &ntfs_mount_sops;
+ //force_delete(vol->vol_ino);
iput(vol->vol_ino);
vol->vol_ino = NULL;
/* NTFS 3.0+ specific clean up. */
if (vol->major_ver >= 3) {
+ //force_delete(vol->secure_ino);
iput(vol->secure_ino);
vol->secure_ino = NULL;
}
+ //force_delete(vol->root_ino);
iput(vol->root_ino);
vol->root_ino = NULL;
+ //force_delete(vol->lcnbmp_ino);
iput(vol->lcnbmp_ino);
vol->lcnbmp_ino = NULL;
+ //force_delete(vol->mftmirr_ino);
iput(vol->mftmirr_ino);
vol->upcase_len = 0;
@@ -1067,5 +1097,9 @@
/* Error exit code path. */
iput_tmp_ino_err_out_now:
- /* When we get here tmp_ino == vol->mft_ino. */
+ /*
+ * Enforce ntfs_mount_sops as they don't define any delete
+ * methods or simillar, thus force_delete() followed by iput()
+ * later on will terminate the inode with extreme prejudice.
+ */
vol->mft_ino = NULL;
iput(tmp_ino);
|