Commit 43b01fda8b17b2b63e7dcdeed11c2ebba56b1fc9

Authored by Anton Altaparmakov
1 parent 2bfb4fff3e

NTFS: Fix sign of various error return values to be negative in

fs/ntfs/lcnalloc.c.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>

Showing 2 changed files with 11 additions and 9 deletions Side-by-side Diff

... ... @@ -98,6 +98,8 @@
98 98 - Rename fs/ntfs/attrib.c::ntfs_find_vcn_nolock() to
99 99 ntfs_attr_find_vcn_nolock() and update all callers.
100 100 - Add fs/ntfs/attrib.[hc]::ntfs_attr_make_non_resident().
  101 + - Fix sign of various error return values to be negative in
  102 + fs/ntfs/lcnalloc.c.
101 103  
102 104 2.1.22 - Many bug and race fixes and error handling improvements.
103 105  
1 1 /*
2 2 * lcnalloc.c - Cluster (de)allocation code. Part of the Linux-NTFS project.
3 3 *
4   - * Copyright (c) 2004 Anton Altaparmakov
  4 + * Copyright (c) 2004-2005 Anton Altaparmakov
5 5 *
6 6 * This program/include file is free software; you can redistribute it and/or
7 7 * modify it under the terms of the GNU General Public License as published
... ... @@ -60,7 +60,7 @@
60 60 if (rl->lcn < 0)
61 61 continue;
62 62 err = ntfs_bitmap_clear_run(lcnbmp_vi, rl->lcn, rl->length);
63   - if (unlikely(err && (!ret || ret == ENOMEM) && ret != err))
  63 + if (unlikely(err && (!ret || ret == -ENOMEM) && ret != err))
64 64 ret = err;
65 65 }
66 66 ntfs_debug("Done.");
... ... @@ -693,7 +693,7 @@
693 693 if (zone == MFT_ZONE || mft_zone_size <= 0) {
694 694 ntfs_debug("No free clusters left, going to out.");
695 695 /* Really no more space left on device. */
696   - err = ENOSPC;
  696 + err = -ENOSPC;
697 697 goto out;
698 698 } /* zone == DATA_ZONE && mft_zone_size > 0 */
699 699 ntfs_debug("Shrinking mft zone.");
700 700  
... ... @@ -757,9 +757,9 @@
757 757 if (rl) {
758 758 int err2;
759 759  
760   - if (err == ENOSPC)
  760 + if (err == -ENOSPC)
761 761 ntfs_debug("Not enough space to complete allocation, "
762   - "err ENOSPC, first free lcn 0x%llx, "
  762 + "err -ENOSPC, first free lcn 0x%llx, "
763 763 "could allocate up to 0x%llx "
764 764 "clusters.",
765 765 (unsigned long long)rl[0].lcn,
... ... @@ -775,10 +775,10 @@
775 775 }
776 776 /* Free the runlist. */
777 777 ntfs_free(rl);
778   - } else if (err == ENOSPC)
779   - ntfs_debug("No space left at all, err = ENOSPC, "
780   - "first free lcn = 0x%llx.",
781   - (unsigned long long)vol->data1_zone_pos);
  778 + } else if (err == -ENOSPC)
  779 + ntfs_debug("No space left at all, err = -ENOSPC, first free "
  780 + "lcn = 0x%llx.",
  781 + (long long)vol->data1_zone_pos);
782 782 up_write(&vol->lcnbmp_lock);
783 783 return ERR_PTR(err);
784 784 }