~ubuntu-branches/ubuntu/quantal/linux-lowlatency/quantal-proposed

« back to all changes in this revision

Viewing changes to fs/udf/balloc.c

  • Committer: Package Import Robot
  • Author(s): Andy Whitcroft, Andy Whitcroft
  • Date: 2012-06-21 09:16:38 UTC
  • Revision ID: package-import@ubuntu.com-20120621091638-gubhv4nox8xez1ct
Tags: 3.5.0-1.1
[ Andy Whitcroft]

* Rebuild lowlatency against Ubuntu-3.5.0-1.1
* All new configuration system to allow configuration deltas to be
  exposed via debian.lowlatency/config-delta

Show diffs side-by-side

added added

removed removed

Lines of Context:
105
105
}
106
106
 
107
107
static void udf_bitmap_free_blocks(struct super_block *sb,
108
 
                                   struct inode *inode,
109
108
                                   struct udf_bitmap *bitmap,
110
109
                                   struct kernel_lb_addr *bloc,
111
110
                                   uint32_t offset,
172
171
}
173
172
 
174
173
static int udf_bitmap_prealloc_blocks(struct super_block *sb,
175
 
                                      struct inode *inode,
176
174
                                      struct udf_bitmap *bitmap,
177
175
                                      uint16_t partition, uint32_t first_block,
178
176
                                      uint32_t block_count)
223
221
}
224
222
 
225
223
static int udf_bitmap_new_block(struct super_block *sb,
226
 
                                struct inode *inode,
227
224
                                struct udf_bitmap *bitmap, uint16_t partition,
228
225
                                uint32_t goal, int *err)
229
226
{
349
346
}
350
347
 
351
348
static void udf_table_free_blocks(struct super_block *sb,
352
 
                                  struct inode *inode,
353
349
                                  struct inode *table,
354
350
                                  struct kernel_lb_addr *bloc,
355
351
                                  uint32_t offset,
581
577
}
582
578
 
583
579
static int udf_table_prealloc_blocks(struct super_block *sb,
584
 
                                     struct inode *inode,
585
580
                                     struct inode *table, uint16_t partition,
586
581
                                     uint32_t first_block, uint32_t block_count)
587
582
{
643
638
}
644
639
 
645
640
static int udf_table_new_block(struct super_block *sb,
646
 
                               struct inode *inode,
647
641
                               struct inode *table, uint16_t partition,
648
642
                               uint32_t goal, int *err)
649
643
{
743
737
        struct udf_part_map *map = &UDF_SB(sb)->s_partmaps[partition];
744
738
 
745
739
        if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP) {
746
 
                udf_bitmap_free_blocks(sb, inode, map->s_uspace.s_bitmap,
 
740
                udf_bitmap_free_blocks(sb, map->s_uspace.s_bitmap,
747
741
                                       bloc, offset, count);
748
742
        } else if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_TABLE) {
749
 
                udf_table_free_blocks(sb, inode, map->s_uspace.s_table,
 
743
                udf_table_free_blocks(sb, map->s_uspace.s_table,
750
744
                                      bloc, offset, count);
751
745
        } else if (map->s_partition_flags & UDF_PART_FLAG_FREED_BITMAP) {
752
 
                udf_bitmap_free_blocks(sb, inode, map->s_fspace.s_bitmap,
 
746
                udf_bitmap_free_blocks(sb, map->s_fspace.s_bitmap,
753
747
                                       bloc, offset, count);
754
748
        } else if (map->s_partition_flags & UDF_PART_FLAG_FREED_TABLE) {
755
 
                udf_table_free_blocks(sb, inode, map->s_fspace.s_table,
 
749
                udf_table_free_blocks(sb, map->s_fspace.s_table,
756
750
                                      bloc, offset, count);
757
751
        }
 
752
 
 
753
        if (inode) {
 
754
                inode_sub_bytes(inode,
 
755
                                ((sector_t)count) << sb->s_blocksize_bits);
 
756
        }
758
757
}
759
758
 
760
759
inline int udf_prealloc_blocks(struct super_block *sb,
763
762
                               uint32_t block_count)
764
763
{
765
764
        struct udf_part_map *map = &UDF_SB(sb)->s_partmaps[partition];
 
765
        sector_t allocated;
766
766
 
767
767
        if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP)
768
 
                return udf_bitmap_prealloc_blocks(sb, inode,
769
 
                                                  map->s_uspace.s_bitmap,
770
 
                                                  partition, first_block,
771
 
                                                  block_count);
 
768
                allocated = udf_bitmap_prealloc_blocks(sb,
 
769
                                                       map->s_uspace.s_bitmap,
 
770
                                                       partition, first_block,
 
771
                                                       block_count);
772
772
        else if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_TABLE)
773
 
                return udf_table_prealloc_blocks(sb, inode,
774
 
                                                 map->s_uspace.s_table,
775
 
                                                 partition, first_block,
776
 
                                                 block_count);
 
773
                allocated = udf_table_prealloc_blocks(sb,
 
774
                                                      map->s_uspace.s_table,
 
775
                                                      partition, first_block,
 
776
                                                      block_count);
777
777
        else if (map->s_partition_flags & UDF_PART_FLAG_FREED_BITMAP)
778
 
                return udf_bitmap_prealloc_blocks(sb, inode,
779
 
                                                  map->s_fspace.s_bitmap,
780
 
                                                  partition, first_block,
781
 
                                                  block_count);
 
778
                allocated = udf_bitmap_prealloc_blocks(sb,
 
779
                                                       map->s_fspace.s_bitmap,
 
780
                                                       partition, first_block,
 
781
                                                       block_count);
782
782
        else if (map->s_partition_flags & UDF_PART_FLAG_FREED_TABLE)
783
 
                return udf_table_prealloc_blocks(sb, inode,
784
 
                                                 map->s_fspace.s_table,
785
 
                                                 partition, first_block,
786
 
                                                 block_count);
 
783
                allocated = udf_table_prealloc_blocks(sb,
 
784
                                                      map->s_fspace.s_table,
 
785
                                                      partition, first_block,
 
786
                                                      block_count);
787
787
        else
788
788
                return 0;
 
789
 
 
790
        if (inode && allocated > 0)
 
791
                inode_add_bytes(inode, allocated << sb->s_blocksize_bits);
 
792
        return allocated;
789
793
}
790
794
 
791
795
inline int udf_new_block(struct super_block *sb,
793
797
                         uint16_t partition, uint32_t goal, int *err)
794
798
{
795
799
        struct udf_part_map *map = &UDF_SB(sb)->s_partmaps[partition];
 
800
        int block;
796
801
 
797
802
        if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP)
798
 
                return udf_bitmap_new_block(sb, inode,
799
 
                                           map->s_uspace.s_bitmap,
800
 
                                           partition, goal, err);
 
803
                block = udf_bitmap_new_block(sb,
 
804
                                             map->s_uspace.s_bitmap,
 
805
                                             partition, goal, err);
801
806
        else if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_TABLE)
802
 
                return udf_table_new_block(sb, inode,
803
 
                                           map->s_uspace.s_table,
804
 
                                           partition, goal, err);
 
807
                block = udf_table_new_block(sb,
 
808
                                            map->s_uspace.s_table,
 
809
                                            partition, goal, err);
805
810
        else if (map->s_partition_flags & UDF_PART_FLAG_FREED_BITMAP)
806
 
                return udf_bitmap_new_block(sb, inode,
807
 
                                            map->s_fspace.s_bitmap,
808
 
                                            partition, goal, err);
 
811
                block = udf_bitmap_new_block(sb,
 
812
                                             map->s_fspace.s_bitmap,
 
813
                                             partition, goal, err);
809
814
        else if (map->s_partition_flags & UDF_PART_FLAG_FREED_TABLE)
810
 
                return udf_table_new_block(sb, inode,
811
 
                                           map->s_fspace.s_table,
812
 
                                           partition, goal, err);
 
815
                block = udf_table_new_block(sb,
 
816
                                            map->s_fspace.s_table,
 
817
                                            partition, goal, err);
813
818
        else {
814
819
                *err = -EIO;
815
820
                return 0;
816
821
        }
 
822
        if (inode && block)
 
823
                inode_add_bytes(inode, sb->s_blocksize);
 
824
        return block;
817
825
}