Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Tue, 6 Aug 2002 21:01:34 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Tue, 6 Aug 2002 21:01:34 -0400 Received: from maroon.csi.cam.ac.uk ([131.111.8.2]:8399 "EHLO maroon.csi.cam.ac.uk") by vger.kernel.org with ESMTP id ; Tue, 6 Aug 2002 21:01:31 -0400 Subject: [BK-PATCH-2.5] NTFS 2.0.24: Cleanups To: torvalds@transmeta.com (Linus Torvalds) Date: Wed, 7 Aug 2002 02:05:04 +0100 (BST) Cc: linux-kernel@vger.kernel.org (Linux Kernel) X-Mailer: ELM [version 2.5 PL6] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: From: Anton Altaparmakov Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 12810 Lines: 336 Linus, please do a bk pull http://linux-ntfs.bkbits.net/ntfs-tng-2.5 Thanks! This is just some cleanups, mostly the BUG_ON() cleanups from Adam J. Richter. Just to relax a bit after the big changes in the last ntfs update. (-; Best regards, Anton -- Anton Altaparmakov (replace at with @) Linux NTFS maintainer / IRC: #ntfs on irc.openprojects.net WWW: http://linux-ntfs.sf.net/, http://www-stu.christs.cam.ac.uk/~aia21/ =================================================================== This will update the following files: Documentation/filesystems/ntfs.txt | 3 +++ fs/ntfs/ChangeLog | 16 ++++++++++++++++ fs/ntfs/Makefile | 2 +- fs/ntfs/attrib.c | 15 ++++++++++----- fs/ntfs/compress.c | 3 ++- fs/ntfs/file.c | 9 ++++++++- fs/ntfs/inode.c | 8 ++++++-- fs/ntfs/super.c | 21 +++++++++++++++++---- fs/ntfs/volume.h | 2 ++ 9 files changed, 65 insertions(+), 14 deletions(-) through these ChangeSets: (02/08/07 1.471) 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. diff -Nru a/Documentation/filesystems/ntfs.txt b/Documentation/filesystems/ntfs.txt --- a/Documentation/filesystems/ntfs.txt Wed Aug 7 01:48:11 2002 +++ b/Documentation/filesystems/ntfs.txt Wed Aug 7 01:48:11 2002 @@ -247,6 +247,9 @@ 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. diff -Nru a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog --- a/fs/ntfs/ChangeLog Wed Aug 7 01:48:11 2002 +++ b/fs/ntfs/ChangeLog Wed Aug 7 01:48:11 2002 @@ -2,6 +2,22 @@ - 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 diff -Nru a/fs/ntfs/Makefile b/fs/ntfs/Makefile --- a/fs/ntfs/Makefile Wed Aug 7 01:48:11 2002 +++ b/fs/ntfs/Makefile Wed Aug 7 01:48:11 2002 @@ -5,7 +5,7 @@ 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 diff -Nru a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c --- a/fs/ntfs/attrib.c Wed Aug 7 01:48:11 2002 +++ b/fs/ntfs/attrib.c Wed Aug 7 01:48:11 2002 @@ -110,7 +110,8 @@ 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 @@ 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 @@ 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 @@ 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_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); diff -Nru a/fs/ntfs/compress.c b/fs/ntfs/compress.c --- a/fs/ntfs/compress.c Wed Aug 7 01:48:11 2002 +++ b/fs/ntfs/compress.c Wed Aug 7 01:48:11 2002 @@ -467,7 +467,8 @@ * 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); diff -Nru a/fs/ntfs/file.c b/fs/ntfs/file.c --- a/fs/ntfs/file.c Wed Aug 7 01:48:11 2002 +++ b/fs/ntfs/file.c Wed Aug 7 01:48:11 2002 @@ -51,8 +51,15 @@ 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. */ }; diff -Nru a/fs/ntfs/inode.c b/fs/ntfs/inode.c --- a/fs/ntfs/inode.c Wed Aug 7 01:48:11 2002 +++ b/fs/ntfs/inode.c Wed Aug 7 01:48:11 2002 @@ -278,7 +278,9 @@ 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 @@ 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); } diff -Nru a/fs/ntfs/super.c b/fs/ntfs/super.c --- a/fs/ntfs/super.c Wed Aug 7 01:48:11 2002 +++ b/fs/ntfs/super.c Wed Aug 7 01:48:11 2002 @@ -307,6 +307,23 @@ 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 @@ -323,10 +340,6 @@ if (!parse_options(vol, opt)) return -EINVAL; - -#ifndef NTFS_RW - *flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME; -#endif return 0; } diff -Nru a/fs/ntfs/volume.h b/fs/ntfs/volume.h --- a/fs/ntfs/volume.h Wed Aug 7 01:48:11 2002 +++ b/fs/ntfs/volume.h Wed Aug 7 01:48:11 2002 @@ -101,6 +101,7 @@ * 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 @@ } /* Emit the ntfs volume bitops functions. */ +NVOL_FNS(Errors) NVOL_FNS(ShowSystemFiles) NVOL_FNS(CaseSensitive) =================================================================== This BitKeeper patch contains the following changesets: + ## Wrapped with gzip_uu ## begin 664 bkpatch26415 M'XL(`$MN4#T``^5:;6_;.!+^+/V*:0KTG*ZMB'J7%RDVS4LWUS8IG+1[>RA@ MT!)EZ]:6#(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