]> git.hungrycats.org Git - linux/commitdiff
NTFS: 2.0.24 - Cleanups.
authorAnton Altaparmakov <aia21@cantab.net>
Wed, 7 Aug 2002 02:46:41 +0000 (03:46 +0100)
committerAnton Altaparmakov <aia21@cantab.net>
Wed, 7 Aug 2002 02:46:41 +0000 (03:46 +0100)
- Treat BUG_ON() as ASSERT() not VERIFY(), i.e. do not use side effects
  inside BUG_ON(). (Adam J. Richter)
- Split logical OR expressions inside BUG_ON() into individual BUG_ON()
  calls for improved debugging. (Adam J. Richter)
- Add errors flag to the ntfs volume state, accessed via
  NVol{,Set,Clear}Errors(vol).
- Do not allow read-write remounts of read-only volumes with errors.
- Clarify comment for ntfs file operation sendfile which was added by
  Christoph Hellwig a while ago (just using generic_file_sendfile())
  to say that ntfs ->sendfile is only used for the case where the
  source data is on the ntfs partition and the destination is
  somewhere else, i.e. nothing we need to concern ourselves with.

Documentation/filesystems/ntfs.txt
fs/ntfs/ChangeLog
fs/ntfs/Makefile
fs/ntfs/attrib.c
fs/ntfs/compress.c
fs/ntfs/file.c
fs/ntfs/inode.c
fs/ntfs/super.c
fs/ntfs/volume.h

index 0abee2c6f899e7527355fa93bd0ac6a32a4cb867..77c3604d535d9627c504e4cd4d9008b0aa205ed8 100644 (file)
@@ -247,6 +247,9 @@ ChangeLog
 
 Note, a technical ChangeLog aimed at kernel hackers is in fs/ntfs/ChangeLog.
 
+2.0.24:
+       - Small internal cleanups.
+       - Support for sendfile system call. (Christoph Hellwig)
 2.0.23:
        - Massive internal locking changes to mft record locking. Fixes
          various race conditions and deadlocks.
index ab57d6ab0593b7397a7acbeae4110780a3271a4b..990da021578ce426ea5aa4719e6f9248128047df 100644 (file)
@@ -2,6 +2,22 @@ ToDo:
        - Find and fix bugs.
        - Enable NFS exporting of NTFS.
 
+2.0.24 - Cleanups.
+
+       - Treat BUG_ON() as ASSERT() not VERIFY(), i.e. do not use side effects
+         inside BUG_ON(). (Adam J. Richter)
+       - Split logical OR expressions inside BUG_ON() into individual BUG_ON()
+         calls for improved debugging. (Adam J. Richter)
+       - Add errors flag to the ntfs volume state, accessed via
+         NVol{,Set,Clear}Errors(vol).
+       - Do not allow read-write remounts of read-only volumes with errors.
+       - Clarify comment for ntfs file operation sendfile which was added by
+         Christoph Hellwig a while ago (just using generic_file_sendfile())
+         to say that ntfs ->sendfile is only used for the case where the
+         source data is on the ntfs partition and the destination is
+         somewhere else, i.e. nothing we need to concern ourselves with.
+       - Add generic_file_write() as our ntfs file write operation.
+
 2.0.23 - Major bug fixes (races, deadlocks, non-i386 architectures).
 
        - Massive internal locking changes to mft record locking. Fixes lock
index 30b50a7fe515b86e39b1e0175ebbd882e7e9011e..d4eb94e3acbe572db72fad755a1d146be51b34a0 100644 (file)
@@ -5,7 +5,7 @@ obj-$(CONFIG_NTFS_FS) += ntfs.o
 ntfs-objs := aops.o attrib.o compress.o debug.o dir.o file.o inode.o mft.o \
             mst.o namei.o super.o sysctl.o time.o unistr.o upcase.o
 
-EXTRA_CFLAGS = -DNTFS_VERSION=\"2.0.23\"
+EXTRA_CFLAGS = -DNTFS_VERSION=\"2.0.24\"
 
 ifeq ($(CONFIG_NTFS_DEBUG),y)
 EXTRA_CFLAGS += -DDEBUG
index e995eadfdaef73462346920fc9b991fb2835e546..7dbb7cf43bc17e040603f8f0b29455e610b4c3bd 100644 (file)
@@ -110,7 +110,8 @@ static inline run_list_element *ntfs_rl_realloc(run_list_element *rl,
 static inline BOOL ntfs_are_rl_mergeable(run_list_element *dst,
                run_list_element *src)
 {
-       BUG_ON(!dst || !src);
+       BUG_ON(!dst);
+       BUG_ON(!src);
 
        if ((dst->lcn < 0) || (src->lcn < 0))     /* Are we merging holes? */
                return FALSE;
@@ -192,7 +193,8 @@ static inline run_list_element *ntfs_rl_append(run_list_element *dst,
        BOOL right;
        int magic;
 
-       BUG_ON(!dst || !src);
+       BUG_ON(!dst);
+       BUG_ON(!src);
 
        /* First, check if the right hand end needs merging. */
        right = ntfs_are_rl_mergeable(src + ssize - 1, dst + loc + 1);
@@ -258,7 +260,8 @@ static inline run_list_element *ntfs_rl_insert(run_list_element *dst,
        BOOL hole = FALSE;      /* Following a hole */
        int magic;
 
-       BUG_ON(!dst || !src);
+       BUG_ON(!dst);
+       BUG_ON(!src);
 
        /* disc => Discontinuity between the end of @dst and the start of @src.
         *         This means we might need to insert a hole.
@@ -362,7 +365,8 @@ static inline run_list_element *ntfs_rl_replace(run_list_element *dst,
        BOOL right;
        int magic;
 
-       BUG_ON(!dst || !src);
+       BUG_ON(!dst);
+       BUG_ON(!src);
 
        /* First, merge the left and right ends, if necessary. */
        right = ntfs_are_rl_mergeable(src + ssize - 1, dst + loc + 1);
@@ -423,7 +427,8 @@ static inline run_list_element *ntfs_rl_replace(run_list_element *dst,
 static inline run_list_element *ntfs_rl_split(run_list_element *dst, int dsize,
                run_list_element *src, int ssize, int loc)
 {
-       BUG_ON(!dst || !src);
+       BUG_ON(!dst);
+       BUG_ON(!src);
 
        /* Space required: @dst size + @src size + one new hole. */
        dst = ntfs_rl_realloc(dst, dsize, dsize + ssize + 1);
index fbfe8e8bc941e7ac75c2382614c5c531a275b25c..4ee02341e2d3c28982c6e03d68b913511cb69d17 100644 (file)
@@ -467,7 +467,8 @@ int ntfs_read_compressed_block(struct page *page)
         * Bad things happen if we get here for anything that is not an
         * unnamed $DATA attribute.
         */
-       BUG_ON(ni->type != AT_DATA || ni->name_len);
+       BUG_ON(ni->type != AT_DATA);
+       BUG_ON(ni->name_len);
 
        pages = kmalloc(nr_pages * sizeof(struct page *), GFP_NOFS);
 
index 8ee500d4ab2078ba6674a4555b5e4d1d02471ffc..8fb5d4b50005ae554bf0e7e806b1fb9072bc718f 100644 (file)
@@ -51,8 +51,15 @@ static int ntfs_file_open(struct inode *vi, struct file *filp)
 struct file_operations ntfs_file_ops = {
        .llseek         = generic_file_llseek,  /* Seek inside file. */
        .read           = generic_file_read,    /* Read from file. */
+#ifdef NTFS_RW
+       .write          = generic_file_write,   /* Write to a file. */
+#endif
        .mmap           = generic_file_mmap,    /* Mmap file. */
-       .sendfile       = generic_file_sendfile,/* Zero-copy data send. */
+       .sendfile       = generic_file_sendfile,/* Zero-copy data send with the
+                                                  data source being on the
+                                                  ntfs partition. We don't
+                                                  need to care about the data
+                                                  destination. */
        .open           = ntfs_file_open,       /* Open file. */
 };
 
index 936e0299e5b821e60aa6c9d5d8ec4e6d8ee3c3d0..de71ea713a2e26d6e16aff9f0712538dd412940f 100644 (file)
@@ -278,7 +278,9 @@ void ntfs_destroy_big_inode(struct inode *inode)
        ntfs_inode *ni = NTFS_I(inode);
 
        ntfs_debug("Entering.");
-       BUG_ON(ni->page || !atomic_dec_and_test(&ni->count));
+       BUG_ON(ni->page);
+       if (!atomic_dec_and_test(&ni->count))
+               BUG();
        kmem_cache_free(ntfs_big_inode_cache, NTFS_I(inode));
 }
 
@@ -299,7 +301,9 @@ static inline ntfs_inode *ntfs_alloc_extent_inode(void)
 void ntfs_destroy_extent_inode(ntfs_inode *ni)
 {
        ntfs_debug("Entering.");
-       BUG_ON(ni->page || !atomic_dec_and_test(&ni->count));
+       BUG_ON(ni->page);
+       if (!atomic_dec_and_test(&ni->count))
+               BUG();
        kmem_cache_free(ntfs_inode_cache, ni);
 }
 
index 367615e6798aed44b9f0fb4109577ed3e758b0e5..6f2ad5ced703a2b8a580b52a5b532893db6c759c 100644 (file)
@@ -307,6 +307,23 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt)
 
        ntfs_debug("Entering with remount options string: %s", opt);
 
+#ifndef NTFS_RW
+       /* For read-only compiled driver, enforce all read-only flags. */
+       *flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME;
+#else
+       /*
+        * For the read-write compiled driver, if we are remounting read-write,
+        * make sure there aren't any volume errors.
+        */
+       if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) {
+               if (NVolErrors(vol)) {
+                       ntfs_error(sb, "Volume has errors and is read-only."
+                                       "Cannot remount read-write.");
+                       return -EROFS;
+               }
+       }
+#endif
+
        // FIXME/TODO: If left like this we will have problems with rw->ro and
        // ro->rw, as well as with sync->async and vice versa remounts.
        // Note: The VFS already checks that there are no pending deletes and
@@ -324,10 +341,6 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt)
        if (!parse_options(vol, opt))
                return -EINVAL;
 
-#ifndef NTFS_RW
-       *flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME;
-#endif
-
        return 0;
 }
 
index 2b96bcd2b1eeca0d287138729dcc98d6e101881b..0bfea2ab2c8764b46e21e63af39269d8ceb84a6f 100644 (file)
@@ -101,6 +101,7 @@ typedef struct {
  * Defined bits for the flags field in the ntfs_volume structure.
  */
 typedef enum {
+       NV_Errors,              /* 1: Volume has errors, prevent remount rw. */
        NV_ShowSystemFiles,     /* 1: Return system files in ntfs_readdir(). */
        NV_CaseSensitive,       /* 1: Treat file names as case sensitive and
                                      create filenames in the POSIX namespace.
@@ -127,6 +128,7 @@ static inline void NVolClear##flag(ntfs_volume *vol)        \
 }
 
 /* Emit the ntfs volume bitops functions. */
+NVOL_FNS(Errors)
 NVOL_FNS(ShowSystemFiles)
 NVOL_FNS(CaseSensitive)