diff options
Diffstat (limited to 'fs/ntfs')
-rw-r--r-- | fs/ntfs/aops.c | 2 | ||||
-rw-r--r-- | fs/ntfs/file.c | 54 | ||||
-rw-r--r-- | fs/ntfs/layout.h | 2 | ||||
-rw-r--r-- | fs/ntfs/malloc.h | 2 | ||||
-rw-r--r-- | fs/ntfs/mft.c | 13 | ||||
-rw-r--r-- | fs/ntfs/super.c | 10 |
6 files changed, 17 insertions, 66 deletions
diff --git a/fs/ntfs/aops.c b/fs/ntfs/aops.c index b38f944f0667..cfce53cb65d7 100644 --- a/fs/ntfs/aops.c +++ b/fs/ntfs/aops.c | |||
@@ -1550,6 +1550,7 @@ const struct address_space_operations ntfs_aops = { | |||
1550 | .migratepage = buffer_migrate_page, /* Move a page cache page from | 1550 | .migratepage = buffer_migrate_page, /* Move a page cache page from |
1551 | one physical page to an | 1551 | one physical page to an |
1552 | other. */ | 1552 | other. */ |
1553 | .error_remove_page = generic_error_remove_page, | ||
1553 | }; | 1554 | }; |
1554 | 1555 | ||
1555 | /** | 1556 | /** |
@@ -1569,6 +1570,7 @@ const struct address_space_operations ntfs_mst_aops = { | |||
1569 | .migratepage = buffer_migrate_page, /* Move a page cache page from | 1570 | .migratepage = buffer_migrate_page, /* Move a page cache page from |
1570 | one physical page to an | 1571 | one physical page to an |
1571 | other. */ | 1572 | other. */ |
1573 | .error_remove_page = generic_error_remove_page, | ||
1572 | }; | 1574 | }; |
1573 | 1575 | ||
1574 | #ifdef NTFS_RW | 1576 | #ifdef NTFS_RW |
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c index 3140a4429af1..663c0e341f8b 100644 --- a/fs/ntfs/file.c +++ b/fs/ntfs/file.c | |||
@@ -2076,14 +2076,6 @@ err_out: | |||
2076 | *ppos = pos; | 2076 | *ppos = pos; |
2077 | if (cached_page) | 2077 | if (cached_page) |
2078 | page_cache_release(cached_page); | 2078 | page_cache_release(cached_page); |
2079 | /* For now, when the user asks for O_SYNC, we actually give O_DSYNC. */ | ||
2080 | if (likely(!status)) { | ||
2081 | if (unlikely((file->f_flags & O_SYNC) || IS_SYNC(vi))) { | ||
2082 | if (!mapping->a_ops->writepage || !is_sync_kiocb(iocb)) | ||
2083 | status = generic_osync_inode(vi, mapping, | ||
2084 | OSYNC_METADATA|OSYNC_DATA); | ||
2085 | } | ||
2086 | } | ||
2087 | pagevec_lru_add_file(&lru_pvec); | 2079 | pagevec_lru_add_file(&lru_pvec); |
2088 | ntfs_debug("Done. Returning %s (written 0x%lx, status %li).", | 2080 | ntfs_debug("Done. Returning %s (written 0x%lx, status %li).", |
2089 | written ? "written" : "status", (unsigned long)written, | 2081 | written ? "written" : "status", (unsigned long)written, |
@@ -2145,8 +2137,8 @@ static ssize_t ntfs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
2145 | mutex_lock(&inode->i_mutex); | 2137 | mutex_lock(&inode->i_mutex); |
2146 | ret = ntfs_file_aio_write_nolock(iocb, iov, nr_segs, &iocb->ki_pos); | 2138 | ret = ntfs_file_aio_write_nolock(iocb, iov, nr_segs, &iocb->ki_pos); |
2147 | mutex_unlock(&inode->i_mutex); | 2139 | mutex_unlock(&inode->i_mutex); |
2148 | if (ret > 0 && ((file->f_flags & O_SYNC) || IS_SYNC(inode))) { | 2140 | if (ret > 0) { |
2149 | int err = sync_page_range(inode, mapping, pos, ret); | 2141 | int err = generic_write_sync(file, pos, ret); |
2150 | if (err < 0) | 2142 | if (err < 0) |
2151 | ret = err; | 2143 | ret = err; |
2152 | } | 2144 | } |
@@ -2154,46 +2146,6 @@ static ssize_t ntfs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
2154 | } | 2146 | } |
2155 | 2147 | ||
2156 | /** | 2148 | /** |
2157 | * ntfs_file_writev - | ||
2158 | * | ||
2159 | * Basically the same as generic_file_writev() except that it ends up calling | ||
2160 | * ntfs_file_aio_write_nolock() instead of __generic_file_aio_write_nolock(). | ||
2161 | */ | ||
2162 | static ssize_t ntfs_file_writev(struct file *file, const struct iovec *iov, | ||
2163 | unsigned long nr_segs, loff_t *ppos) | ||
2164 | { | ||
2165 | struct address_space *mapping = file->f_mapping; | ||
2166 | struct inode *inode = mapping->host; | ||
2167 | struct kiocb kiocb; | ||
2168 | ssize_t ret; | ||
2169 | |||
2170 | mutex_lock(&inode->i_mutex); | ||
2171 | init_sync_kiocb(&kiocb, file); | ||
2172 | ret = ntfs_file_aio_write_nolock(&kiocb, iov, nr_segs, ppos); | ||
2173 | if (ret == -EIOCBQUEUED) | ||
2174 | ret = wait_on_sync_kiocb(&kiocb); | ||
2175 | mutex_unlock(&inode->i_mutex); | ||
2176 | if (ret > 0 && ((file->f_flags & O_SYNC) || IS_SYNC(inode))) { | ||
2177 | int err = sync_page_range(inode, mapping, *ppos - ret, ret); | ||
2178 | if (err < 0) | ||
2179 | ret = err; | ||
2180 | } | ||
2181 | return ret; | ||
2182 | } | ||
2183 | |||
2184 | /** | ||
2185 | * ntfs_file_write - simple wrapper for ntfs_file_writev() | ||
2186 | */ | ||
2187 | static ssize_t ntfs_file_write(struct file *file, const char __user *buf, | ||
2188 | size_t count, loff_t *ppos) | ||
2189 | { | ||
2190 | struct iovec local_iov = { .iov_base = (void __user *)buf, | ||
2191 | .iov_len = count }; | ||
2192 | |||
2193 | return ntfs_file_writev(file, &local_iov, 1, ppos); | ||
2194 | } | ||
2195 | |||
2196 | /** | ||
2197 | * ntfs_file_fsync - sync a file to disk | 2149 | * ntfs_file_fsync - sync a file to disk |
2198 | * @filp: file to be synced | 2150 | * @filp: file to be synced |
2199 | * @dentry: dentry describing the file to sync | 2151 | * @dentry: dentry describing the file to sync |
@@ -2255,7 +2207,7 @@ const struct file_operations ntfs_file_ops = { | |||
2255 | .read = do_sync_read, /* Read from file. */ | 2207 | .read = do_sync_read, /* Read from file. */ |
2256 | .aio_read = generic_file_aio_read, /* Async read from file. */ | 2208 | .aio_read = generic_file_aio_read, /* Async read from file. */ |
2257 | #ifdef NTFS_RW | 2209 | #ifdef NTFS_RW |
2258 | .write = ntfs_file_write, /* Write to file. */ | 2210 | .write = do_sync_write, /* Write to file. */ |
2259 | .aio_write = ntfs_file_aio_write, /* Async write to file. */ | 2211 | .aio_write = ntfs_file_aio_write, /* Async write to file. */ |
2260 | /*.release = ,*/ /* Last file is closed. See | 2212 | /*.release = ,*/ /* Last file is closed. See |
2261 | fs/ext2/file.c:: | 2213 | fs/ext2/file.c:: |
diff --git a/fs/ntfs/layout.h b/fs/ntfs/layout.h index 50931b1ce4b9..8b2549f672bf 100644 --- a/fs/ntfs/layout.h +++ b/fs/ntfs/layout.h | |||
@@ -829,7 +829,7 @@ enum { | |||
829 | /* Note, FILE_ATTR_VALID_SET_FLAGS masks out the old DOS VolId, the | 829 | /* Note, FILE_ATTR_VALID_SET_FLAGS masks out the old DOS VolId, the |
830 | F_A_DEVICE, F_A_DIRECTORY, F_A_SPARSE_FILE, F_A_REPARSE_POINT, | 830 | F_A_DEVICE, F_A_DIRECTORY, F_A_SPARSE_FILE, F_A_REPARSE_POINT, |
831 | F_A_COMPRESSED, and F_A_ENCRYPTED and preserves the rest. This mask | 831 | F_A_COMPRESSED, and F_A_ENCRYPTED and preserves the rest. This mask |
832 | is used to to obtain all flags that are valid for setting. */ | 832 | is used to obtain all flags that are valid for setting. */ |
833 | /* | 833 | /* |
834 | * The flag FILE_ATTR_DUP_FILENAME_INDEX_PRESENT is present in all | 834 | * The flag FILE_ATTR_DUP_FILENAME_INDEX_PRESENT is present in all |
835 | * FILENAME_ATTR attributes but not in the STANDARD_INFORMATION | 835 | * FILENAME_ATTR attributes but not in the STANDARD_INFORMATION |
diff --git a/fs/ntfs/malloc.h b/fs/ntfs/malloc.h index cd0be3f5c3cd..a44b14cbceeb 100644 --- a/fs/ntfs/malloc.h +++ b/fs/ntfs/malloc.h | |||
@@ -47,7 +47,7 @@ static inline void *__ntfs_malloc(unsigned long size, gfp_t gfp_mask) | |||
47 | return kmalloc(PAGE_SIZE, gfp_mask & ~__GFP_HIGHMEM); | 47 | return kmalloc(PAGE_SIZE, gfp_mask & ~__GFP_HIGHMEM); |
48 | /* return (void *)__get_free_page(gfp_mask); */ | 48 | /* return (void *)__get_free_page(gfp_mask); */ |
49 | } | 49 | } |
50 | if (likely(size >> PAGE_SHIFT < num_physpages)) | 50 | if (likely((size >> PAGE_SHIFT) < totalram_pages)) |
51 | return __vmalloc(size, gfp_mask, PAGE_KERNEL); | 51 | return __vmalloc(size, gfp_mask, PAGE_KERNEL); |
52 | return NULL; | 52 | return NULL; |
53 | } | 53 | } |
diff --git a/fs/ntfs/mft.c b/fs/ntfs/mft.c index 23bf68453d7d..1caa0ef0b2bb 100644 --- a/fs/ntfs/mft.c +++ b/fs/ntfs/mft.c | |||
@@ -384,13 +384,12 @@ unm_err_out: | |||
384 | * it is dirty in the inode meta data rather than the data page cache of the | 384 | * it is dirty in the inode meta data rather than the data page cache of the |
385 | * inode, and thus there are no data pages that need writing out. Therefore, a | 385 | * inode, and thus there are no data pages that need writing out. Therefore, a |
386 | * full mark_inode_dirty() is overkill. A mark_inode_dirty_sync(), on the | 386 | * full mark_inode_dirty() is overkill. A mark_inode_dirty_sync(), on the |
387 | * other hand, is not sufficient, because I_DIRTY_DATASYNC needs to be set to | 387 | * other hand, is not sufficient, because ->write_inode needs to be called even |
388 | * ensure ->write_inode is called from generic_osync_inode() and this needs to | 388 | * in case of fdatasync. This needs to happen or the file data would not |
389 | * happen or the file data would not necessarily hit the device synchronously, | 389 | * necessarily hit the device synchronously, even though the vfs inode has the |
390 | * even though the vfs inode has the O_SYNC flag set. Also, I_DIRTY_DATASYNC | 390 | * O_SYNC flag set. Also, I_DIRTY_DATASYNC simply "feels" better than just |
391 | * simply "feels" better than just I_DIRTY_SYNC, since the file data has not | 391 | * I_DIRTY_SYNC, since the file data has not actually hit the block device yet, |
392 | * actually hit the block device yet, which is not what I_DIRTY_SYNC on its own | 392 | * which is not what I_DIRTY_SYNC on its own would suggest. |
393 | * would suggest. | ||
394 | */ | 393 | */ |
395 | void __mark_mft_record_dirty(ntfs_inode *ni) | 394 | void __mark_mft_record_dirty(ntfs_inode *ni) |
396 | { | 395 | { |
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index abaaa1cbf8de..80b04770e8e9 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c | |||
@@ -201,8 +201,7 @@ use_utf8: | |||
201 | v, old_nls->charset); | 201 | v, old_nls->charset); |
202 | nls_map = old_nls; | 202 | nls_map = old_nls; |
203 | } else /* nls_map */ { | 203 | } else /* nls_map */ { |
204 | if (old_nls) | 204 | unload_nls(old_nls); |
205 | unload_nls(old_nls); | ||
206 | } | 205 | } |
207 | } else if (!strcmp(p, "utf8")) { | 206 | } else if (!strcmp(p, "utf8")) { |
208 | bool val = false; | 207 | bool val = false; |
@@ -2427,10 +2426,9 @@ static void ntfs_put_super(struct super_block *sb) | |||
2427 | ntfs_free(vol->upcase); | 2426 | ntfs_free(vol->upcase); |
2428 | vol->upcase = NULL; | 2427 | vol->upcase = NULL; |
2429 | } | 2428 | } |
2430 | if (vol->nls_map) { | 2429 | |
2431 | unload_nls(vol->nls_map); | 2430 | unload_nls(vol->nls_map); |
2432 | vol->nls_map = NULL; | 2431 | |
2433 | } | ||
2434 | sb->s_fs_info = NULL; | 2432 | sb->s_fs_info = NULL; |
2435 | kfree(vol); | 2433 | kfree(vol); |
2436 | 2434 | ||