recovery.c (8be98d2f2a0a262f8bf8a0bc1fdf522b3c7aab17) | recovery.c (b846f2d7e2d28ebfa112ac595bde2ef87693d8d9) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. 4 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. 5 */ 6 7#include <linux/module.h> 8#include <linux/slab.h> --- 41 unchanged lines hidden (view full) --- 50 *bh = gfs2_meta_ra(gl, dblock, extlen); 51 52 return error; 53} 54 55int gfs2_revoke_add(struct gfs2_jdesc *jd, u64 blkno, unsigned int where) 56{ 57 struct list_head *head = &jd->jd_revoke_list; | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. 4 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. 5 */ 6 7#include <linux/module.h> 8#include <linux/slab.h> --- 41 unchanged lines hidden (view full) --- 50 *bh = gfs2_meta_ra(gl, dblock, extlen); 51 52 return error; 53} 54 55int gfs2_revoke_add(struct gfs2_jdesc *jd, u64 blkno, unsigned int where) 56{ 57 struct list_head *head = &jd->jd_revoke_list; |
58 struct gfs2_revoke_replay *rr; 59 int found = 0; | 58 struct gfs2_revoke_replay *rr = NULL, *iter; |
60 | 59 |
61 list_for_each_entry(rr, head, rr_list) { 62 if (rr->rr_blkno == blkno) { 63 found = 1; | 60 list_for_each_entry(iter, head, rr_list) { 61 if (iter->rr_blkno == blkno) { 62 rr = iter; |
64 break; 65 } 66 } 67 | 63 break; 64 } 65 } 66 |
68 if (found) { | 67 if (rr) { |
69 rr->rr_where = where; 70 return 0; 71 } 72 73 rr = kmalloc(sizeof(struct gfs2_revoke_replay), GFP_NOFS); 74 if (!rr) 75 return -ENOMEM; 76 77 rr->rr_blkno = blkno; 78 rr->rr_where = where; 79 list_add(&rr->rr_list, head); 80 81 return 1; 82} 83 84int gfs2_revoke_check(struct gfs2_jdesc *jd, u64 blkno, unsigned int where) 85{ | 68 rr->rr_where = where; 69 return 0; 70 } 71 72 rr = kmalloc(sizeof(struct gfs2_revoke_replay), GFP_NOFS); 73 if (!rr) 74 return -ENOMEM; 75 76 rr->rr_blkno = blkno; 77 rr->rr_where = where; 78 list_add(&rr->rr_list, head); 79 80 return 1; 81} 82 83int gfs2_revoke_check(struct gfs2_jdesc *jd, u64 blkno, unsigned int where) 84{ |
86 struct gfs2_revoke_replay *rr; | 85 struct gfs2_revoke_replay *rr = NULL, *iter; |
87 int wrap, a, b, revoke; | 86 int wrap, a, b, revoke; |
88 int found = 0; | |
89 | 87 |
90 list_for_each_entry(rr, &jd->jd_revoke_list, rr_list) { 91 if (rr->rr_blkno == blkno) { 92 found = 1; | 88 list_for_each_entry(iter, &jd->jd_revoke_list, rr_list) { 89 if (iter->rr_blkno == blkno) { 90 rr = iter; |
93 break; 94 } 95 } 96 | 91 break; 92 } 93 } 94 |
97 if (!found) | 95 if (!rr) |
98 return 0; 99 100 wrap = (rr->rr_where < jd->jd_replay_tail); 101 a = (jd->jd_replay_tail < where); 102 b = (where < rr->rr_where); 103 revoke = (wrap) ? (a || b) : (a && b); 104 105 return revoke; --- 479 unchanged lines hidden --- | 96 return 0; 97 98 wrap = (rr->rr_where < jd->jd_replay_tail); 99 a = (jd->jd_replay_tail < where); 100 b = (where < rr->rr_where); 101 revoke = (wrap) ? (a || b) : (a && b); 102 103 return revoke; --- 479 unchanged lines hidden --- |