diff options
Diffstat (limited to 'fs/jfs')
-rw-r--r-- | fs/jfs/jfs_dtree.c | 63 | ||||
-rw-r--r-- | fs/jfs/jfs_dtree.h | 2 | ||||
-rw-r--r-- | fs/jfs/jfs_logmgr.c | 8 | ||||
-rw-r--r-- | fs/jfs/jfs_metapage.c | 5 | ||||
-rw-r--r-- | fs/jfs/namei.c | 9 | ||||
-rw-r--r-- | fs/jfs/super.c | 38 |
6 files changed, 73 insertions, 52 deletions
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c index 0ddbeceafc62..9f4ed13d9f15 100644 --- a/fs/jfs/jfs_dtree.c +++ b/fs/jfs/jfs_dtree.c | |||
@@ -3002,9 +3002,9 @@ static inline struct jfs_dirent *next_jfs_dirent(struct jfs_dirent *dirent) | |||
3002 | * return: offset = (pn, index) of start entry | 3002 | * return: offset = (pn, index) of start entry |
3003 | * of next jfs_readdir()/dtRead() | 3003 | * of next jfs_readdir()/dtRead() |
3004 | */ | 3004 | */ |
3005 | int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | 3005 | int jfs_readdir(struct file *file, struct dir_context *ctx) |
3006 | { | 3006 | { |
3007 | struct inode *ip = file_inode(filp); | 3007 | struct inode *ip = file_inode(file); |
3008 | struct nls_table *codepage = JFS_SBI(ip->i_sb)->nls_tab; | 3008 | struct nls_table *codepage = JFS_SBI(ip->i_sb)->nls_tab; |
3009 | int rc = 0; | 3009 | int rc = 0; |
3010 | loff_t dtpos; /* legacy OS/2 style position */ | 3010 | loff_t dtpos; /* legacy OS/2 style position */ |
@@ -3033,7 +3033,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
3033 | int overflow, fix_page, page_fixed = 0; | 3033 | int overflow, fix_page, page_fixed = 0; |
3034 | static int unique_pos = 2; /* If we can't fix broken index */ | 3034 | static int unique_pos = 2; /* If we can't fix broken index */ |
3035 | 3035 | ||
3036 | if (filp->f_pos == DIREND) | 3036 | if (ctx->pos == DIREND) |
3037 | return 0; | 3037 | return 0; |
3038 | 3038 | ||
3039 | if (DO_INDEX(ip)) { | 3039 | if (DO_INDEX(ip)) { |
@@ -3045,7 +3045,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
3045 | */ | 3045 | */ |
3046 | do_index = 1; | 3046 | do_index = 1; |
3047 | 3047 | ||
3048 | dir_index = (u32) filp->f_pos; | 3048 | dir_index = (u32) ctx->pos; |
3049 | 3049 | ||
3050 | if (dir_index > 1) { | 3050 | if (dir_index > 1) { |
3051 | struct dir_table_slot dirtab_slot; | 3051 | struct dir_table_slot dirtab_slot; |
@@ -3053,25 +3053,25 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
3053 | if (dtEmpty(ip) || | 3053 | if (dtEmpty(ip) || |
3054 | (dir_index >= JFS_IP(ip)->next_index)) { | 3054 | (dir_index >= JFS_IP(ip)->next_index)) { |
3055 | /* Stale position. Directory has shrunk */ | 3055 | /* Stale position. Directory has shrunk */ |
3056 | filp->f_pos = DIREND; | 3056 | ctx->pos = DIREND; |
3057 | return 0; | 3057 | return 0; |
3058 | } | 3058 | } |
3059 | repeat: | 3059 | repeat: |
3060 | rc = read_index(ip, dir_index, &dirtab_slot); | 3060 | rc = read_index(ip, dir_index, &dirtab_slot); |
3061 | if (rc) { | 3061 | if (rc) { |
3062 | filp->f_pos = DIREND; | 3062 | ctx->pos = DIREND; |
3063 | return rc; | 3063 | return rc; |
3064 | } | 3064 | } |
3065 | if (dirtab_slot.flag == DIR_INDEX_FREE) { | 3065 | if (dirtab_slot.flag == DIR_INDEX_FREE) { |
3066 | if (loop_count++ > JFS_IP(ip)->next_index) { | 3066 | if (loop_count++ > JFS_IP(ip)->next_index) { |
3067 | jfs_err("jfs_readdir detected " | 3067 | jfs_err("jfs_readdir detected " |
3068 | "infinite loop!"); | 3068 | "infinite loop!"); |
3069 | filp->f_pos = DIREND; | 3069 | ctx->pos = DIREND; |
3070 | return 0; | 3070 | return 0; |
3071 | } | 3071 | } |
3072 | dir_index = le32_to_cpu(dirtab_slot.addr2); | 3072 | dir_index = le32_to_cpu(dirtab_slot.addr2); |
3073 | if (dir_index == -1) { | 3073 | if (dir_index == -1) { |
3074 | filp->f_pos = DIREND; | 3074 | ctx->pos = DIREND; |
3075 | return 0; | 3075 | return 0; |
3076 | } | 3076 | } |
3077 | goto repeat; | 3077 | goto repeat; |
@@ -3080,13 +3080,13 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
3080 | index = dirtab_slot.slot; | 3080 | index = dirtab_slot.slot; |
3081 | DT_GETPAGE(ip, bn, mp, PSIZE, p, rc); | 3081 | DT_GETPAGE(ip, bn, mp, PSIZE, p, rc); |
3082 | if (rc) { | 3082 | if (rc) { |
3083 | filp->f_pos = DIREND; | 3083 | ctx->pos = DIREND; |
3084 | return 0; | 3084 | return 0; |
3085 | } | 3085 | } |
3086 | if (p->header.flag & BT_INTERNAL) { | 3086 | if (p->header.flag & BT_INTERNAL) { |
3087 | jfs_err("jfs_readdir: bad index table"); | 3087 | jfs_err("jfs_readdir: bad index table"); |
3088 | DT_PUTPAGE(mp); | 3088 | DT_PUTPAGE(mp); |
3089 | filp->f_pos = -1; | 3089 | ctx->pos = -1; |
3090 | return 0; | 3090 | return 0; |
3091 | } | 3091 | } |
3092 | } else { | 3092 | } else { |
@@ -3094,23 +3094,22 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
3094 | /* | 3094 | /* |
3095 | * self "." | 3095 | * self "." |
3096 | */ | 3096 | */ |
3097 | filp->f_pos = 0; | 3097 | ctx->pos = 0; |
3098 | if (filldir(dirent, ".", 1, 0, ip->i_ino, | 3098 | if (!dir_emit(ctx, ".", 1, ip->i_ino, DT_DIR)) |
3099 | DT_DIR)) | ||
3100 | return 0; | 3099 | return 0; |
3101 | } | 3100 | } |
3102 | /* | 3101 | /* |
3103 | * parent ".." | 3102 | * parent ".." |
3104 | */ | 3103 | */ |
3105 | filp->f_pos = 1; | 3104 | ctx->pos = 1; |
3106 | if (filldir(dirent, "..", 2, 1, PARENT(ip), DT_DIR)) | 3105 | if (!dir_emit(ctx, "..", 2, PARENT(ip), DT_DIR)) |
3107 | return 0; | 3106 | return 0; |
3108 | 3107 | ||
3109 | /* | 3108 | /* |
3110 | * Find first entry of left-most leaf | 3109 | * Find first entry of left-most leaf |
3111 | */ | 3110 | */ |
3112 | if (dtEmpty(ip)) { | 3111 | if (dtEmpty(ip)) { |
3113 | filp->f_pos = DIREND; | 3112 | ctx->pos = DIREND; |
3114 | return 0; | 3113 | return 0; |
3115 | } | 3114 | } |
3116 | 3115 | ||
@@ -3128,23 +3127,19 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
3128 | * pn > 0: Real entries, pn=1 -> leftmost page | 3127 | * pn > 0: Real entries, pn=1 -> leftmost page |
3129 | * pn = index = -1: No more entries | 3128 | * pn = index = -1: No more entries |
3130 | */ | 3129 | */ |
3131 | dtpos = filp->f_pos; | 3130 | dtpos = ctx->pos; |
3132 | if (dtpos == 0) { | 3131 | if (dtpos == 0) { |
3133 | /* build "." entry */ | 3132 | /* build "." entry */ |
3134 | 3133 | if (!dir_emit(ctx, ".", 1, ip->i_ino, DT_DIR)) | |
3135 | if (filldir(dirent, ".", 1, filp->f_pos, ip->i_ino, | ||
3136 | DT_DIR)) | ||
3137 | return 0; | 3134 | return 0; |
3138 | dtoffset->index = 1; | 3135 | dtoffset->index = 1; |
3139 | filp->f_pos = dtpos; | 3136 | ctx->pos = dtpos; |
3140 | } | 3137 | } |
3141 | 3138 | ||
3142 | if (dtoffset->pn == 0) { | 3139 | if (dtoffset->pn == 0) { |
3143 | if (dtoffset->index == 1) { | 3140 | if (dtoffset->index == 1) { |
3144 | /* build ".." entry */ | 3141 | /* build ".." entry */ |
3145 | 3142 | if (!dir_emit(ctx, "..", 2, PARENT(ip), DT_DIR)) | |
3146 | if (filldir(dirent, "..", 2, filp->f_pos, | ||
3147 | PARENT(ip), DT_DIR)) | ||
3148 | return 0; | 3143 | return 0; |
3149 | } else { | 3144 | } else { |
3150 | jfs_err("jfs_readdir called with " | 3145 | jfs_err("jfs_readdir called with " |
@@ -3152,18 +3147,18 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
3152 | } | 3147 | } |
3153 | dtoffset->pn = 1; | 3148 | dtoffset->pn = 1; |
3154 | dtoffset->index = 0; | 3149 | dtoffset->index = 0; |
3155 | filp->f_pos = dtpos; | 3150 | ctx->pos = dtpos; |
3156 | } | 3151 | } |
3157 | 3152 | ||
3158 | if (dtEmpty(ip)) { | 3153 | if (dtEmpty(ip)) { |
3159 | filp->f_pos = DIREND; | 3154 | ctx->pos = DIREND; |
3160 | return 0; | 3155 | return 0; |
3161 | } | 3156 | } |
3162 | 3157 | ||
3163 | if ((rc = dtReadNext(ip, &filp->f_pos, &btstack))) { | 3158 | if ((rc = dtReadNext(ip, &ctx->pos, &btstack))) { |
3164 | jfs_err("jfs_readdir: unexpected rc = %d " | 3159 | jfs_err("jfs_readdir: unexpected rc = %d " |
3165 | "from dtReadNext", rc); | 3160 | "from dtReadNext", rc); |
3166 | filp->f_pos = DIREND; | 3161 | ctx->pos = DIREND; |
3167 | return 0; | 3162 | return 0; |
3168 | } | 3163 | } |
3169 | /* get start leaf page and index */ | 3164 | /* get start leaf page and index */ |
@@ -3171,7 +3166,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
3171 | 3166 | ||
3172 | /* offset beyond directory eof ? */ | 3167 | /* offset beyond directory eof ? */ |
3173 | if (bn < 0) { | 3168 | if (bn < 0) { |
3174 | filp->f_pos = DIREND; | 3169 | ctx->pos = DIREND; |
3175 | return 0; | 3170 | return 0; |
3176 | } | 3171 | } |
3177 | } | 3172 | } |
@@ -3180,7 +3175,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
3180 | if (dirent_buf == 0) { | 3175 | if (dirent_buf == 0) { |
3181 | DT_PUTPAGE(mp); | 3176 | DT_PUTPAGE(mp); |
3182 | jfs_warn("jfs_readdir: __get_free_page failed!"); | 3177 | jfs_warn("jfs_readdir: __get_free_page failed!"); |
3183 | filp->f_pos = DIREND; | 3178 | ctx->pos = DIREND; |
3184 | return -ENOMEM; | 3179 | return -ENOMEM; |
3185 | } | 3180 | } |
3186 | 3181 | ||
@@ -3295,9 +3290,9 @@ skip_one: | |||
3295 | 3290 | ||
3296 | jfs_dirent = (struct jfs_dirent *) dirent_buf; | 3291 | jfs_dirent = (struct jfs_dirent *) dirent_buf; |
3297 | while (jfs_dirents--) { | 3292 | while (jfs_dirents--) { |
3298 | filp->f_pos = jfs_dirent->position; | 3293 | ctx->pos = jfs_dirent->position; |
3299 | if (filldir(dirent, jfs_dirent->name, | 3294 | if (!dir_emit(ctx, jfs_dirent->name, |
3300 | jfs_dirent->name_len, filp->f_pos, | 3295 | jfs_dirent->name_len, |
3301 | jfs_dirent->ino, DT_UNKNOWN)) | 3296 | jfs_dirent->ino, DT_UNKNOWN)) |
3302 | goto out; | 3297 | goto out; |
3303 | jfs_dirent = next_jfs_dirent(jfs_dirent); | 3298 | jfs_dirent = next_jfs_dirent(jfs_dirent); |
@@ -3309,7 +3304,7 @@ skip_one: | |||
3309 | } | 3304 | } |
3310 | 3305 | ||
3311 | if (!overflow && (bn == 0)) { | 3306 | if (!overflow && (bn == 0)) { |
3312 | filp->f_pos = DIREND; | 3307 | ctx->pos = DIREND; |
3313 | break; | 3308 | break; |
3314 | } | 3309 | } |
3315 | 3310 | ||
diff --git a/fs/jfs/jfs_dtree.h b/fs/jfs/jfs_dtree.h index 2545bb317235..fd4169e6e698 100644 --- a/fs/jfs/jfs_dtree.h +++ b/fs/jfs/jfs_dtree.h | |||
@@ -265,5 +265,5 @@ extern int dtDelete(tid_t tid, struct inode *ip, struct component_name * key, | |||
265 | extern int dtModify(tid_t tid, struct inode *ip, struct component_name * key, | 265 | extern int dtModify(tid_t tid, struct inode *ip, struct component_name * key, |
266 | ino_t * orig_ino, ino_t new_ino, int flag); | 266 | ino_t * orig_ino, ino_t new_ino, int flag); |
267 | 267 | ||
268 | extern int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir); | 268 | extern int jfs_readdir(struct file *file, struct dir_context *ctx); |
269 | #endif /* !_H_JFS_DTREE */ | 269 | #endif /* !_H_JFS_DTREE */ |
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c index c57499dca89c..360d27c48887 100644 --- a/fs/jfs/jfs_logmgr.c +++ b/fs/jfs/jfs_logmgr.c | |||
@@ -2009,7 +2009,13 @@ static int lbmRead(struct jfs_log * log, int pn, struct lbuf ** bpp) | |||
2009 | 2009 | ||
2010 | bio->bi_end_io = lbmIODone; | 2010 | bio->bi_end_io = lbmIODone; |
2011 | bio->bi_private = bp; | 2011 | bio->bi_private = bp; |
2012 | submit_bio(READ_SYNC, bio); | 2012 | /*check if journaling to disk has been disabled*/ |
2013 | if (log->no_integrity) { | ||
2014 | bio->bi_size = 0; | ||
2015 | lbmIODone(bio, 0); | ||
2016 | } else { | ||
2017 | submit_bio(READ_SYNC, bio); | ||
2018 | } | ||
2013 | 2019 | ||
2014 | wait_event(bp->l_ioevent, (bp->l_flag != lbmREAD)); | 2020 | wait_event(bp->l_ioevent, (bp->l_flag != lbmREAD)); |
2015 | 2021 | ||
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c index 6740d34cd82b..9e3aaff11f89 100644 --- a/fs/jfs/jfs_metapage.c +++ b/fs/jfs/jfs_metapage.c | |||
@@ -571,9 +571,10 @@ static int metapage_releasepage(struct page *page, gfp_t gfp_mask) | |||
571 | return ret; | 571 | return ret; |
572 | } | 572 | } |
573 | 573 | ||
574 | static void metapage_invalidatepage(struct page *page, unsigned long offset) | 574 | static void metapage_invalidatepage(struct page *page, unsigned int offset, |
575 | unsigned int length) | ||
575 | { | 576 | { |
576 | BUG_ON(offset); | 577 | BUG_ON(offset || length < PAGE_CACHE_SIZE); |
577 | 578 | ||
578 | BUG_ON(PageWriteback(page)); | 579 | BUG_ON(PageWriteback(page)); |
579 | 580 | ||
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c index 3b91a7ad6086..8b19027291d6 100644 --- a/fs/jfs/namei.c +++ b/fs/jfs/namei.c | |||
@@ -1529,7 +1529,7 @@ const struct inode_operations jfs_dir_inode_operations = { | |||
1529 | 1529 | ||
1530 | const struct file_operations jfs_dir_operations = { | 1530 | const struct file_operations jfs_dir_operations = { |
1531 | .read = generic_read_dir, | 1531 | .read = generic_read_dir, |
1532 | .readdir = jfs_readdir, | 1532 | .iterate = jfs_readdir, |
1533 | .fsync = jfs_fsync, | 1533 | .fsync = jfs_fsync, |
1534 | .unlocked_ioctl = jfs_ioctl, | 1534 | .unlocked_ioctl = jfs_ioctl, |
1535 | #ifdef CONFIG_COMPAT | 1535 | #ifdef CONFIG_COMPAT |
@@ -1538,8 +1538,7 @@ const struct file_operations jfs_dir_operations = { | |||
1538 | .llseek = generic_file_llseek, | 1538 | .llseek = generic_file_llseek, |
1539 | }; | 1539 | }; |
1540 | 1540 | ||
1541 | static int jfs_ci_hash(const struct dentry *dir, const struct inode *inode, | 1541 | static int jfs_ci_hash(const struct dentry *dir, struct qstr *this) |
1542 | struct qstr *this) | ||
1543 | { | 1542 | { |
1544 | unsigned long hash; | 1543 | unsigned long hash; |
1545 | int i; | 1544 | int i; |
@@ -1552,9 +1551,7 @@ static int jfs_ci_hash(const struct dentry *dir, const struct inode *inode, | |||
1552 | return 0; | 1551 | return 0; |
1553 | } | 1552 | } |
1554 | 1553 | ||
1555 | static int jfs_ci_compare(const struct dentry *parent, | 1554 | static int jfs_ci_compare(const struct dentry *parent, const struct dentry *dentry, |
1556 | const struct inode *pinode, | ||
1557 | const struct dentry *dentry, const struct inode *inode, | ||
1558 | unsigned int len, const char *str, const struct qstr *name) | 1555 | unsigned int len, const char *str, const struct qstr *name) |
1559 | { | 1556 | { |
1560 | int i, result = 1; | 1557 | int i, result = 1; |
diff --git a/fs/jfs/super.c b/fs/jfs/super.c index 2003e830ed1c..788e0a9c1fb0 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c | |||
@@ -611,11 +611,28 @@ static int jfs_freeze(struct super_block *sb) | |||
611 | { | 611 | { |
612 | struct jfs_sb_info *sbi = JFS_SBI(sb); | 612 | struct jfs_sb_info *sbi = JFS_SBI(sb); |
613 | struct jfs_log *log = sbi->log; | 613 | struct jfs_log *log = sbi->log; |
614 | int rc = 0; | ||
614 | 615 | ||
615 | if (!(sb->s_flags & MS_RDONLY)) { | 616 | if (!(sb->s_flags & MS_RDONLY)) { |
616 | txQuiesce(sb); | 617 | txQuiesce(sb); |
617 | lmLogShutdown(log); | 618 | rc = lmLogShutdown(log); |
618 | updateSuper(sb, FM_CLEAN); | 619 | if (rc) { |
620 | jfs_error(sb, "jfs_freeze: lmLogShutdown failed"); | ||
621 | |||
622 | /* let operations fail rather than hang */ | ||
623 | txResume(sb); | ||
624 | |||
625 | return rc; | ||
626 | } | ||
627 | rc = updateSuper(sb, FM_CLEAN); | ||
628 | if (rc) { | ||
629 | jfs_err("jfs_freeze: updateSuper failed\n"); | ||
630 | /* | ||
631 | * Don't fail here. Everything succeeded except | ||
632 | * marking the superblock clean, so there's really | ||
633 | * no harm in leaving it frozen for now. | ||
634 | */ | ||
635 | } | ||
619 | } | 636 | } |
620 | return 0; | 637 | return 0; |
621 | } | 638 | } |
@@ -627,13 +644,18 @@ static int jfs_unfreeze(struct super_block *sb) | |||
627 | int rc = 0; | 644 | int rc = 0; |
628 | 645 | ||
629 | if (!(sb->s_flags & MS_RDONLY)) { | 646 | if (!(sb->s_flags & MS_RDONLY)) { |
630 | updateSuper(sb, FM_MOUNT); | 647 | rc = updateSuper(sb, FM_MOUNT); |
631 | if ((rc = lmLogInit(log))) | 648 | if (rc) { |
632 | jfs_err("jfs_unlock failed with return code %d", rc); | 649 | jfs_error(sb, "jfs_unfreeze: updateSuper failed"); |
633 | else | 650 | goto out; |
634 | txResume(sb); | 651 | } |
652 | rc = lmLogInit(log); | ||
653 | if (rc) | ||
654 | jfs_error(sb, "jfs_unfreeze: lmLogInit failed"); | ||
655 | out: | ||
656 | txResume(sb); | ||
635 | } | 657 | } |
636 | return 0; | 658 | return rc; |
637 | } | 659 | } |
638 | 660 | ||
639 | static struct dentry *jfs_do_mount(struct file_system_type *fs_type, | 661 | static struct dentry *jfs_do_mount(struct file_system_type *fs_type, |