From e4fe228cc1a753961526b5dd28c6704b3c69c4d8 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Fri, 23 Aug 2013 23:02:03 +0200 Subject: [PATCH] Uses the deleted block offset when reading the text content to enlarge the parity size. This ensures a better consistency check on the size of parity. --- TODO | 2 -- state.c | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index 23df6abd..9b2214c9 100644 --- a/TODO +++ b/TODO @@ -3,8 +3,6 @@ SnapRAID TODO This is the list of TODO items for SnapRAID. -* Check blockmax in hole ? RISKY ?? - - v4.x * If a content file is missing, sync should rewrite it, even if no change was done at the content. diff --git a/state.c b/state.c index 98fe6557..9c5c2226 100644 --- a/state.c +++ b/state.c @@ -1091,12 +1091,12 @@ static void state_read_text(struct snapraid_state* state, const char* path, STRE exit(EXIT_FAILURE); } - /* note that here we don't have a valid blockmax because we have not */ - /* yet processed all the disks with all the files */ - /* and then we cannot ensure that v_pos < blockmax */ - deleted->block.parity_pos = v_pos; + /* keep track of the max block number used in parity */ + if (v_pos + 1 > blockmax) + blockmax = v_pos + 1; + /* read the hash */ c = sgetc(f); if (c != ' ') {