Hello Wang,

>This patch makes set_bitmap() to call sync_bitmap() instead rewrite
>identical code to do same thing.

I found a simple mistake.

>@@ -3317,20 +3345,11 @@ set_bitmap(struct dump_bitmap *bitmap, unsigned long 
>long pfn,
>       old_offset = bitmap->offset + BUFSIZE_BITMAP * bitmap->no_block;
>       new_offset = bitmap->offset + BUFSIZE_BITMAP * (pfn / PFN_BUFBITMAP);
>
>-      if (0 <= bitmap->no_block && old_offset != new_offset) {
>-              if (lseek(bitmap->fd, old_offset, SEEK_SET) < 0 ) {
>-                      ERRMSG("Can't seek the bitmap(%s). %s\n",
>-                          bitmap->file_name, strerror(errno));
>-                      return FALSE;
>-              }
>-              if (write(bitmap->fd, bitmap->buf, BUFSIZE_BITMAP)
>-                  != BUFSIZE_BITMAP) {
>-                      ERRMSG("Can't write the bitmap(%s). %s\n",
>-                          bitmap->file_name, strerror(errno));
>+      if (old_offset != new_offset) {
>+              if (sync_bitmap(bitmap)) {
>+                      ERRMSG("Can't sync bitmap\n");
>                       return FALSE;
>               }

sync_bitmap() returns TRUE(1) when it succeeds, so this check is wrong.


Thanks
Atsushi Kumagai

>-      }
>-      if (old_offset != new_offset) {
>               if (lseek(bitmap->fd, new_offset, SEEK_SET) < 0 ) {
>                       ERRMSG("Can't seek the bitmap(%s). %s\n",
>                           bitmap->file_name, strerror(errno));
>@@ -3379,33 +3398,6 @@ set_bitmap_cyclic(char *bitmap, unsigned long long pfn, 
>int val, struct cycle *c
> }
>
> int
>-sync_bitmap(struct dump_bitmap *bitmap)
>-{
>-      off_t offset;
>-      offset = bitmap->offset + BUFSIZE_BITMAP * bitmap->no_block;
>-
>-      /*
>-       * The bitmap buffer is not dirty, and it is not necessary
>-       * to write out it.
>-       */
>-      if (bitmap->no_block < 0)
>-              return TRUE;
>-
>-      if (lseek(bitmap->fd, offset, SEEK_SET) < 0 ) {
>-              ERRMSG("Can't seek the bitmap(%s). %s\n",
>-                  bitmap->file_name, strerror(errno));
>-              return FALSE;
>-      }
>-      if (write(bitmap->fd, bitmap->buf, BUFSIZE_BITMAP)
>-          != BUFSIZE_BITMAP) {
>-              ERRMSG("Can't write the bitmap(%s). %s\n",
>-                  bitmap->file_name, strerror(errno));
>-              return FALSE;
>-      }
>-      return TRUE;
>-}
>-
>-int
> sync_1st_bitmap(void)
> {
>       return sync_bitmap(info->bitmap1);
>--
>1.8.5.5


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Reply via email to