]> err.no Git - linux-2.6/blobdiff - fs/ntfs/lcnalloc.c
[PATCH] x86: more asm cleanups
[linux-2.6] / fs / ntfs / lcnalloc.c
index 8db4492b139cda83bb6a09d3fdb0b7fe6b898f0b..a4bc07616e5dd5afe4d6ede562b3dfff7f0d7169 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * lcnalloc.c - Cluster (de)allocation code.  Part of the Linux-NTFS project.
  *
- * Copyright (c) 2004 Anton Altaparmakov
+ * Copyright (c) 2004-2005 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
@@ -60,7 +60,7 @@ int ntfs_cluster_free_from_rl_nolock(ntfs_volume *vol,
                if (rl->lcn < 0)
                        continue;
                err = ntfs_bitmap_clear_run(lcnbmp_vi, rl->lcn, rl->length);
-               if (unlikely(err && (!ret || ret == ENOMEM) && ret != err))
+               if (unlikely(err && (!ret || ret == -ENOMEM) && ret != err))
                        ret = err;
        }
        ntfs_debug("Done.");
@@ -293,7 +293,7 @@ runlist_element *ntfs_cluster_alloc(ntfs_volume *vol, const VCN start_vcn,
                        buf_size = i_size - last_read_pos;
                buf_size <<= 3;
                lcn = bmp_pos & 7;
-               bmp_pos &= ~7;
+               bmp_pos &= ~(LCN)7;
                ntfs_debug("Before inner while loop: buf_size %i, lcn 0x%llx, "
                                "bmp_pos 0x%llx, need_writeback %i.", buf_size,
                                (unsigned long long)lcn,
@@ -311,7 +311,7 @@ runlist_element *ntfs_cluster_alloc(ntfs_volume *vol, const VCN start_vcn,
                                        (unsigned int)*byte);
                        /* Skip full bytes. */
                        if (*byte == 0xff) {
-                               lcn = (lcn + 8) & ~7;
+                               lcn = (lcn + 8) & ~(LCN)7;
                                ntfs_debug("Continuing while loop 1.");
                                continue;
                        }
@@ -693,7 +693,7 @@ switch_to_data1_zone:               search_zone = 2;
                if (zone == MFT_ZONE || mft_zone_size <= 0) {
                        ntfs_debug("No free clusters left, going to out.");
                        /* Really no more space left on device. */
-                       err = ENOSPC;
+                       err = -ENOSPC;
                        goto out;
                } /* zone == DATA_ZONE && mft_zone_size > 0 */
                ntfs_debug("Shrinking mft zone.");
@@ -757,13 +757,13 @@ out:
        if (rl) {
                int err2;
 
-               if (err == ENOSPC)
+               if (err == -ENOSPC)
                        ntfs_debug("Not enough space to complete allocation, "
-                                       "err ENOSPC, first free lcn 0x%llx, "
+                                       "err -ENOSPC, first free lcn 0x%llx, "
                                        "could allocate up to 0x%llx "
                                        "clusters.",
                                        (unsigned long long)rl[0].lcn,
-                                       (unsigned long long)count - clusters);
+                                       (unsigned long long)(count - clusters));
                /* Deallocate all allocated clusters. */
                ntfs_debug("Attempting rollback...");
                err2 = ntfs_cluster_free_from_rl_nolock(vol, rl);
@@ -775,10 +775,10 @@ out:
                }
                /* Free the runlist. */
                ntfs_free(rl);
-       } else if (err == ENOSPC)
-               ntfs_debug("No space left at all, err = ENOSPC, "
-                               "first free lcn = 0x%llx.",
-                               (unsigned long long)vol->data1_zone_pos);
+       } else if (err == -ENOSPC)
+               ntfs_debug("No space left at all, err = -ENOSPC, first free "
+                               "lcn = 0x%llx.",
+                               (long long)vol->data1_zone_pos);
        up_write(&vol->lcnbmp_lock);
        return ERR_PTR(err);
 }
@@ -848,9 +848,8 @@ s64 __ntfs_cluster_free(struct inode *vi, const VCN start_vcn, s64 count,
 
        total_freed = real_freed = 0;
 
-       /* This returns with ni->runlist locked for reading on success. */
        down_read(&ni->runlist.lock);
-       rl = ntfs_find_vcn_nolock(ni, start_vcn, FALSE);
+       rl = ntfs_attr_find_vcn_nolock(ni, start_vcn, FALSE);
        if (IS_ERR(rl)) {
                if (!is_rollback)
                        ntfs_error(vol->sb, "Failed to find first runlist "
@@ -904,7 +903,7 @@ s64 __ntfs_cluster_free(struct inode *vi, const VCN start_vcn, s64 count,
 
                        /* Attempt to map runlist. */
                        vcn = rl->vcn;
-                       rl = ntfs_find_vcn_nolock(ni, vcn, FALSE);
+                       rl = ntfs_attr_find_vcn_nolock(ni, vcn, FALSE);
                        if (IS_ERR(rl)) {
                                err = PTR_ERR(rl);
                                if (!is_rollback)