]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
repair: use a listhead for the dotdot list
authorDave Chinner <dchinner@redhat.com>
Mon, 3 Mar 2014 01:17:34 +0000 (12:17 +1100)
committerDave Chinner <david@fromorbit.com>
Mon, 3 Mar 2014 01:17:34 +0000 (12:17 +1100)
Cleanup suggested by Christoph Hellwig - removes another open coded
list implementation.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
repair/phase6.c

index cdbf4db25fbc1651d141b077faaafebc2304ef66..7be68b3f5f4c4a8af48dba13c2547171c7c8bd32 100644 (file)
@@ -43,13 +43,13 @@ static struct xfs_name              xfs_name_dot = {(unsigned char *)".",
  * entries are updated. These must be rebuilt after the initial pass
  */
 typedef struct dotdot_update {
-       struct dotdot_update    *next;
+       struct list_head        list;
        ino_tree_node_t         *irec;
        xfs_agnumber_t          agno;
        int                     ino_offset;
 } dotdot_update_t;
 
-static dotdot_update_t         *dotdot_update_list;
+static LIST_HEAD(dotdot_update_list);
 static int                     dotdot_update;
 
 static void
@@ -64,12 +64,12 @@ add_dotdot_update(
                do_error(_("malloc failed add_dotdot_update (%zu bytes)\n"),
                        sizeof(dotdot_update_t));
 
-       dir->next = dotdot_update_list;
+       INIT_LIST_HEAD(&dir->list);
        dir->irec = irec;
        dir->agno = agno;
        dir->ino_offset = ino_offset;
 
-       dotdot_update_list = dir;
+       list_add(&dir->list, &dotdot_update_list);
 }
 
 /*
@@ -3021,9 +3021,10 @@ update_missing_dotdot_entries(
         * set dotdot_update flag so processing routines do not count links
         */
        dotdot_update = 1;
-       while (dotdot_update_list) {
-               dir = dotdot_update_list;
-               dotdot_update_list = dir->next;
+       while (!list_empty(&dotdot_update_list)) {
+               dir = list_entry(dotdot_update_list.prev, struct dotdot_update,
+                                list);
+               list_del(&dir->list);
                process_dir_inode(mp, dir->agno, dir->irec, dir->ino_offset);
                free(dir);
        }