diff options
Diffstat (limited to 'fs/reiserfs')
-rw-r--r-- | fs/reiserfs/file.c | 64 | ||||
-rw-r--r-- | fs/reiserfs/inode.c | 10 | ||||
-rw-r--r-- | fs/reiserfs/journal.c | 18 | ||||
-rw-r--r-- | fs/reiserfs/super.c | 9 | ||||
-rw-r--r-- | fs/reiserfs/xattr.c | 2 |
5 files changed, 30 insertions, 73 deletions
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index b67ce9354048..373d862c3f87 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c | |||
@@ -74,7 +74,8 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp) | |||
74 | igrab(inode); | 74 | igrab(inode); |
75 | reiserfs_warning(inode->i_sb, | 75 | reiserfs_warning(inode->i_sb, |
76 | "pinning inode %lu because the " | 76 | "pinning inode %lu because the " |
77 | "preallocation can't be freed"); | 77 | "preallocation can't be freed", |
78 | inode->i_ino); | ||
78 | goto out; | 79 | goto out; |
79 | } | 80 | } |
80 | } | 81 | } |
@@ -316,12 +317,11 @@ static int reiserfs_allocate_blocks_for_region(struct reiserfs_transaction_handl | |||
316 | /* area filled with zeroes, to supply as list of zero blocknumbers | 317 | /* area filled with zeroes, to supply as list of zero blocknumbers |
317 | We allocate it outside of loop just in case loop would spin for | 318 | We allocate it outside of loop just in case loop would spin for |
318 | several iterations. */ | 319 | several iterations. */ |
319 | char *zeros = kmalloc(to_paste * UNFM_P_SIZE, GFP_ATOMIC); // We cannot insert more than MAX_ITEM_LEN bytes anyway. | 320 | char *zeros = kzalloc(to_paste * UNFM_P_SIZE, GFP_ATOMIC); // We cannot insert more than MAX_ITEM_LEN bytes anyway. |
320 | if (!zeros) { | 321 | if (!zeros) { |
321 | res = -ENOMEM; | 322 | res = -ENOMEM; |
322 | goto error_exit_free_blocks; | 323 | goto error_exit_free_blocks; |
323 | } | 324 | } |
324 | memset(zeros, 0, to_paste * UNFM_P_SIZE); | ||
325 | do { | 325 | do { |
326 | to_paste = | 326 | to_paste = |
327 | min_t(__u64, hole_size, | 327 | min_t(__u64, hole_size, |
@@ -406,6 +406,8 @@ static int reiserfs_allocate_blocks_for_region(struct reiserfs_transaction_handl | |||
406 | we restart it. This will also free the path. */ | 406 | we restart it. This will also free the path. */ |
407 | if (journal_transaction_should_end | 407 | if (journal_transaction_should_end |
408 | (th, th->t_blocks_allocated)) { | 408 | (th, th->t_blocks_allocated)) { |
409 | inode->i_size = cpu_key_k_offset(&key) + | ||
410 | (to_paste << inode->i_blkbits); | ||
409 | res = | 411 | res = |
410 | restart_transaction(th, inode, | 412 | restart_transaction(th, inode, |
411 | &path); | 413 | &path); |
@@ -1044,6 +1046,7 @@ static int reiserfs_prepare_file_region_for_write(struct inode *inode | |||
1044 | char *kaddr = kmap_atomic(prepared_pages[0], KM_USER0); | 1046 | char *kaddr = kmap_atomic(prepared_pages[0], KM_USER0); |
1045 | memset(kaddr, 0, from); | 1047 | memset(kaddr, 0, from); |
1046 | kunmap_atomic(kaddr, KM_USER0); | 1048 | kunmap_atomic(kaddr, KM_USER0); |
1049 | flush_dcache_page(prepared_pages[0]); | ||
1047 | } | 1050 | } |
1048 | if (to != PAGE_CACHE_SIZE) { /* Last page needs to be partially zeroed */ | 1051 | if (to != PAGE_CACHE_SIZE) { /* Last page needs to be partially zeroed */ |
1049 | char *kaddr = | 1052 | char *kaddr = |
@@ -1051,6 +1054,7 @@ static int reiserfs_prepare_file_region_for_write(struct inode *inode | |||
1051 | KM_USER0); | 1054 | KM_USER0); |
1052 | memset(kaddr + to, 0, PAGE_CACHE_SIZE - to); | 1055 | memset(kaddr + to, 0, PAGE_CACHE_SIZE - to); |
1053 | kunmap_atomic(kaddr, KM_USER0); | 1056 | kunmap_atomic(kaddr, KM_USER0); |
1057 | flush_dcache_page(prepared_pages[num_pages - 1]); | ||
1054 | } | 1058 | } |
1055 | 1059 | ||
1056 | /* Since all blocks are new - use already calculated value */ | 1060 | /* Since all blocks are new - use already calculated value */ |
@@ -1184,6 +1188,7 @@ static int reiserfs_prepare_file_region_for_write(struct inode *inode | |||
1184 | memset(kaddr + block_start, 0, | 1188 | memset(kaddr + block_start, 0, |
1185 | from - block_start); | 1189 | from - block_start); |
1186 | kunmap_atomic(kaddr, KM_USER0); | 1190 | kunmap_atomic(kaddr, KM_USER0); |
1191 | flush_dcache_page(prepared_pages[0]); | ||
1187 | set_buffer_uptodate(bh); | 1192 | set_buffer_uptodate(bh); |
1188 | } | 1193 | } |
1189 | } | 1194 | } |
@@ -1221,6 +1226,7 @@ static int reiserfs_prepare_file_region_for_write(struct inode *inode | |||
1221 | KM_USER0); | 1226 | KM_USER0); |
1222 | memset(kaddr + to, 0, block_end - to); | 1227 | memset(kaddr + to, 0, block_end - to); |
1223 | kunmap_atomic(kaddr, KM_USER0); | 1228 | kunmap_atomic(kaddr, KM_USER0); |
1229 | flush_dcache_page(prepared_pages[num_pages - 1]); | ||
1224 | set_buffer_uptodate(bh); | 1230 | set_buffer_uptodate(bh); |
1225 | } | 1231 | } |
1226 | } | 1232 | } |
@@ -1306,56 +1312,8 @@ static ssize_t reiserfs_file_write(struct file *file, /* the file we are going t | |||
1306 | count = MAX_NON_LFS - (unsigned long)*ppos; | 1312 | count = MAX_NON_LFS - (unsigned long)*ppos; |
1307 | } | 1313 | } |
1308 | 1314 | ||
1309 | if (file->f_flags & O_DIRECT) { // Direct IO needs treatment | 1315 | if (file->f_flags & O_DIRECT) |
1310 | ssize_t result, after_file_end = 0; | 1316 | return do_sync_write(file, buf, count, ppos); |
1311 | if ((*ppos + count >= inode->i_size) | ||
1312 | || (file->f_flags & O_APPEND)) { | ||
1313 | /* If we are appending a file, we need to put this savelink in here. | ||
1314 | If we will crash while doing direct io, finish_unfinished will | ||
1315 | cut the garbage from the file end. */ | ||
1316 | reiserfs_write_lock(inode->i_sb); | ||
1317 | err = | ||
1318 | journal_begin(&th, inode->i_sb, | ||
1319 | JOURNAL_PER_BALANCE_CNT); | ||
1320 | if (err) { | ||
1321 | reiserfs_write_unlock(inode->i_sb); | ||
1322 | return err; | ||
1323 | } | ||
1324 | reiserfs_update_inode_transaction(inode); | ||
1325 | add_save_link(&th, inode, 1 /* Truncate */ ); | ||
1326 | after_file_end = 1; | ||
1327 | err = | ||
1328 | journal_end(&th, inode->i_sb, | ||
1329 | JOURNAL_PER_BALANCE_CNT); | ||
1330 | reiserfs_write_unlock(inode->i_sb); | ||
1331 | if (err) | ||
1332 | return err; | ||
1333 | } | ||
1334 | result = do_sync_write(file, buf, count, ppos); | ||
1335 | |||
1336 | if (after_file_end) { /* Now update i_size and remove the savelink */ | ||
1337 | struct reiserfs_transaction_handle th; | ||
1338 | reiserfs_write_lock(inode->i_sb); | ||
1339 | err = journal_begin(&th, inode->i_sb, 1); | ||
1340 | if (err) { | ||
1341 | reiserfs_write_unlock(inode->i_sb); | ||
1342 | return err; | ||
1343 | } | ||
1344 | reiserfs_update_inode_transaction(inode); | ||
1345 | mark_inode_dirty(inode); | ||
1346 | err = journal_end(&th, inode->i_sb, 1); | ||
1347 | if (err) { | ||
1348 | reiserfs_write_unlock(inode->i_sb); | ||
1349 | return err; | ||
1350 | } | ||
1351 | err = remove_save_link(inode, 1 /* truncate */ ); | ||
1352 | reiserfs_write_unlock(inode->i_sb); | ||
1353 | if (err) | ||
1354 | return err; | ||
1355 | } | ||
1356 | |||
1357 | return result; | ||
1358 | } | ||
1359 | 1317 | ||
1360 | if (unlikely((ssize_t) count < 0)) | 1318 | if (unlikely((ssize_t) count < 0)) |
1361 | return -EINVAL; | 1319 | return -EINVAL; |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 9c69bcacad22..254239e6f9e3 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -216,11 +216,12 @@ static int file_capable(struct inode *inode, long block) | |||
216 | BUG_ON(!th->t_trans_id); | 216 | BUG_ON(!th->t_trans_id); |
217 | BUG_ON(!th->t_refcount); | 217 | BUG_ON(!th->t_refcount); |
218 | 218 | ||
219 | pathrelse(path); | ||
220 | |||
219 | /* we cannot restart while nested */ | 221 | /* we cannot restart while nested */ |
220 | if (th->t_refcount > 1) { | 222 | if (th->t_refcount > 1) { |
221 | return 0; | 223 | return 0; |
222 | } | 224 | } |
223 | pathrelse(path); | ||
224 | reiserfs_update_sd(th, inode); | 225 | reiserfs_update_sd(th, inode); |
225 | err = journal_end(th, s, len); | 226 | err = journal_end(th, s, len); |
226 | if (!err) { | 227 | if (!err) { |
@@ -928,15 +929,12 @@ int reiserfs_get_block(struct inode *inode, sector_t block, | |||
928 | if (blocks_needed == 1) { | 929 | if (blocks_needed == 1) { |
929 | un = &unf_single; | 930 | un = &unf_single; |
930 | } else { | 931 | } else { |
931 | un = kmalloc(min(blocks_needed, max_to_insert) * UNFM_P_SIZE, GFP_ATOMIC); // We need to avoid scheduling. | 932 | un = kzalloc(min(blocks_needed, max_to_insert) * UNFM_P_SIZE, GFP_ATOMIC); // We need to avoid scheduling. |
932 | if (!un) { | 933 | if (!un) { |
933 | un = &unf_single; | 934 | un = &unf_single; |
934 | blocks_needed = 1; | 935 | blocks_needed = 1; |
935 | max_to_insert = 0; | 936 | max_to_insert = 0; |
936 | } else | 937 | } |
937 | memset(un, 0, | ||
938 | UNFM_P_SIZE * min(blocks_needed, | ||
939 | max_to_insert)); | ||
940 | } | 938 | } |
941 | if (blocks_needed <= max_to_insert) { | 939 | if (blocks_needed <= max_to_insert) { |
942 | /* we are going to add target block to the file. Use allocated | 940 | /* we are going to add target block to the file. Use allocated |
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 85ce23268302..7280a23ef344 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
@@ -104,7 +104,7 @@ static int release_journal_dev(struct super_block *super, | |||
104 | struct reiserfs_journal *journal); | 104 | struct reiserfs_journal *journal); |
105 | static int dirty_one_transaction(struct super_block *s, | 105 | static int dirty_one_transaction(struct super_block *s, |
106 | struct reiserfs_journal_list *jl); | 106 | struct reiserfs_journal_list *jl); |
107 | static void flush_async_commits(void *p); | 107 | static void flush_async_commits(struct work_struct *work); |
108 | static void queue_log_writer(struct super_block *s); | 108 | static void queue_log_writer(struct super_block *s); |
109 | 109 | ||
110 | /* values for join in do_journal_begin_r */ | 110 | /* values for join in do_journal_begin_r */ |
@@ -1464,7 +1464,7 @@ static int flush_journal_list(struct super_block *s, | |||
1464 | } | 1464 | } |
1465 | 1465 | ||
1466 | /* if someone has this block in a newer transaction, just make | 1466 | /* if someone has this block in a newer transaction, just make |
1467 | ** sure they are commited, and don't try writing it to disk | 1467 | ** sure they are committed, and don't try writing it to disk |
1468 | */ | 1468 | */ |
1469 | if (pjl) { | 1469 | if (pjl) { |
1470 | if (atomic_read(&pjl->j_commit_left)) | 1470 | if (atomic_read(&pjl->j_commit_left)) |
@@ -2836,7 +2836,8 @@ int journal_init(struct super_block *p_s_sb, const char *j_dev_name, | |||
2836 | if (reiserfs_mounted_fs_count <= 1) | 2836 | if (reiserfs_mounted_fs_count <= 1) |
2837 | commit_wq = create_workqueue("reiserfs"); | 2837 | commit_wq = create_workqueue("reiserfs"); |
2838 | 2838 | ||
2839 | INIT_WORK(&journal->j_work, flush_async_commits, p_s_sb); | 2839 | INIT_DELAYED_WORK(&journal->j_work, flush_async_commits); |
2840 | journal->j_work_sb = p_s_sb; | ||
2840 | return 0; | 2841 | return 0; |
2841 | free_and_return: | 2842 | free_and_return: |
2842 | free_journal_ram(p_s_sb); | 2843 | free_journal_ram(p_s_sb); |
@@ -3384,7 +3385,7 @@ static int remove_from_transaction(struct super_block *p_s_sb, | |||
3384 | 3385 | ||
3385 | /* | 3386 | /* |
3386 | ** for any cnode in a journal list, it can only be dirtied of all the | 3387 | ** for any cnode in a journal list, it can only be dirtied of all the |
3387 | ** transactions that include it are commited to disk. | 3388 | ** transactions that include it are committed to disk. |
3388 | ** this checks through each transaction, and returns 1 if you are allowed to dirty, | 3389 | ** this checks through each transaction, and returns 1 if you are allowed to dirty, |
3389 | ** and 0 if you aren't | 3390 | ** and 0 if you aren't |
3390 | ** | 3391 | ** |
@@ -3426,7 +3427,7 @@ static int can_dirty(struct reiserfs_journal_cnode *cn) | |||
3426 | } | 3427 | } |
3427 | 3428 | ||
3428 | /* syncs the commit blocks, but does not force the real buffers to disk | 3429 | /* syncs the commit blocks, but does not force the real buffers to disk |
3429 | ** will wait until the current transaction is done/commited before returning | 3430 | ** will wait until the current transaction is done/committed before returning |
3430 | */ | 3431 | */ |
3431 | int journal_end_sync(struct reiserfs_transaction_handle *th, | 3432 | int journal_end_sync(struct reiserfs_transaction_handle *th, |
3432 | struct super_block *p_s_sb, unsigned long nblocks) | 3433 | struct super_block *p_s_sb, unsigned long nblocks) |
@@ -3447,10 +3448,11 @@ int journal_end_sync(struct reiserfs_transaction_handle *th, | |||
3447 | /* | 3448 | /* |
3448 | ** writeback the pending async commits to disk | 3449 | ** writeback the pending async commits to disk |
3449 | */ | 3450 | */ |
3450 | static void flush_async_commits(void *p) | 3451 | static void flush_async_commits(struct work_struct *work) |
3451 | { | 3452 | { |
3452 | struct super_block *p_s_sb = p; | 3453 | struct reiserfs_journal *journal = |
3453 | struct reiserfs_journal *journal = SB_JOURNAL(p_s_sb); | 3454 | container_of(work, struct reiserfs_journal, j_work.work); |
3455 | struct super_block *p_s_sb = journal->j_work_sb; | ||
3454 | struct reiserfs_journal_list *jl; | 3456 | struct reiserfs_journal_list *jl; |
3455 | struct list_head *entry; | 3457 | struct list_head *entry; |
3456 | 3458 | ||
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 17249994110f..7fb5fb036f90 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -490,13 +490,13 @@ static void reiserfs_put_super(struct super_block *s) | |||
490 | return; | 490 | return; |
491 | } | 491 | } |
492 | 492 | ||
493 | static kmem_cache_t *reiserfs_inode_cachep; | 493 | static struct kmem_cache *reiserfs_inode_cachep; |
494 | 494 | ||
495 | static struct inode *reiserfs_alloc_inode(struct super_block *sb) | 495 | static struct inode *reiserfs_alloc_inode(struct super_block *sb) |
496 | { | 496 | { |
497 | struct reiserfs_inode_info *ei; | 497 | struct reiserfs_inode_info *ei; |
498 | ei = (struct reiserfs_inode_info *) | 498 | ei = (struct reiserfs_inode_info *) |
499 | kmem_cache_alloc(reiserfs_inode_cachep, SLAB_KERNEL); | 499 | kmem_cache_alloc(reiserfs_inode_cachep, GFP_KERNEL); |
500 | if (!ei) | 500 | if (!ei) |
501 | return NULL; | 501 | return NULL; |
502 | return &ei->vfs_inode; | 502 | return &ei->vfs_inode; |
@@ -507,7 +507,7 @@ static void reiserfs_destroy_inode(struct inode *inode) | |||
507 | kmem_cache_free(reiserfs_inode_cachep, REISERFS_I(inode)); | 507 | kmem_cache_free(reiserfs_inode_cachep, REISERFS_I(inode)); |
508 | } | 508 | } |
509 | 509 | ||
510 | static void init_once(void *foo, kmem_cache_t * cachep, unsigned long flags) | 510 | static void init_once(void *foo, struct kmem_cache * cachep, unsigned long flags) |
511 | { | 511 | { |
512 | struct reiserfs_inode_info *ei = (struct reiserfs_inode_info *)foo; | 512 | struct reiserfs_inode_info *ei = (struct reiserfs_inode_info *)foo; |
513 | 513 | ||
@@ -1549,13 +1549,12 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) | |||
1549 | struct reiserfs_sb_info *sbi; | 1549 | struct reiserfs_sb_info *sbi; |
1550 | int errval = -EINVAL; | 1550 | int errval = -EINVAL; |
1551 | 1551 | ||
1552 | sbi = kmalloc(sizeof(struct reiserfs_sb_info), GFP_KERNEL); | 1552 | sbi = kzalloc(sizeof(struct reiserfs_sb_info), GFP_KERNEL); |
1553 | if (!sbi) { | 1553 | if (!sbi) { |
1554 | errval = -ENOMEM; | 1554 | errval = -ENOMEM; |
1555 | goto error; | 1555 | goto error; |
1556 | } | 1556 | } |
1557 | s->s_fs_info = sbi; | 1557 | s->s_fs_info = sbi; |
1558 | memset(sbi, 0, sizeof(struct reiserfs_sb_info)); | ||
1559 | /* Set default values for options: non-aggressive tails, RO on errors */ | 1558 | /* Set default values for options: non-aggressive tails, RO on errors */ |
1560 | REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_SMALLTAIL); | 1559 | REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_SMALLTAIL); |
1561 | REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_ERROR_RO); | 1560 | REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_ERROR_RO); |
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index 7bdb0ed443e1..1e4d68590178 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c | |||
@@ -41,7 +41,7 @@ | |||
41 | #include <linux/reiserfs_xattr.h> | 41 | #include <linux/reiserfs_xattr.h> |
42 | #include <linux/reiserfs_acl.h> | 42 | #include <linux/reiserfs_acl.h> |
43 | #include <asm/uaccess.h> | 43 | #include <asm/uaccess.h> |
44 | #include <asm/checksum.h> | 44 | #include <net/checksum.h> |
45 | #include <linux/smp_lock.h> | 45 | #include <linux/smp_lock.h> |
46 | #include <linux/stat.h> | 46 | #include <linux/stat.h> |
47 | #include <asm/semaphore.h> | 47 | #include <asm/semaphore.h> |