]> git.hungrycats.org Git - linux/commitdiff
NTFS: - Move ntfs_{un,}map_page() from ntfs.h to aops.h and fix resulting
authorAnton Altaparmakov <aia21@cantab.net>
Thu, 7 Oct 2004 12:10:19 +0000 (13:10 +0100)
committerRichard Russon <ntfs@flatcap.org>
Thu, 7 Oct 2004 12:10:19 +0000 (13:10 +0100)
        include errors.
      - Move typedefs for runlist_element and runlist from ntfs.h to
        runlist.h and fix resulting include errors.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
29 files changed:
fs/ntfs/ChangeLog
fs/ntfs/aops.c
fs/ntfs/aops.h
fs/ntfs/attrib.c
fs/ntfs/bitmap.c
fs/ntfs/collate.c
fs/ntfs/compress.c
fs/ntfs/dir.c
fs/ntfs/dir.h
fs/ntfs/file.c
fs/ntfs/index.c
fs/ntfs/inode.c
fs/ntfs/inode.h
fs/ntfs/lcnalloc.c
fs/ntfs/lcnalloc.h
fs/ntfs/logfile.c
fs/ntfs/malloc.h
fs/ntfs/mft.c
fs/ntfs/mft.h
fs/ntfs/namei.c
fs/ntfs/ntfs.h
fs/ntfs/quota.c
fs/ntfs/runlist.c
fs/ntfs/runlist.h
fs/ntfs/super.c
fs/ntfs/types.h
fs/ntfs/unistr.c
fs/ntfs/upcase.c
fs/ntfs/volume.h

index 78208d9bc6735ea5e61f4b65854bbab9272f2516..7b311ebd5318bfd9273f7acf074d71c123e96aa8 100644 (file)
@@ -54,6 +54,10 @@ ToDo/Notes:
        - Switch fs/ntfs/index.h::ntfs_index_entry_mark_dirty() to using the
          new helper fs/ntfs/aops.c::mark_ntfs_record_dirty() and remove the no
          longer needed fs/ntfs/index.[hc]::__ntfs_index_entry_mark_dirty().
+       - Move ntfs_{un,}map_page() from ntfs.h to aops.h and fix resulting
+         include errors.
+       - Move the typedefs for runlist_element and runlist from types.h to
+         runlist.h and fix resulting include errors.
 
 2.1.20 - Fix two stupid bugs introduced in 2.1.18 release.
 
index f09a3157c0c4af5bdf28e696a610fe9c24be1aaf..61da8d51fd6ed9d9934d59ddd1a82da66ea4c0bf 100644 (file)
 #include <linux/buffer_head.h>
 
 #include "aops.h"
+#include "debug.h"
+#include "inode.h"
+#include "mft.h"
+#include "types.h"
 #include "ntfs.h"
 
 /**
index d1abd9e06467c03fdce447ff777e13aa0a2af717..2bdadc1d533b4c75b7d5bf0e27a8f7503ad4221f 100644 (file)
 #ifndef _LINUX_NTFS_AOPS_H
 #define _LINUX_NTFS_AOPS_H
 
-#ifdef NTFS_RW
+#include <linux/mm.h>
+#include <linux/highmem.h>
+#include <linux/pagemap.h>
+#include <linux/fs.h>
 
 #include "inode.h"
 
+/**
+ * ntfs_unmap_page - release a page that was mapped using ntfs_map_page()
+ * @page:      the page to release
+ *
+ * Unpin, unmap and release a page that was obtained from ntfs_map_page().
+ */
+static inline void ntfs_unmap_page(struct page *page)
+{
+       kunmap(page);
+       page_cache_release(page);
+}
+
+/**
+ * ntfs_map_page - map a page into accessible memory, reading it if necessary
+ * @mapping:   address space for which to obtain the page
+ * @index:     index into the page cache for @mapping of the page to map
+ *
+ * Read a page from the page cache of the address space @mapping at position
+ * @index, where @index is in units of PAGE_CACHE_SIZE, and not in bytes.
+ *
+ * If the page is not in memory it is loaded from disk first using the readpage
+ * method defined in the address space operations of @mapping and the page is
+ * added to the page cache of @mapping in the process.
+ *
+ * If the page is in high memory it is mapped into memory directly addressible
+ * by the kernel.
+ *
+ * Finally the page count is incremented, thus pinning the page into place.
+ *
+ * The above means that page_address(page) can be used on all pages obtained
+ * with ntfs_map_page() to get the kernel virtual address of the page.
+ *
+ * When finished with the page, the caller has to call ntfs_unmap_page() to
+ * unpin, unmap and release the page.
+ *
+ * Note this does not grant exclusive access. If such is desired, the caller
+ * must provide it independently of the ntfs_{un}map_page() calls by using
+ * a {rw_}semaphore or other means of serialization. A spin lock cannot be
+ * used as ntfs_map_page() can block.
+ *
+ * The unlocked and uptodate page is returned on success or an encoded error
+ * on failure. Caller has to test for error using the IS_ERR() macro on the
+ * return value. If that evaluates to TRUE, the negative error code can be
+ * obtained using PTR_ERR() on the return value of ntfs_map_page().
+ */
+static inline struct page *ntfs_map_page(struct address_space *mapping,
+               unsigned long index)
+{
+       struct page *page = read_cache_page(mapping, index,
+                       (filler_t*)mapping->a_ops->readpage, NULL);
+
+       if (!IS_ERR(page)) {
+               wait_on_page_locked(page);
+               kmap(page);
+               if (PageUptodate(page) && !PageError(page))
+                       return page;
+               ntfs_unmap_page(page);
+               return ERR_PTR(-EIO);
+       }
+       return page;
+}
+
+#ifdef NTFS_RW
+
 extern void mark_ntfs_record_dirty(ntfs_inode *ni, struct page *page,
                unsigned int rec_start);
 
index b8db01aaf3936273147b61967aa765f2422f6d1e..865de0c2c3d012065c14492b3a67e919dd8ba105 100644 (file)
  */
 
 #include <linux/buffer_head.h>
+
+#include "attrib.h"
+#include "debug.h"
+#include "mft.h"
 #include "ntfs.h"
 
 /**
index b8f06111f6ef5b2d89188a6649c26aa43f181c56..12cf2e30c7dda9a2a8234af1c3b5a710f85aab72 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "bitmap.h"
 #include "debug.h"
+#include "aops.h"
 #include "ntfs.h"
 
 /**
index 31dd894a4319f5e126d55788890100e61b965dfd..4a28ab3898ef382c1971e7fe8978608a69e9afec 100644 (file)
@@ -19,8 +19,9 @@
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include "ntfs.h"
 #include "collate.h"
+#include "debug.h"
+#include "ntfs.h"
 
 static int ntfs_collate_binary(ntfs_volume *vol,
                const void *data1, const int data1_len,
index b4554e4bbbecc5fcf225ab5580a370082ee2763e..b96fe5ff68dd1933515de48294b1147e5a8b8b21 100644 (file)
@@ -25,6 +25,8 @@
 #include <linux/buffer_head.h>
 #include <linux/blkdev.h>
 
+#include "inode.h"
+#include "debug.h"
 #include "ntfs.h"
 
 /**
index ed9838e0c5d08ae7bde8762c86e1d3aa05cc066a..2700e4bd557436ca6f2dc884e6c645be70ad9ea4 100644 (file)
  */
 
 #include <linux/smp_lock.h>
-#include "ntfs.h"
+#include <linux/buffer_head.h>
+
 #include "dir.h"
+#include "aops.h"
+#include "attrib.h"
+#include "mft.h"
+#include "debug.h"
+#include "ntfs.h"
 
 /**
  * The little endian Unicode string $I30 as a global constant.
index 90a8c3f6520318a16b038680e64a58aba931a298..aea7582d561fc19649301de32a70d1bc8689a1c4 100644 (file)
@@ -24,6 +24,8 @@
 #define _LINUX_NTFS_DIR_H
 
 #include "layout.h"
+#include "inode.h"
+#include "types.h"
 
 /*
  * ntfs_name is used to return the file name to the caller of
index c7880d55b250d2ac3acb8eaab4b8e9410370ae87..e808649d5a8fed0c7740f9760ee8d54aa6b6e12f 100644 (file)
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include <linux/pagemap.h>
+#include <linux/buffer_head.h>
+
+#include "debug.h"
 #include "ntfs.h"
 
 /**
index 11be36f68bc99022c6c5f2c6404b9738f9d4f7c0..aded65d13a6551fd42b61972110e987bf40d95d9 100644 (file)
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include "ntfs.h"
+#include "aops.h"
 #include "collate.h"
+#include "debug.h"
 #include "index.h"
+#include "ntfs.h"
 
 /**
  * ntfs_index_ctx_get - allocate and initialize a new index context
index 8c48de078c411b71942ee6abbf89fa3de86ff07d..a592f57b5dbb4f9781a3c1e6123d285e839e9ae2 100644 (file)
 
 #include "ntfs.h"
 #include "dir.h"
+#include "debug.h"
 #include "inode.h"
 #include "attrib.h"
+#include "malloc.h"
+#include "mft.h"
 #include "time.h"
 
 /**
index 3aa7b873fe0df8b6a4e1ac841dba89206a046d15..bf1d906d169130e6e2780f4d4960c1c584506936 100644 (file)
 #ifndef _LINUX_NTFS_INODE_H
 #define _LINUX_NTFS_INODE_H
 
+#include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/seq_file.h>
+#include <linux/list.h>
+#include <asm/atomic.h>
+#include <asm/semaphore.h>
 
 #include "layout.h"
 #include "volume.h"
+#include "types.h"
+#include "runlist.h"
 
 typedef struct _ntfs_inode ntfs_inode;
 
index 5f291021a193f36c74f8d3ef2cc78b8febe8c9ed..17888c9f02f162d83f2e2e5c0766f0ce366d37dd 100644 (file)
@@ -30,6 +30,7 @@
 #include "volume.h"
 #include "attrib.h"
 #include "malloc.h"
+#include "aops.h"
 #include "ntfs.h"
 
 /**
index b9ebb31100a1e2e33317a1b827a6f04c416fd3ae..4cac1c024af60809142a43b6431f380aff3d05ee 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/fs.h>
 
 #include "types.h"
+#include "runlist.h"
 #include "volume.h"
 
 typedef enum {
index 84ed2ef14a325a66c13600a6e8b833e9ae11215b..9f20835e04a956c156f50e86bd44ca626ef6786f 100644 (file)
 
 #include "logfile.h"
 #include "volume.h"
-#include "ntfs.h"
+#include "aops.h"
 #include "debug.h"
+#include "malloc.h"
+#include "ntfs.h"
 
 /**
  * ntfs_check_restart_page_header - check the page header for consistency
index c8548a5336e000ae00c3dfed37797703877180df..fac5944df6d80a2657191eae0aee6128827adb70 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <linux/vmalloc.h>
 #include <linux/slab.h>
+#include <linux/highmem.h>
 
 /**
  * ntfs_malloc_nofs - allocate memory in multiples of pages
index 4b9be65ca33d01f4943ec47418d12b0bd656f815..99aa4decb9c2ede711d5ab1eda223ebcb7a23693 100644 (file)
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include <linux/buffer_head.h>
 #include <linux/swap.h>
 
-#include "ntfs.h"
 #include "bitmap.h"
+#include "lcnalloc.h"
+#include "aops.h"
+#include "debug.h"
+#include "mft.h"
+#include "malloc.h"
+#include "ntfs.h"
 
 /**
  * __format_mft_record - initialize an empty mft record
index 5f3566779fa8ea634b31682182f744b9d087e9d1..924f87abff8b93f54088d721e90adc511ee44e3a 100644 (file)
@@ -24,6 +24,8 @@
 #define _LINUX_NTFS_MFT_H
 
 #include <linux/fs.h>
+#include <linux/highmem.h>
+#include <linux/pagemap.h>
 
 #include "inode.h"
 
index 70b503a85f4d1e48528f71cc7f526d81590e93ec..b47084f0607bbddfa894b224405ec0be4db9e97e 100644 (file)
 #include <linux/dcache.h>
 #include <linux/security.h>
 
-#include "ntfs.h"
 #include "dir.h"
+#include "debug.h"
+#include "mft.h"
+#include "ntfs.h"
 
 /**
  * ntfs_lookup - find the inode represented by a dentry in a directory inode
index c3fda17158e6e83432f1af6571740b34f2810170..d65c401ccbc3dea63f6a4160a47a61814cbb0778 100644 (file)
 #include <linux/module.h>
 #include <linux/compiler.h>
 #include <linux/fs.h>
-#include <linux/buffer_head.h>
 #include <linux/nls.h>
-#include <linux/pagemap.h>
 #include <linux/smp.h>
-#include <asm/atomic.h>
 
 #include "types.h"
-#include "debug.h"
-#include "malloc.h"
-#include "endian.h"
 #include "volume.h"
-#include "inode.h"
 #include "layout.h"
-#include "attrib.h"
-#include "mft.h"
 
 typedef enum {
        NTFS_BLOCK_SIZE         = 512,
@@ -87,72 +78,12 @@ static inline ntfs_volume *NTFS_SB(struct super_block *sb)
        return sb->s_fs_info;
 }
 
-/**
- * ntfs_unmap_page - release a page that was mapped using ntfs_map_page()
- * @page:      the page to release
- *
- * Unpin, unmap and release a page that was obtained from ntfs_map_page().
- */
-static inline void ntfs_unmap_page(struct page *page)
-{
-       kunmap(page);
-       page_cache_release(page);
-}
-
-/**
- * ntfs_map_page - map a page into accessible memory, reading it if necessary
- * @mapping:   address space for which to obtain the page
- * @index:     index into the page cache for @mapping of the page to map
- *
- * Read a page from the page cache of the address space @mapping at position
- * @index, where @index is in units of PAGE_CACHE_SIZE, and not in bytes.
- *
- * If the page is not in memory it is loaded from disk first using the readpage
- * method defined in the address space operations of @mapping and the page is
- * added to the page cache of @mapping in the process.
- *
- * If the page is in high memory it is mapped into memory directly addressible
- * by the kernel.
- *
- * Finally the page count is incremented, thus pinning the page into place.
- *
- * The above means that page_address(page) can be used on all pages obtained
- * with ntfs_map_page() to get the kernel virtual address of the page.
- *
- * When finished with the page, the caller has to call ntfs_unmap_page() to
- * unpin, unmap and release the page.
- *
- * Note this does not grant exclusive access. If such is desired, the caller
- * must provide it independently of the ntfs_{un}map_page() calls by using
- * a {rw_}semaphore or other means of serialization. A spin lock cannot be
- * used as ntfs_map_page() can block.
- *
- * The unlocked and uptodate page is returned on success or an encoded error
- * on failure. Caller has to test for error using the IS_ERR() macro on the
- * return value. If that evaluates to TRUE, the negative error code can be
- * obtained using PTR_ERR() on the return value of ntfs_map_page().
- */
-static inline struct page *ntfs_map_page(struct address_space *mapping,
-               unsigned long index)
-{
-       struct page *page = read_cache_page(mapping, index,
-                       (filler_t*)mapping->a_ops->readpage, NULL);
-
-       if (!IS_ERR(page)) {
-               wait_on_page_locked(page);
-               kmap(page);
-               if (PageUptodate(page) && !PageError(page))
-                       return page;
-               ntfs_unmap_page(page);
-               return ERR_PTR(-EIO);
-       }
-       return page;
-}
-
 /* Declarations of functions and global variables. */
 
 /* From fs/ntfs/compress.c */
 extern int ntfs_read_compressed_block(struct page *page);
+extern int allocate_compression_buffers(void);
+extern void free_compression_buffers(void);
 
 /* From fs/ntfs/super.c */
 #define default_upcase_len 0x10000
@@ -166,10 +97,6 @@ typedef struct {
 } option_t;
 extern const option_t on_errors_arr[];
 
-/* From fs/ntfs/compress.c */
-extern int allocate_compression_buffers(void);
-extern void free_compression_buffers(void);
-
 /* From fs/ntfs/mst.c */
 extern int post_read_mst_fixup(NTFS_RECORD *b, const u32 size);
 extern int pre_write_mst_fixup(NTFS_RECORD *b, const u32 size);
index b72a85dd446f9618d3f3fa67efab620986dc2da2..8764ebd8d063bf984ac4ec742eef00c96226b6e8 100644 (file)
 
 #ifdef NTFS_RW
 
-#include "ntfs.h"
 #include "index.h"
 #include "quota.h"
+#include "debug.h"
+#include "ntfs.h"
 
 /**
  * ntfs_mark_quotas_out_of_date - mark the quotas out of date on an ntfs volume
index b900f2fde18d32ba2d9b0ef54439c2b8e64403bd..6b9ca6883581c5012736ea0b9f62d7a9230286f5 100644 (file)
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include "ntfs.h"
 #include "dir.h"
+#include "debug.h"
+#include "malloc.h"
+#include "ntfs.h"
 
 /**
  * ntfs_rl_mm - runlist memmove
index 7d82f4bd87d392a92f84c2790b3ed67fbb436871..7107fde59df9c7e80d33b12fedb06aa663a8cec0 100644 (file)
 #include "layout.h"
 #include "volume.h"
 
+/**
+ * runlist_element - in memory vcn to lcn mapping array element
+ * @vcn:       starting vcn of the current array element
+ * @lcn:       starting lcn of the current array element
+ * @length:    length in clusters of the current array element
+ *
+ * The last vcn (in fact the last vcn + 1) is reached when length == 0.
+ *
+ * When lcn == -1 this means that the count vcns starting at vcn are not
+ * physically allocated (i.e. this is a hole / data is sparse).
+ */
+typedef struct {       /* In memory vcn to lcn mapping structure element. */
+       VCN vcn;        /* vcn = Starting virtual cluster number. */
+       LCN lcn;        /* lcn = Starting logical cluster number. */
+       s64 length;     /* Run length in clusters. */
+} runlist_element;
+
+/**
+ * runlist - in memory vcn to lcn mapping array including a read/write lock
+ * @rl:                pointer to an array of runlist elements
+ * @lock:      read/write spinlock for serializing access to @rl
+ *
+ */
+typedef struct {
+       runlist_element *rl;
+       struct rw_semaphore lock;
+} runlist;
+
 static inline void ntfs_init_runlist(runlist *rl)
 {
        rl->rl = NULL;
index 7d2a7b668f81729d1ad87aca0b6c763bfaab9afe..7edbdefd9d7a2e00ab2fedd3b27ef323dd8d542f 100644 (file)
 #include <linux/moduleparam.h>
 #include <linux/smp_lock.h>
 
-#include "ntfs.h"
 #include "sysctl.h"
 #include "logfile.h"
 #include "quota.h"
 #include "dir.h"
+#include "debug.h"
 #include "index.h"
+#include "aops.h"
+#include "malloc.h"
+#include "ntfs.h"
 
 /* Number of mounted file systems which have compression enabled. */
 static unsigned long ntfs_nr_compression_users;
index a98731ece42e4606c7c1378d54c3f2371e21158f..08a55aa53d4e57d2f9564342c99523170f18a913 100644 (file)
@@ -53,34 +53,6 @@ typedef sle64 leLCN;
 typedef s64 LSN;
 typedef sle64 leLSN;
 
-/**
- * runlist_element - in memory vcn to lcn mapping array element
- * @vcn:       starting vcn of the current array element
- * @lcn:       starting lcn of the current array element
- * @length:    length in clusters of the current array element
- *
- * The last vcn (in fact the last vcn + 1) is reached when length == 0.
- *
- * When lcn == -1 this means that the count vcns starting at vcn are not
- * physically allocated (i.e. this is a hole / data is sparse).
- */
-typedef struct {       /* In memory vcn to lcn mapping structure element. */
-       VCN vcn;        /* vcn = Starting virtual cluster number. */
-       LCN lcn;        /* lcn = Starting logical cluster number. */
-       s64 length;     /* Run length in clusters. */
-} runlist_element;
-
-/**
- * runlist - in memory vcn to lcn mapping array including a read/write lock
- * @rl:                pointer to an array of runlist elements
- * @lock:      read/write spinlock for serializing access to @rl
- *
- */
-typedef struct {
-       runlist_element *rl;
-       struct rw_semaphore lock;
-} runlist;
-
 typedef enum {
        FALSE = 0,
        TRUE = 1
index ec7405a80b4cbf83022b819c34261420de257e11..560b0ea255b0b6be01b5f3abcb4ad9d572c457da 100644 (file)
@@ -19,6 +19,8 @@
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include "types.h"
+#include "debug.h"
 #include "ntfs.h"
 
 /*
index 276ed97982d32c84e05dd4ebe0ad4ea6a684fe8b..879cdf1d5bd392ba4fe3662dd766c527dfeb3b6d 100644 (file)
@@ -24,6 +24,7 @@
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include "malloc.h"
 #include "ntfs.h"
 
 ntfschar *generate_default_upcase(void)
index 4d0541350fff8fa648d2c716f426a5822962de71..4b97fa8635a89e7c553e4cd4182c6e0d26dd546a 100644 (file)
@@ -24,6 +24,8 @@
 #ifndef _LINUX_NTFS_VOLUME_H
 #define _LINUX_NTFS_VOLUME_H
 
+#include <linux/rwsem.h>
+
 #include "types.h"
 #include "layout.h"