diff options
Diffstat (limited to 'fs/jfs/jfs_dtree.c')
-rw-r--r-- | fs/jfs/jfs_dtree.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c index df25ecc418af..4dcc05819998 100644 --- a/fs/jfs/jfs_dtree.c +++ b/fs/jfs/jfs_dtree.c | |||
@@ -284,11 +284,11 @@ static struct dir_table_slot *find_index(struct inode *ip, u32 index, | |||
284 | release_metapage(*mp); | 284 | release_metapage(*mp); |
285 | *mp = NULL; | 285 | *mp = NULL; |
286 | } | 286 | } |
287 | if (*mp == 0) { | 287 | if (!(*mp)) { |
288 | *lblock = blkno; | 288 | *lblock = blkno; |
289 | *mp = read_index_page(ip, blkno); | 289 | *mp = read_index_page(ip, blkno); |
290 | } | 290 | } |
291 | if (*mp == 0) { | 291 | if (!(*mp)) { |
292 | jfs_err("free_index: error reading directory table"); | 292 | jfs_err("free_index: error reading directory table"); |
293 | return NULL; | 293 | return NULL; |
294 | } | 294 | } |
@@ -413,7 +413,8 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot) | |||
413 | } | 413 | } |
414 | ip->i_size = PSIZE; | 414 | ip->i_size = PSIZE; |
415 | 415 | ||
416 | if ((mp = get_index_page(ip, 0)) == 0) { | 416 | mp = get_index_page(ip, 0); |
417 | if (!mp) { | ||
417 | jfs_err("add_index: get_metapage failed!"); | 418 | jfs_err("add_index: get_metapage failed!"); |
418 | xtTruncate(tid, ip, 0, COMMIT_PWMAP); | 419 | xtTruncate(tid, ip, 0, COMMIT_PWMAP); |
419 | memcpy(&jfs_ip->i_dirtable, temp_table, | 420 | memcpy(&jfs_ip->i_dirtable, temp_table, |
@@ -461,7 +462,7 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot) | |||
461 | } else | 462 | } else |
462 | mp = read_index_page(ip, blkno); | 463 | mp = read_index_page(ip, blkno); |
463 | 464 | ||
464 | if (mp == 0) { | 465 | if (!mp) { |
465 | jfs_err("add_index: get/read_metapage failed!"); | 466 | jfs_err("add_index: get/read_metapage failed!"); |
466 | goto clean_up; | 467 | goto clean_up; |
467 | } | 468 | } |
@@ -499,7 +500,7 @@ static void free_index(tid_t tid, struct inode *ip, u32 index, u32 next) | |||
499 | 500 | ||
500 | dirtab_slot = find_index(ip, index, &mp, &lblock); | 501 | dirtab_slot = find_index(ip, index, &mp, &lblock); |
501 | 502 | ||
502 | if (dirtab_slot == 0) | 503 | if (!dirtab_slot) |
503 | return; | 504 | return; |
504 | 505 | ||
505 | dirtab_slot->flag = DIR_INDEX_FREE; | 506 | dirtab_slot->flag = DIR_INDEX_FREE; |
@@ -526,7 +527,7 @@ static void modify_index(tid_t tid, struct inode *ip, u32 index, s64 bn, | |||
526 | 527 | ||
527 | dirtab_slot = find_index(ip, index, mp, lblock); | 528 | dirtab_slot = find_index(ip, index, mp, lblock); |
528 | 529 | ||
529 | if (dirtab_slot == 0) | 530 | if (!dirtab_slot) |
530 | return; | 531 | return; |
531 | 532 | ||
532 | DTSaddress(dirtab_slot, bn); | 533 | DTSaddress(dirtab_slot, bn); |
@@ -552,7 +553,7 @@ static int read_index(struct inode *ip, u32 index, | |||
552 | struct dir_table_slot *slot; | 553 | struct dir_table_slot *slot; |
553 | 554 | ||
554 | slot = find_index(ip, index, &mp, &lblock); | 555 | slot = find_index(ip, index, &mp, &lblock); |
555 | if (slot == 0) { | 556 | if (!slot) { |
556 | return -EIO; | 557 | return -EIO; |
557 | } | 558 | } |
558 | 559 | ||
@@ -592,10 +593,8 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data, | |||
592 | struct component_name ciKey; | 593 | struct component_name ciKey; |
593 | struct super_block *sb = ip->i_sb; | 594 | struct super_block *sb = ip->i_sb; |
594 | 595 | ||
595 | ciKey.name = | 596 | ciKey.name = kmalloc((JFS_NAME_MAX + 1) * sizeof(wchar_t), GFP_NOFS); |
596 | (wchar_t *) kmalloc((JFS_NAME_MAX + 1) * sizeof(wchar_t), | 597 | if (!ciKey.name) { |
597 | GFP_NOFS); | ||
598 | if (ciKey.name == 0) { | ||
599 | rc = -ENOMEM; | 598 | rc = -ENOMEM; |
600 | goto dtSearch_Exit2; | 599 | goto dtSearch_Exit2; |
601 | } | 600 | } |
@@ -957,10 +956,8 @@ static int dtSplitUp(tid_t tid, | |||
957 | smp = split->mp; | 956 | smp = split->mp; |
958 | sp = DT_PAGE(ip, smp); | 957 | sp = DT_PAGE(ip, smp); |
959 | 958 | ||
960 | key.name = | 959 | key.name = kmalloc((JFS_NAME_MAX + 2) * sizeof(wchar_t), GFP_NOFS); |
961 | (wchar_t *) kmalloc((JFS_NAME_MAX + 2) * sizeof(wchar_t), | 960 | if (!key.name) { |
962 | GFP_NOFS); | ||
963 | if (key.name == 0) { | ||
964 | DT_PUTPAGE(smp); | 961 | DT_PUTPAGE(smp); |
965 | rc = -ENOMEM; | 962 | rc = -ENOMEM; |
966 | goto dtSplitUp_Exit; | 963 | goto dtSplitUp_Exit; |