Commit Graph

188 Commits

Author SHA1 Message Date
Anton Altaparmakov f893afbe12 [PATCH] NTFS: Critical bug fix (affects MIPS and possibly others)
Many thanks to Pauline Ng for the detailed bug report and analysis!

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-22 15:05:55 -07:00
Arjan van de Ven 4b6f5d20b0 [PATCH] Make most file operations structs in fs/ const
This is a conversion to make the various file_operations structs in fs/
const.  Basically a regexp job, with a few manual fixups

The goal is both to increase correctness (harder to accidentally write to
shared datastructures) and reducing the false sharing of cachelines with
things that get dirty in .data (while .rodata is nicely read only and thus
cache clean)

Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-28 09:16:06 -08:00
Akinobu Mita b9a2838cc2 [PATCH] bitops: ntfs: remove generic_ffs()
Now the only user who are using generic_ffs() is ntfs filesystem.  This patch
isolates generic_ffs() as ntfs_ffs() for ntfs.

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
Cc: Anton Altaparmakov <aia21@cantab.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-26 08:57:15 -08:00
Paul Jackson 4b6a9316fa [PATCH] cpuset memory spread: slab cache filesystems
Mark file system inode and similar slab caches subject to SLAB_MEM_SPREAD
memory spreading.

If a slab cache is marked SLAB_MEM_SPREAD, then anytime that a task that's
in a cpuset with the 'memory_spread_slab' option enabled goes to allocate
from such a slab cache, the allocations are spread evenly over all the
memory nodes (task->mems_allowed) allowed to that task, instead of favoring
allocation on the node local to the current cpu.

The following inode and similar caches are marked SLAB_MEM_SPREAD:

    file                               cache
    ====                               =====
    fs/adfs/super.c                    adfs_inode_cache
    fs/affs/super.c                    affs_inode_cache
    fs/befs/linuxvfs.c                 befs_inode_cache
    fs/bfs/inode.c                     bfs_inode_cache
    fs/block_dev.c                     bdev_cache
    fs/cifs/cifsfs.c                   cifs_inode_cache
    fs/coda/inode.c                    coda_inode_cache
    fs/dquot.c                         dquot
    fs/efs/super.c                     efs_inode_cache
    fs/ext2/super.c                    ext2_inode_cache
    fs/ext2/xattr.c (fs/mbcache.c)     ext2_xattr
    fs/ext3/super.c                    ext3_inode_cache
    fs/ext3/xattr.c (fs/mbcache.c)     ext3_xattr
    fs/fat/cache.c                     fat_cache
    fs/fat/inode.c                     fat_inode_cache
    fs/freevxfs/vxfs_super.c           vxfs_inode
    fs/hpfs/super.c                    hpfs_inode_cache
    fs/isofs/inode.c                   isofs_inode_cache
    fs/jffs/inode-v23.c                jffs_fm
    fs/jffs2/super.c                   jffs2_i
    fs/jfs/super.c                     jfs_ip
    fs/minix/inode.c                   minix_inode_cache
    fs/ncpfs/inode.c                   ncp_inode_cache
    fs/nfs/direct.c                    nfs_direct_cache
    fs/nfs/inode.c                     nfs_inode_cache
    fs/ntfs/super.c                    ntfs_big_inode_cache_name
    fs/ntfs/super.c                    ntfs_inode_cache
    fs/ocfs2/dlm/dlmfs.c               dlmfs_inode_cache
    fs/ocfs2/super.c                   ocfs2_inode_cache
    fs/proc/inode.c                    proc_inode_cache
    fs/qnx4/inode.c                    qnx4_inode_cache
    fs/reiserfs/super.c                reiser_inode_cache
    fs/romfs/inode.c                   romfs_inode_cache
    fs/smbfs/inode.c                   smb_inode_cache
    fs/sysv/inode.c                    sysv_inode_cache
    fs/udf/super.c                     udf_inode_cache
    fs/ufs/super.c                     ufs_inode_cache
    net/socket.c                       sock_inode_cache
    net/sunrpc/rpc_pipe.c              rpc_inode_cache

The choice of which slab caches to so mark was quite simple.  I marked
those already marked SLAB_RECLAIM_ACCOUNT, except for fs/xfs, dentry_cache,
inode_cache, and buffer_head, which were marked in a previous patch.  Even
though SLAB_RECLAIM_ACCOUNT is for a different purpose, it marks the same
potentially large file system i/o related slab caches as we need for memory
spreading.

Given that the rule now becomes "wherever you would have used a
SLAB_RECLAIM_ACCOUNT slab cache flag before (usually the inode cache), use
the SLAB_MEM_SPREAD flag too", this should be easy enough to maintain.
Future file system writers will just copy one of the existing file system
slab cache setups and tend to get it right without thinking.

Signed-off-by: Paul Jackson <pj@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-24 07:33:23 -08:00
Anton Altaparmakov e750d1c7cc NTFS: 2.1.27 - Various bug fixes and cleanups.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2006-03-23 17:04:12 +00:00
Ingo Molnar 4e5e529ad6 NTFS: Semaphore to mutex conversion.
The conversion was generated via scripts, and the result was validated
automatically via a script as well.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2006-03-23 16:57:48 +00:00
Anton Altaparmakov 834ba600ce NTFS: Handle the recently introduced -ENAMETOOLONG return value from
fs/ntfs/unistr.c::ntfs_nlstoucs() in fs/ntfs/namei.c::ntfs_lookup().

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2006-03-23 16:25:23 +00:00
Anton Altaparmakov 20fdcf1d54 NTFS: Add a missing call to flush_dcache_mft_record_page() in
fs/ntfs/inode.c::ntfs_write_inode().

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2006-03-23 16:21:02 +00:00
Anton Altaparmakov a778f21732 NTFS: Fix a bug in fs/ntfs/inode.c::ntfs_read_locked_index_inode() where we
forgot to update a temporary variable so loading index inodes which
      have an index allocation attribute failed.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2006-03-23 16:18:23 +00:00
Anton Altaparmakov 2c2c8c1c21 NTFS: Improve comments on file attribute flags in fs/ntfs/layout.h.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2006-03-23 16:09:40 +00:00
Anton Altaparmakov d4faf636d6 NTFS: Limit name length in fs/ntfs/unistr.c::ntfs_nlstoucs() to maximum
allowed by NTFS, i.e. 255 Unicode characters, not including the
      terminating NULL (which is not stored on disk).

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2006-03-23 16:05:11 +00:00
Anton Altaparmakov f95c4018fd NTFS: Remove all the make_bad_inode() calls. This should only be called
from read inode and new inode code paths.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2006-03-23 15:59:32 +00:00
Anton Altaparmakov a0646a1f04 NTFS: Add support for sparse files which have a compression unit of 0.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2006-03-23 15:53:03 +00:00
Anton Altaparmakov 949763b2b8 NTFS: Fix comparison of $MFT and $MFTMirr to not bail out when there are
unused, invalid mft records which are the same in both $MFT and
      $MFTMirr.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2006-03-23 15:34:13 +00:00
Anton Altaparmakov 78264bd9c2 NTFS: Use buffer_migrate_page() for the ->migratepage function of all ntfs
address space operations.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2006-03-23 15:06:18 +00:00
Anton Altaparmakov 3ccc7384db NTFS: Fix a buggette in an "should be impossible" case handling where we
continued the attribute lookup loop instead of aborting it.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2006-03-23 15:03:11 +00:00
Anton Altaparmakov 67b1dfe77a NTFS: Fix an (innocent) off-by-one error in the runlist code.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2006-03-23 14:57:43 +00:00
Anton Altaparmakov bb8047d354 NTFS: Fix two compiler warnings on Alpha. Thanks to Andrew Morton for
reporting them.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2006-03-07 11:53:46 +00:00
Anton Altaparmakov 1cf3109ffb NTFS: Do more detailed reporting of why we cannot mount read-write by
special casing the VOLUME_MODIFIED_BY_CHKDSK flag.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2006-02-24 10:48:14 +00:00
Anton Altaparmakov 78af34f03d NTFS: Implement support for sector sizes above 512 bytes (up to the maximum
supported by NTFS which is 4096 bytes).
2006-02-24 10:32:33 +00:00
Anton Altaparmakov 7b875affd4 Merge ../ntfs-2.6-devel 2006-02-24 10:04:22 +00:00
Anton Altaparmakov 3672b638ec NTFS: - Cope with attribute list attribute having invalid flags.
Windows copes with this and even chkdsk does not detect or fix this
	so we have to cope with it, too.  Thanks to Pawel Kot for reporting
	the problem.
      - Miscellaneous updates to layout.h.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2006-02-24 09:55:07 +00:00
Pekka Enberg 64419d93a5 NTFS: We have struct kmem_cache now so use it instead of the typedef.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2006-02-05 21:43:57 +00:00
Anton Altaparmakov 944d79559d Merge branch 'master' of /usr/src/ntfs-2.6/ 2006-01-19 16:39:33 +00:00
Christoph Hellwig 24a44dca35 [PATCH] ntfs: remove superflous MS_NOATIME/MS_NODIRATIME assignments
MS_RDONLU implies not atime updates at all, no need for the MS_NOATIME and
MS_NODIRATIME flags.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Anton Altaparmakov <aia21@cantab.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-10 08:01:33 -08:00
Christoph Hellwig 870f481793 [PATCH] replace inode_update_time with file_update_time
To allow various options to work per-mount instead of per-sb we need a
struct vfsmount when updating ctime and mtime.  This preparation patch
replaces the inode_update_time routine with a file_update_atime routine so
we can easily get at the vfsmount.  (and the file makes more sense in this
context anyway).  Also get rid of the unused second argument - we always
want to update the ctime when calling this routine.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Al Viro <viro@ftp.linux.org.uk>
Cc: Anton Altaparmakov <aia21@cantab.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-10 08:01:30 -08:00
Jes Sorensen 1b1dcc1b57 [PATCH] mutex subsystem, semaphore to mutex: VFS, ->i_sem
This patch converts the inode semaphore to a mutex. I have tested it on
XFS and compiled as much as one can consider on an ia64. Anyway your
luck with it might be different.

Modified-by: Ingo Molnar <mingo@elte.hu>

(finished the conversion)

Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2006-01-09 15:59:24 -08:00
Adrian Bunk f4b09ebc8b update the email address of Randy Dunlap
This patch removes all references to the bouncing address
rddunlap@osdl.org and one dead web page from the kernel.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Acked-by: Randy Dunlap <rdunlap@xenotime.net>
2006-01-03 13:37:51 +01:00
Anton Altaparmakov 3c6af7fa78 NTFS: Fix a potential overflow by casting (index + 1) to s64 before doing a
left shift using PAGE_CACHE_SHIFT in fs/ntfs/file.c.  Thanks to Andrew
      Morton pointing this out to.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-11-24 13:41:33 +00:00
Anton Altaparmakov 3aebf25bdc NTFS: Fix a stupid bug causing writes to non-initialized pages to segfault.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-11-01 15:49:31 +00:00
Anton Altaparmakov c9c2009a4e NTFS: Document extended attribute ($EA) NEED_EA flag. (Based on libntfs
patch by Yura Pakhuchiy.)

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-10-24 09:00:51 +01:00
Anton Altaparmakov dda65b941f NTFS: Fix compilation warnings with gcc-4.0.2 on SUSE 10.0.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-10-24 08:57:59 +01:00
Anton Altaparmakov d04bd1fb60 NTFS: Use %z for size_t to fix compilation warnings. (Andrew Morton)
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-10-24 08:41:24 +01:00
Anton Altaparmakov d5aeaef37d NTFS: Fix serious data corruption issue when writing.
Many thanks to Alberto Patino for testing and reporting the data
      corruption.  And many apologies for corrupting his partition.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-10-19 12:23:10 +01:00
Anton Altaparmakov 7d0ffdb279 NTFS: $EA attributes can be both resident non-resident.
Minor tidying.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-10-19 12:21:19 +01:00
Anton Altaparmakov 98b270362b NTFS: The big ntfs write(2) rewrite has arrived. We now implement our own
file operations ->write(), ->aio_write(), and ->writev() for regular
      files.  This replaces the old use of generic_file_write(), et al and
      the address space operations ->prepare_write and ->commit_write.
      This means that both sparse and non-sparse (unencrypted and
      uncompressed) files can now be extended using the normal write(2)
      code path.  There are two limitations at present and these are that
      we never create sparse files and that we only have limited support
      for highly fragmented files, i.e. ones whose data attribute is split
      across multiple extents.   When such a case is encountered,
      EOPNOTSUPP is returned.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-10-11 15:40:40 +01:00
Anton Altaparmakov 29f5f3c141 NTFS: Remove address space operations ->prepare_write and ->commit_write in
preparation for the big rewrite of write(2) support in ntfs.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-10-11 14:59:40 +01:00
Anton Altaparmakov 29b8990513 NTFS: In attrib.c::ntfs_attr_set() call balance_dirty_pages_ratelimited()
and cond_resched() in the main loop as we could be dirtying a lot of
      pages and this ensures we play nice with the VM and the system as a
      whole.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-10-11 14:54:42 +01:00
Anton Altaparmakov 29d8699ebb Merge branch 'master' of /usr/src/ntfs-2.6/ 2005-10-11 09:29:48 +01:00
Al Viro dd0fc66fb3 [PATCH] gfp flags annotations - part 1
- added typedef unsigned int __nocast gfp_t;

 - replaced __nocast uses for gfp flags with gfp_t - it gives exactly
   the same warnings as far as sparse is concerned, doesn't change
   generated code (from gcc point of view we replaced unsigned int with
   typedef) and documents what's going on far better.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-10-08 15:00:57 -07:00
Anton Altaparmakov e9438250b6 NTFS: Enable ATTR_SIZE attribute changes in ntfs_setattr(). This completes
the initial implementation of file truncation.  Now both open(2)ing
      a file with the O_TRUNC flag and the {,f}truncate(2) system calls
      will resize a file appropriately.  The limitations are that only
      uncompressed and unencrypted files are supported.  Also, there is
      only very limited support for highly fragmented files (the ones whose
      $DATA attribute is split into multiple attribute extents).

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-10-04 16:01:06 +01:00
Anton Altaparmakov dd072330d1 NTFS: Implement fs/ntfs/inode.[hc]::ntfs_truncate(). It only supports
uncompressed and unencrypted files.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-10-04 15:39:02 +01:00
Anton Altaparmakov 2d86829b84 NTFS: Add fs/ntfs/attrib.[hc]::ntfs_attr_extend_allocation(), a function to
extend the allocation of an attributes.  Optionally, the data size,
      but not the initialized size can be extended, too.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-10-04 15:18:56 +01:00
Anton Altaparmakov 2a6fc4e1b0 NTFS: Fix ntfs_attr_make_non_resident() to update the vfs inode i_blocks
which is zero for a resident attribute but should no longer be zero
      once the attribute is non-resident as it then has real clusters
      allocated.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-10-04 14:57:15 +01:00
Anton Altaparmakov 8925d4f0d3 NTFS: Change ntfs_attr_make_non_resident to take the attribute value size
as an extra parameter.  This is needed since we need to know the size
      before we can map the mft record and our callers always know it.  The
      reason we cannot simply read the size from the vfs inode i_size is
      that this is not necessarily uptodate.  This happens when
      ntfs_attr_make_non_resident() is called in the ->truncate call path.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-10-04 14:48:20 +01:00
Anton Altaparmakov fc0fa7dc7d NTFS: - Change ntfs_cluster_alloc() to take an extra boolean parameter
specifying whether the cluster are being allocated to extend an
        attribute or to fill a hole.
      - Change ntfs_attr_make_non_resident() to call ntfs_cluster_alloc()
        with @is_extension set to TRUE and remove the runlist terminator
        fixup code as this is now done by ntfs_cluster_alloc().

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-10-04 14:36:56 +01:00
Anton Altaparmakov 511bea5ea2 NTFS: - Change {__,}ntfs_cluster_free() to also take an optional attribute
search context as argument.  This allows calling it with the mft
        record mapped.  Update all callers.
      - Fix potential deadlock in ntfs_mft_data_extend_allocation_nolock()
	error handling by passing in the active search context when calling
	ntfs_cluster_free().

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-10-04 14:24:21 +01:00
Anton Altaparmakov 69b41e3c02 NTFS: Change ntfs_attr_find_vcn_nolock() to also take an optional attribute
search context as argument.  This allows calling it with the mft
      record mapped.  Update all callers.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-10-04 14:01:14 +01:00
Anton Altaparmakov fd9d63678d NTFS: Change ntfs_map_runlist_nolock() to also take an optional attribute
search context.  This allows calling it with the mft record mapped.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-10-04 13:44:48 +01:00
Anton Altaparmakov c394e458b6 NTFS: Fix a 64-bitness bug where a left-shift could overflow a 32-bit variable
which we now cast to 64-bit first (fs/ntfs/mft.c::map_mft_record_page().

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-10-04 13:08:53 +01:00
Anton Altaparmakov 18efefa935 NTFS: Fix a stupid bug in __ntfs_bitmap_set_bits_in_run() which caused the
count to become negative and hence we had a wild memset() scribbling
      all over the system's ram.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-10-04 13:06:00 +01:00
Anton Altaparmakov e2fcc61ef0 NTFS: Re-fix sparse warnings in a more correct way, i.e. don't use an enum with
different types in it but #define the two constants instead.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-26 17:02:41 +01:00
Anton Altaparmakov 5a8c0cc32b NTFS: More $LogFile handling fixes: when chkdsk has been run, it can leave the
restart pages in the journal without multi sector transfer protection
      fixups (i.e. the update sequence array is empty and in fact does not
      exist).

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-26 10:48:54 +01:00
Anton Altaparmakov 838bf9675a NTFS: Fix the definition of the CHKD ntfs record magic. It had an off by
two error causing it to be CHKB instead of CHKD.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-26 10:45:46 +01:00
Anton Altaparmakov 715dc636b6 NTFS: Change ntfs_cluster_free() to require a write locked runlist on entry
since we otherwise get into a lock reversal deadlock if a read locked
      runlist is passed in. In the process also change it to take an ntfs
      inode instead of a vfs inode as parameter.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-23 11:24:28 +01:00
Anton Altaparmakov 91fbc6edfa NTFS: Fix sparse warnings that have crept in over time.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-22 13:26:44 +01:00
Anton Altaparmakov eed8b2dee7 NTFS: More runlist handling fixes from Richard Russon and myself.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-20 14:19:30 +01:00
Anton Altaparmakov f6098cf449 NTFS: Fix ntfs_{read,write}page() to cope with concurrent truncates better.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-19 09:41:39 +01:00
Anton Altaparmakov 4e64c88693 NTFS: Fix handling of compressed directories that I broke in earlier changeset.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-19 09:38:41 +01:00
Anton Altaparmakov 5c9f6de3b8 NTFS: Fix various bugs in the runlist merging code. (Based on libntfs
changes by Richard Russon.)

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-19 09:33:40 +01:00
Anton Altaparmakov 89ecf38c7a NTFS: Mask out __GFP_HIGHMEM when doing kmalloc() in __ntfs_malloc() as it
otherwise causes a BUG().

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-12 15:43:03 +01:00
Anton Altaparmakov 5d46770f5f NTFS: Change the mount options {u,f,d}mask to always parse the number as
an octal number to conform to how chmod(1) works, too.  Thanks to
      Giuseppe Bilotta and Horst von Brand for pointing out the errors of
      my ways.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-12 14:33:47 +01:00
Andrew Morton b4012a9895 [PATCH] ntfs build fix
*** Warning: "bit_spin_lock" [fs/ntfs/ntfs.ko] undefined!
*** Warning: "bit_spin_unlock" [fs/ntfs/ntfs.ko] undefined!

Cc: Anton Altaparmakov <aia21@cantab.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-10 10:06:20 -07:00
Anton Altaparmakov 7d333d6c73 NTFS: 2.1.24 release and some minor final fixes.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-08 23:01:16 +01:00
Anton Altaparmakov e604635c8b NTFS: Improve scalability by changing the driver global spin lock in
fs/ntfs/aops.c::ntfs_end_buffer_async_read() to a bit spin lock
      in the first buffer head of a page.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-08 22:13:02 +01:00
Anton Altaparmakov a01ac532b5 NTFS: Fix page_has_buffers()/page_buffers() handling in fs/ntfs/aops.c.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-08 22:08:11 +01:00
Anton Altaparmakov 311120eca0 NTFS: Fixup handling of sparse, compressed, and encrypted attributes in
fs/ntfs/aops.c::ntfs_readpage().

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-08 22:04:20 +01:00
Anton Altaparmakov 8273d5d4c2 NTFS: Fix fs/ntfs/aops.c::ntfs_{read,write}_block() to handle the case
where a concurrent truncate has truncated the runlist under our feet.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-08 22:00:33 +01:00
Anton Altaparmakov 54b02eb01c NTFS: Optimize fs/ntfs/aops.c::ntfs_write_block() by extending the page
lock protection over the buffer submission for i/o which allows the
      removal of the get_bh()/put_bh() pairs for each buffer.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-08 21:43:47 +01:00
Anton Altaparmakov bd45fdd209 NTFS: Fixup handling of sparse, compressed, and encrypted attributes in
fs/ntfs/aops.c::ntfs_writepage().

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-08 21:38:05 +01:00
Anton Altaparmakov 8dcdebafb8 NTFS: Make ntfs_write_block() not instantiate sparse blocks if they are zero.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-08 21:25:48 +01:00
Anton Altaparmakov 67bb103725 NTFS: Fixup handling of sparse, compressed, and encrypted attributes in
fs/ntfs/inode.c::ntfs_read_locked_{,attr_,index_}inode().

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-08 21:19:45 +01:00
Anton Altaparmakov 1c7d469d47 NTFS: Truncate {a,c,m}time to the ntfs supported time granularity when
updating the times in the inode in ntfs_setattr().

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-08 21:15:09 +01:00
Anton Altaparmakov bbf1813fb8 NTFS: Fix cluster (de)allocators to work when the runlist is NULL and more
importantly to take a locked runlist rather than them locking it
      which leads to lock reversal.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-08 21:09:06 +01:00
Anton Altaparmakov 807c453de7 NTFS: Fix handling of sparse attributes in ntfs_attr_make_non_resident().
Also, add BUG() checks to ntfs_attr_make_non_resident() and
      ntfs_attr_set() to ensure that these functions are never called
      for compressed or encrypted attributes.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-08 21:01:17 +01:00
Anton Altaparmakov 2983d1bd1a NTFS: Fix several bugs in fs/ntfs/attrib.c.
- Fix a bug in ntfs_map_runlist_nolock() where we forgot to protect
  access to the allocated size in the ntfs inode with the size lock.
- Fix ntfs_attr_vcn_to_lcn_nolock() and ntfs_attr_find_vcn_nolock() to
  return LCN_ENOENT when there is no runlist and the allocated size is
  zero.
- Fix load_attribute_list() to handle the case of a NULL runlist.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-08 20:56:09 +01:00
Anton Altaparmakov 0aacceacf3 NTFS: Add fs/ntfs/attrib.[hc]::ntfs_resident_attr_value_resize().
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-08 20:40:32 +01:00
Anton Altaparmakov f25dfb5e44 NTFS: Remove bogus setting of PageError in ntfs_read_compressed_block().
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-08 20:35:33 +01:00
Anton Altaparmakov 8e08ceaeac NTFS: Fix a bug in fs/ntfs/index.c::ntfs_index_lookup(). When the returned
index entry is in the index root, we forgot to set the @ir pointer in
      the index context.  Thanks for Yura Pakhuchiy for finding this bug.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-08 20:29:50 +01:00
Anton Altaparmakov 6e48321a40 NTFS: Add ntfs_rl_punch_nolock() which punches a caller specified hole into a runlist.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-08 20:26:34 +01:00
Anton Altaparmakov 3ffc5a4438 NTFS: Change ntfs_rl_truncate_nolock() to throw away the runlist if the new
length is zero.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-08 20:23:06 +01:00
Anton Altaparmakov f94ad38e68 NTFS: Report unrepresentable inodes during ntfs_readdir() as KERN_WARNING
messages and include the inode number.  Thanks to Yura Pakhuchiy for
      pointing this out.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-08 17:04:11 +01:00
Anton Altaparmakov 2b0ada2b8e NTFS: Fix handling of valid but empty mapping pairs array in
fs/ntfs/runlist.c::ntfs_mapping_pairs_decompress().

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-08 16:52:31 +01:00
Anton Altaparmakov 8bb735216a NTFS: Remove two bogus BUG_ON()s from fs/ntfs/mft.c.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-08 16:48:28 +01:00
Anton Altaparmakov 84d6ebe63f NTFS: Fix two nasty runlist merging bugs that had gone unnoticed so far.
Thanks to Stefano Picerno for the bug report.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-08 16:46:55 +01:00
Anton Altaparmakov 9529d461d0 NTFS: Use ntfs_malloc_nofs_nofail() in runlist.c::ntfs_runlists_merge()
in the two critical regions.  This means we no longer need to
      panic() when the allocation fails as it now cannot fail.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-08 16:33:12 +01:00
Anton Altaparmakov 06d0e3cf3d NTFS: Allow highmem kmalloc() in ntfs_malloc_nofs() and add _nofail() version.
- Modify fs/ntfs/malloc.h::ntfs_malloc_nofs() to do the kmalloc() based
  allocations with __GFP_HIGHMEM, analogous to how the vmalloc() based
  allocations are done.
- Add fs/ntfs/malloc.h::ntfs_malloc_nofs_nofail() which is analogous to
  ntfs_malloc_nofs() but it performs allocations with __GFP_NOFAIL and
  hence cannot fail.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-08 16:28:25 +01:00
Anton Altaparmakov e7a1033b94 NTFS: Support more clean journal ($LogFile) states.
- Support journals ($LogFile) which have been modified by chkdsk.  This
        means users can boot into Windows after we marked the volume dirty.
        The Windows boot will run chkdsk and then reboot.  The user can then
        immediately boot into Linux rather than having to do a full Windows
        boot first before rebooting into Linux and we will recognize such a
        journal and empty it as it is clean by definition.
      - Support journals ($LogFile) with only one restart page as well as
        journals with two different restart pages.  We sanity check both and
        either use the only sane one or the more recent one of the two in the
        case that both are valid.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-09-08 16:12:28 +01:00
Anton Altaparmakov 481d037421 NTFS: Complete the previous fix for the unset device when mapping buffers
for  mft record writing.  I had missed the writepage based mft record
      write code path.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-08-16 19:42:56 +01:00
Anton Altaparmakov e74589ac25 NTFS: Fix bug in mft record writing where we forgot to set the device in
the buffers when mapping them after the VM had discarded them.
      Thanks to Martin MOKREJŠ for the bug report.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-08-16 16:38:28 +01:00
Olaf Hering 44456d37b5 [PATCH] turn many #if $undefined_string into #ifdef $undefined_string
turn many #if $undefined_string into #ifdef $undefined_string to fix some
warnings after -Wno-def was added to global CFLAGS

Signed-off-by: Olaf Hering <olh@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:08 -07:00
Anton Altaparmakov ba6d2377c8 NTFS: Fix a nasty deadlock that appeared in recent kernels.
The situation: VFS inode X on a mounted ntfs volume is dirty.  For
      same inode X, the ntfs_inode is dirty and thus corresponding on-disk
      inode, i.e. mft record, which is in a dirty PAGE_CACHE_PAGE belonging
      to the table of inodes, i.e. $MFT, inode 0.
      What happens:
      Process 1: sys_sync()/umount()/whatever...  calls
      __sync_single_inode() for $MFT -> do_writepages() -> write_page for
      the dirty page containing the on-disk inode X, the page is now locked
      -> ntfs_write_mst_block() which clears PageUptodate() on the page to
      prevent anyone else getting hold of it whilst it does the write out.
      This is necessary as the on-disk inode needs "fixups" applied before
      the write to disk which are removed again after the write and
      PageUptodate is then set again.  It then analyses the page looking
      for dirty on-disk inodes and when it finds one it calls
      ntfs_may_write_mft_record() to see if it is safe to write this
      on-disk inode.  This then calls ilookup5() to check if the
      corresponding VFS inode is in icache().  This in turn calls ifind()
      which waits on the inode lock via wait_on_inode whilst holding the
      global inode_lock.
      Process 2: pdflush results in a call to __sync_single_inode for the
      same VFS inode X on the ntfs volume.  This locks the inode (I_LOCK)
      then calls write-inode -> ntfs_write_inode -> map_mft_record() ->
      read_cache_page() for the page (in page cache of table of inodes
      $MFT, inode 0) containing the on-disk inode.  This page has
      PageUptodate() clear because of Process 1 (see above) so
      read_cache_page() blocks when it tries to take the page lock for the
      page so it can call ntfs_read_page().
      Thus Process 1 is holding the page lock on the page containing the
      on-disk inode X and it is waiting on the inode X to be unlocked in
      ifind() so it can write the page out and then unlock the page.
      And Process 2 is holding the inode lock on inode X and is waiting for
      the page to be unlocked so it can call ntfs_readpage() or discover
      that Process 1 set PageUptodate() again and use the page.
      Thus we have a deadlock due to ifind() waiting on the inode lock.
      The solution: The fix is to use the newly introduced
      ilookup5_nowait() which does not wait on the inode's lock and hence
      avoids the deadlock.  This is safe as we do not care about the VFS
      inode and only use the fact that it is in the VFS inode cache and the
      fact that the vfs and ntfs inodes are one struct in memory to find
      the ntfs inode in memory if present.  Also, the ntfs inode has its
      own locking so it does not matter if the vfs inode is locked.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-06-26 22:12:02 +01:00
Anton Altaparmakov af859a42d7 NTFS: Prepare for 2.1.23 release: Update documentation and bump version.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-06-25 21:07:27 +01:00
Anton Altaparmakov 4757d7dff6 NTFS: Change ntfs_map_runlist_nolock() to only decompress the mapping pairs
if the requested vcn is inside it.  Otherwise we get into problems
      when we try to map an out of bounds vcn because we then try to map
      the already mapped runlist fragment which causes
      ntfs_mapping_pairs_decompress() to fail and return error.  Update
      ntfs_attr_find_vcn_nolock() accordingly.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-06-25 17:24:08 +01:00
Anton Altaparmakov fa3be92317 NTFS: Add an extra parameter @last_vcn to ntfs_get_size_for_mapping_pairs()
and ntfs_mapping_pairs_build() to allow the runlist encoding to be
      partial which is desirable when filling holes in sparse attributes.
      Update all callers.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-06-25 17:15:36 +01:00
Anton Altaparmakov 1d58b27b8d NTFS: Change the runlist terminator of the newly allocated cluster(s) to
LCN_ENOENT in ntfs_attr_make_non_resident().  Otherwise the runlist
      code gets confused.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-06-25 17:04:55 +01:00
Anton Altaparmakov 3bd1f4a173 NTFS: Fix several occurences of a bug where we would perform 'var & ~const'
with a 64-bit variable and a int, i.e. 32-bit, constant.  This causes
      the higher order 32-bits of the 64-bit variable to be zeroed.  To fix
      this cast the 'const' to the same 64-bit type as 'var'.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-06-25 16:51:58 +01:00
Anton Altaparmakov ca8fd7a0c6 NTFS: Detect the case when Windows has been suspended to disk on the volume
to be mounted and if this is the case do not allow (re)mounting
      read-write.  This is done by parsing hiberfil.sys if present.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-06-25 16:31:27 +01:00
Anton Altaparmakov 9f993fe463 NTFS: Fix a bug in address space operations error recovery code paths where
if the runlist was not mapped at all and a mapping error occured we
      would leave the runlist locked on exit to the function so that the
      next access to the same file would try to take the lock and deadlock.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-06-25 16:15:36 +01:00
Anton Altaparmakov 3f2faef00c NTFS: Stamp the transaction log ($UsnJrnl), aka user space journal, if it
is active on the volume and we are mounting read-write or remounting
      from read-only to read-write.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
2005-06-25 15:28:56 +01:00