Searched refs:bitmap (Results 1 - 200 of 877) sorted by relevance

12345

/linux-4.1.27/fs/omfs/
H A DMakefile4 omfs-y := bitmap.o dir.o file.o inode.o
H A Domfs.h39 /* bitmap.c */
H A Dbitmap.c23 * Called with bitmap lock.
45 * Called with bitmap lock.
H A Domfs_fs.h50 __be64 r_bitmap; /* block # of free space bitmap */
/linux-4.1.27/tools/perf/util/
H A Dbitmap.c2 * From lib/bitmap.c
3 * Helper functions for bitmap.h.
8 #include <linux/bitmap.h>
10 int __bitmap_weight(const unsigned long *bitmap, int bits) __bitmap_weight() argument
15 w += hweight_long(bitmap[k]); __bitmap_weight()
18 w += hweight_long(bitmap[k] & BITMAP_LAST_WORD_MASK(bits)); __bitmap_weight()
H A Dpmu.y9 #include <linux/bitmap.h>
H A Dpmu.h4 #include <linux/bitmap.h>
/linux-4.1.27/fs/qnx4/
H A DMakefile7 qnx4-objs := inode.o dir.o namei.o bitmap.o
H A Dinode.c26 #define QNX4_BMNAME ".bitmap"
177 return "not enough memory for bitmap inode"; qnx4_checkroot()
178 /* keep bitmap inode known */ qnx4_checkroot()
183 return "bitmap file not found."; qnx4_checkroot()
/linux-4.1.27/drivers/md/
H A Dbitmap.c2 * bitmap.c two-level bitmap (C) Peter T. Breuer (ptb@ot.uc3m.es) 2003
4 * bitmap_create - sets up the bitmap structure
5 * bitmap_destroy - destroys the bitmap structure
8 * - added disk storage for bitmap
9 * - changes to allow various bitmap chunk sizes
31 #include "bitmap.h"
33 static inline char *bmname(struct bitmap *bitmap) bmname() argument
35 return bitmap->mddev ? mdname(bitmap->mddev) : "mdX"; bmname()
48 static int bitmap_checkpage(struct bitmap_counts *bitmap,
50 __releases(bitmap->lock)
51 __acquires(bitmap->lock)
55 if (page >= bitmap->pages) {
63 if (bitmap->bp[page].hijacked) /* it's hijacked, don't try to alloc */
66 if (bitmap->bp[page].map) /* page is already allocated, just return */
74 spin_unlock_irq(&bitmap->lock);
89 spin_lock_irq(&bitmap->lock);
92 pr_debug("md/bitmap: map page allocation failed, hijacking\n");
95 if (!bitmap->bp[page].map)
96 bitmap->bp[page].hijacked = 1;
97 } else if (bitmap->bp[page].map ||
98 bitmap->bp[page].hijacked) {
106 bitmap->bp[page].map = mappage;
107 bitmap->missing_pages--;
115 static void bitmap_checkfree(struct bitmap_counts *bitmap, unsigned long page) bitmap_checkfree() argument
119 if (bitmap->bp[page].count) /* page is still busy */ bitmap_checkfree()
124 if (bitmap->bp[page].hijacked) { /* page was hijacked, undo this now */ bitmap_checkfree()
125 bitmap->bp[page].hijacked = 0; bitmap_checkfree()
126 bitmap->bp[page].map = NULL; bitmap_checkfree()
129 ptr = bitmap->bp[page].map; bitmap_checkfree()
130 bitmap->bp[page].map = NULL; bitmap_checkfree()
131 bitmap->missing_pages++; bitmap_checkfree()
137 * bitmap file handling - read and write the bitmap file and its superblock
144 /* IO operations when bitmap is stored near all superblocks */ read_sb_page()
207 static int write_sb_page(struct bitmap *bitmap, struct page *page, int wait) write_sb_page() argument
211 struct mddev *mddev = bitmap->mddev; write_sb_page()
212 struct bitmap_storage *store = &bitmap->storage; write_sb_page()
215 if (mddev_is_clustered(bitmap->mddev)) write_sb_page()
216 node_offset = bitmap->cluster_slot * store->file_pages; write_sb_page()
249 /* bitmap runs in to metadata */ write_sb_page()
253 /* data runs in to bitmap */ write_sb_page()
261 /* bitmap runs in to data */ write_sb_page()
281 static void bitmap_file_kick(struct bitmap *bitmap);
285 static void write_page(struct bitmap *bitmap, struct page *page, int wait) write_page() argument
289 if (bitmap->storage.file == NULL) { write_page()
290 switch (write_sb_page(bitmap, page, wait)) { write_page()
292 set_bit(BITMAP_WRITE_ERROR, &bitmap->flags); write_page()
299 atomic_inc(&bitmap->pending_writes); write_page()
307 wait_event(bitmap->write_wait, write_page()
308 atomic_read(&bitmap->pending_writes)==0); write_page()
310 if (test_bit(BITMAP_WRITE_ERROR, &bitmap->flags)) write_page()
311 bitmap_file_kick(bitmap); write_page()
316 struct bitmap *bitmap = bh->b_private; end_bitmap_write() local
319 set_bit(BITMAP_WRITE_ERROR, &bitmap->flags); end_bitmap_write()
320 if (atomic_dec_and_test(&bitmap->pending_writes)) end_bitmap_write()
321 wake_up(&bitmap->write_wait); end_bitmap_write()
357 struct bitmap *bitmap, read_page()
366 pr_debug("read bitmap file (%dB @ %llu)\n", (int)PAGE_SIZE, read_page()
393 bh->b_private = bitmap; read_page()
394 atomic_inc(&bitmap->pending_writes); read_page()
404 wait_event(bitmap->write_wait, read_page()
405 atomic_read(&bitmap->pending_writes)==0); read_page()
406 if (test_bit(BITMAP_WRITE_ERROR, &bitmap->flags)) read_page()
410 printk(KERN_ALERT "md: bitmap read error: (%dB @ %llu): %d\n", read_page()
418 * bitmap file superblock operations
422 void bitmap_update_sb(struct bitmap *bitmap) bitmap_update_sb() argument
426 if (!bitmap || !bitmap->mddev) /* no bitmap for this array */ bitmap_update_sb()
428 if (bitmap->mddev->bitmap_info.external) bitmap_update_sb()
430 if (!bitmap->storage.sb_page) /* no superblock */ bitmap_update_sb()
432 sb = kmap_atomic(bitmap->storage.sb_page); bitmap_update_sb()
433 sb->events = cpu_to_le64(bitmap->mddev->events); bitmap_update_sb()
434 if (bitmap->mddev->events < bitmap->events_cleared) bitmap_update_sb()
436 bitmap->events_cleared = bitmap->mddev->events; bitmap_update_sb()
437 sb->events_cleared = cpu_to_le64(bitmap->events_cleared); bitmap_update_sb()
438 sb->state = cpu_to_le32(bitmap->flags); bitmap_update_sb()
440 sb->daemon_sleep = cpu_to_le32(bitmap->mddev->bitmap_info.daemon_sleep/HZ); bitmap_update_sb()
441 sb->write_behind = cpu_to_le32(bitmap->mddev->bitmap_info.max_write_behind); bitmap_update_sb()
443 sb->sync_size = cpu_to_le64(bitmap->mddev->resync_max_sectors); bitmap_update_sb()
444 sb->chunksize = cpu_to_le32(bitmap->mddev->bitmap_info.chunksize); bitmap_update_sb()
445 sb->nodes = cpu_to_le32(bitmap->mddev->bitmap_info.nodes); bitmap_update_sb()
446 sb->sectors_reserved = cpu_to_le32(bitmap->mddev-> bitmap_update_sb()
449 write_page(bitmap, bitmap->storage.sb_page, 1); bitmap_update_sb()
452 /* print out the bitmap file superblock */ bitmap_print_sb()
453 void bitmap_print_sb(struct bitmap *bitmap) bitmap_print_sb() argument
457 if (!bitmap || !bitmap->storage.sb_page) bitmap_print_sb()
459 sb = kmap_atomic(bitmap->storage.sb_page); bitmap_print_sb()
460 printk(KERN_DEBUG "%s: bitmap file superblock:\n", bmname(bitmap)); bitmap_print_sb()
483 * @bitmap
486 * reads and verifies the on-disk bitmap superblock and populates bitmap_info.
487 * This function verifies 'bitmap_info' and populates the on-disk bitmap
492 static int bitmap_new_disk_sb(struct bitmap *bitmap) bitmap_new_disk_sb() argument
497 bitmap->storage.sb_page = alloc_page(GFP_KERNEL | __GFP_ZERO); bitmap_new_disk_sb()
498 if (bitmap->storage.sb_page == NULL) bitmap_new_disk_sb()
500 bitmap->storage.sb_page->index = 0; bitmap_new_disk_sb()
502 sb = kmap_atomic(bitmap->storage.sb_page); bitmap_new_disk_sb()
507 chunksize = bitmap->mddev->bitmap_info.chunksize; bitmap_new_disk_sb()
511 printk(KERN_ERR "bitmap chunksize not a power of 2\n"); bitmap_new_disk_sb()
516 daemon_sleep = bitmap->mddev->bitmap_info.daemon_sleep; bitmap_new_disk_sb()
523 bitmap->mddev->bitmap_info.daemon_sleep = daemon_sleep; bitmap_new_disk_sb()
529 write_behind = bitmap->mddev->bitmap_info.max_write_behind; bitmap_new_disk_sb()
533 bitmap->mddev->bitmap_info.max_write_behind = write_behind; bitmap_new_disk_sb()
535 /* keep the array size field of the bitmap superblock up to date */ bitmap_new_disk_sb()
536 sb->sync_size = cpu_to_le64(bitmap->mddev->resync_max_sectors); bitmap_new_disk_sb()
538 memcpy(sb->uuid, bitmap->mddev->uuid, 16); bitmap_new_disk_sb()
540 set_bit(BITMAP_STALE, &bitmap->flags); bitmap_new_disk_sb()
541 sb->state = cpu_to_le32(bitmap->flags); bitmap_new_disk_sb()
542 bitmap->events_cleared = bitmap->mddev->events; bitmap_new_disk_sb()
543 sb->events_cleared = cpu_to_le64(bitmap->mddev->events); bitmap_new_disk_sb()
544 bitmap->mddev->bitmap_info.nodes = 0; bitmap_new_disk_sb()
551 /* read the superblock from the bitmap file and initialize some bitmap fields */ bitmap_read_sb()
552 static int bitmap_read_sb(struct bitmap *bitmap) bitmap_read_sb() argument
563 if (!bitmap->storage.file && !bitmap->mddev->bitmap_info.offset) { bitmap_read_sb()
567 set_bit(BITMAP_STALE, &bitmap->flags); bitmap_read_sb()
575 bitmap->storage.sb_page = sb_page; bitmap_read_sb()
579 if (bitmap->cluster_slot >= 0) { bitmap_read_sb()
580 sector_t bm_blocks = bitmap->mddev->resync_max_sectors; bitmap_read_sb()
583 bitmap->mddev->bitmap_info.chunksize >> 9); bitmap_read_sb()
588 bitmap->mddev->bitmap_info.offset += bitmap->cluster_slot * (bm_blocks << 3); bitmap_read_sb()
590 bitmap->cluster_slot, (unsigned long long)bitmap->mddev->bitmap_info.offset); bitmap_read_sb()
593 if (bitmap->storage.file) { bitmap_read_sb()
594 loff_t isize = i_size_read(bitmap->storage.file->f_mapping->host); bitmap_read_sb()
597 err = read_page(bitmap->storage.file, 0, bitmap_read_sb()
598 bitmap, bytes, sb_page); bitmap_read_sb()
600 err = read_sb_page(bitmap->mddev, bitmap_read_sb()
601 bitmap->mddev->bitmap_info.offset, bitmap_read_sb()
620 if (!bitmap->mddev->sync_super) { bitmap_read_sb()
622 strlcpy(bitmap->mddev->bitmap_info.cluster_name, bitmap_read_sb()
626 /* verify that the bitmap-specific fields are valid */ bitmap_read_sb()
633 reason = "bitmap chunksize too small"; bitmap_read_sb()
635 reason = "bitmap chunksize not a power of 2"; bitmap_read_sb()
641 printk(KERN_INFO "%s: invalid bitmap file superblock: %s\n", bitmap_read_sb()
642 bmname(bitmap), reason); bitmap_read_sb()
646 /* keep the array size field of the bitmap superblock up to date */ bitmap_read_sb()
647 sb->sync_size = cpu_to_le64(bitmap->mddev->resync_max_sectors); bitmap_read_sb()
649 if (bitmap->mddev->persistent) { bitmap_read_sb()
652 * bitmap's UUID and event counter to the mddev's bitmap_read_sb()
654 if (memcmp(sb->uuid, bitmap->mddev->uuid, 16)) { bitmap_read_sb()
656 "%s: bitmap superblock UUID mismatch\n", bitmap_read_sb()
657 bmname(bitmap)); bitmap_read_sb()
661 if (!nodes && (events < bitmap->mddev->events)) { bitmap_read_sb()
663 "%s: bitmap file is out of date (%llu < %llu) " bitmap_read_sb()
665 bmname(bitmap), events, bitmap_read_sb()
666 (unsigned long long) bitmap->mddev->events); bitmap_read_sb()
667 set_bit(BITMAP_STALE, &bitmap->flags); bitmap_read_sb()
672 bitmap->flags |= le32_to_cpu(sb->state); bitmap_read_sb()
674 set_bit(BITMAP_HOSTENDIAN, &bitmap->flags); bitmap_read_sb()
675 bitmap->events_cleared = le64_to_cpu(sb->events_cleared); bitmap_read_sb()
676 strlcpy(bitmap->mddev->bitmap_info.cluster_name, sb->cluster_name, 64); bitmap_read_sb()
682 bitmap->mddev->bitmap_info.chunksize = chunksize; bitmap_read_sb()
683 if (nodes && (bitmap->cluster_slot < 0)) { bitmap_read_sb()
684 err = md_setup_cluster(bitmap->mddev, nodes); bitmap_read_sb()
687 bmname(bitmap), err); bitmap_read_sb()
690 bitmap->cluster_slot = md_cluster_ops->slot_number(bitmap->mddev); bitmap_read_sb()
696 if (test_bit(BITMAP_STALE, &bitmap->flags)) bitmap_read_sb()
697 bitmap->events_cleared = bitmap->mddev->events; bitmap_read_sb()
698 bitmap->mddev->bitmap_info.chunksize = chunksize; bitmap_read_sb()
699 bitmap->mddev->bitmap_info.daemon_sleep = daemon_sleep; bitmap_read_sb()
700 bitmap->mddev->bitmap_info.max_write_behind = write_behind; bitmap_read_sb()
701 bitmap->mddev->bitmap_info.nodes = nodes; bitmap_read_sb()
702 if (bitmap->mddev->bitmap_info.space == 0 || bitmap_read_sb()
703 bitmap->mddev->bitmap_info.space > sectors_reserved) bitmap_read_sb()
704 bitmap->mddev->bitmap_info.space = sectors_reserved; bitmap_read_sb()
706 bitmap_print_sb(bitmap); bitmap_read_sb()
707 if (bitmap->cluster_slot < 0) bitmap_read_sb()
708 md_cluster_stop(bitmap->mddev); bitmap_read_sb()
714 * general bitmap file operations
718 * on-disk bitmap:
720 * Use one bit per "chunk" (block set). We do the disk I/O on the bitmap
837 * bitmap_file_kick - if an error occurs while manipulating the bitmap file
841 static void bitmap_file_kick(struct bitmap *bitmap) bitmap_file_kick() argument
845 if (!test_and_set_bit(BITMAP_STALE, &bitmap->flags)) { bitmap_file_kick()
846 bitmap_update_sb(bitmap); bitmap_file_kick()
848 if (bitmap->storage.file) { bitmap_file_kick()
851 ptr = d_path(&bitmap->storage.file->f_path, bitmap_file_kick()
855 "%s: kicking failed bitmap file %s from array!\n", bitmap_file_kick()
856 bmname(bitmap), IS_ERR(ptr) ? "" : ptr); bitmap_file_kick()
861 "%s: disabling internal bitmap due to errors\n", bitmap_file_kick()
862 bmname(bitmap)); bitmap_file_kick()
873 static inline void set_page_attr(struct bitmap *bitmap, int pnum, set_page_attr() argument
876 set_bit((pnum<<2) + attr, bitmap->storage.filemap_attr); set_page_attr()
879 static inline void clear_page_attr(struct bitmap *bitmap, int pnum, clear_page_attr() argument
882 clear_bit((pnum<<2) + attr, bitmap->storage.filemap_attr); clear_page_attr()
885 static inline int test_page_attr(struct bitmap *bitmap, int pnum, test_page_attr() argument
888 return test_bit((pnum<<2) + attr, bitmap->storage.filemap_attr); test_page_attr()
891 static inline int test_and_clear_page_attr(struct bitmap *bitmap, int pnum, test_and_clear_page_attr() argument
895 bitmap->storage.filemap_attr); test_and_clear_page_attr()
899 * to set (and eventually sync) a particular bit in the bitmap file
904 static void bitmap_file_set_bit(struct bitmap *bitmap, sector_t block) bitmap_file_set_bit() argument
909 unsigned long chunk = block >> bitmap->counts.chunkshift; bitmap_file_set_bit()
911 page = filemap_get_page(&bitmap->storage, chunk); bitmap_file_set_bit()
914 bit = file_page_offset(&bitmap->storage, chunk); bitmap_file_set_bit()
918 if (test_bit(BITMAP_HOSTENDIAN, &bitmap->flags)) bitmap_file_set_bit()
925 set_page_attr(bitmap, page->index, BITMAP_PAGE_DIRTY); bitmap_file_set_bit()
928 static void bitmap_file_clear_bit(struct bitmap *bitmap, sector_t block) bitmap_file_clear_bit() argument
933 unsigned long chunk = block >> bitmap->counts.chunkshift; bitmap_file_clear_bit()
935 page = filemap_get_page(&bitmap->storage, chunk); bitmap_file_clear_bit()
938 bit = file_page_offset(&bitmap->storage, chunk); bitmap_file_clear_bit()
940 if (test_bit(BITMAP_HOSTENDIAN, &bitmap->flags)) bitmap_file_clear_bit()
945 if (!test_page_attr(bitmap, page->index, BITMAP_PAGE_NEEDWRITE)) { bitmap_file_clear_bit()
946 set_page_attr(bitmap, page->index, BITMAP_PAGE_PENDING); bitmap_file_clear_bit()
947 bitmap->allclean = 0; bitmap_file_clear_bit()
951 static int bitmap_file_test_bit(struct bitmap *bitmap, sector_t block) bitmap_file_test_bit() argument
956 unsigned long chunk = block >> bitmap->counts.chunkshift; bitmap_file_test_bit()
959 page = filemap_get_page(&bitmap->storage, chunk); bitmap_file_test_bit()
962 bit = file_page_offset(&bitmap->storage, chunk); bitmap_file_test_bit()
964 if (test_bit(BITMAP_HOSTENDIAN, &bitmap->flags)) bitmap_file_test_bit()
975 * sync the dirty pages of the bitmap file to disk */ bitmap_unplug()
976 void bitmap_unplug(struct bitmap *bitmap) bitmap_unplug() argument
981 if (!bitmap || !bitmap->storage.filemap || bitmap_unplug()
982 test_bit(BITMAP_STALE, &bitmap->flags)) bitmap_unplug()
987 for (i = 0; i < bitmap->storage.file_pages; i++) { bitmap_unplug()
988 if (!bitmap->storage.filemap) bitmap_unplug()
990 dirty = test_and_clear_page_attr(bitmap, i, BITMAP_PAGE_DIRTY); bitmap_unplug()
991 need_write = test_and_clear_page_attr(bitmap, i, bitmap_unplug()
994 clear_page_attr(bitmap, i, BITMAP_PAGE_PENDING); bitmap_unplug()
995 write_page(bitmap, bitmap->storage.filemap[i], 0); bitmap_unplug()
998 if (bitmap->storage.file) bitmap_unplug()
999 wait_event(bitmap->write_wait, bitmap_unplug()
1000 atomic_read(&bitmap->pending_writes)==0); bitmap_unplug()
1002 md_super_wait(bitmap->mddev); bitmap_unplug()
1004 if (test_bit(BITMAP_WRITE_ERROR, &bitmap->flags)) bitmap_unplug()
1005 bitmap_file_kick(bitmap); bitmap_unplug()
1009 static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset, int needed);
1011 * the in-memory bitmap from the on-disk bitmap -- also, sets up the
1012 * memory mapping of the bitmap file
1014 * if there's no bitmap file, or if the bitmap file had been
1019 * This is used when reading an out-of-date bitmap...
1021 static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start) bitmap_init_from_disk() argument
1031 struct bitmap_storage *store = &bitmap->storage; bitmap_init_from_disk()
1033 chunks = bitmap->counts.chunks; bitmap_init_from_disk()
1036 if (!file && !bitmap->mddev->bitmap_info.offset) { bitmap_init_from_disk()
1037 /* No permanent bitmap - fill with '1s'. */ bitmap_init_from_disk()
1042 int needed = ((sector_t)(i+1) << (bitmap->counts.chunkshift) bitmap_init_from_disk()
1044 bitmap_set_memory_bits(bitmap, bitmap_init_from_disk()
1045 (sector_t)i << bitmap->counts.chunkshift, bitmap_init_from_disk()
1051 outofdate = test_bit(BITMAP_STALE, &bitmap->flags); bitmap_init_from_disk()
1053 printk(KERN_INFO "%s: bitmap file is out of date, doing full " bitmap_init_from_disk()
1054 "recovery\n", bmname(bitmap)); bitmap_init_from_disk()
1057 printk(KERN_INFO "%s: bitmap file too short %lu < %lu\n", bitmap_init_from_disk()
1058 bmname(bitmap), bitmap_init_from_disk()
1066 if (!bitmap->mddev->bitmap_info.external) bitmap_init_from_disk()
1069 if (mddev_is_clustered(bitmap->mddev)) bitmap_init_from_disk()
1070 node_offset = bitmap->cluster_slot * (DIV_ROUND_UP(store->bytes, PAGE_SIZE)); bitmap_init_from_disk()
1074 index = file_page_index(&bitmap->storage, i); bitmap_init_from_disk()
1075 bit = file_page_offset(&bitmap->storage, i); bitmap_init_from_disk()
1085 ret = read_page(file, index, bitmap, bitmap_init_from_disk()
1089 bitmap->mddev, bitmap_init_from_disk()
1090 bitmap->mddev->bitmap_info.offset, bitmap_init_from_disk()
1101 * if bitmap is out of date, dirty the bitmap_init_from_disk()
1108 write_page(bitmap, page, 1); bitmap_init_from_disk()
1112 &bitmap->flags)) bitmap_init_from_disk()
1117 if (test_bit(BITMAP_HOSTENDIAN, &bitmap->flags)) bitmap_init_from_disk()
1124 int needed = ((sector_t)(i+1) << bitmap->counts.chunkshift bitmap_init_from_disk()
1126 bitmap_set_memory_bits(bitmap, bitmap_init_from_disk()
1127 (sector_t)i << bitmap->counts.chunkshift, bitmap_init_from_disk()
1134 printk(KERN_INFO "%s: bitmap initialized from disk: " bitmap_init_from_disk()
1136 bmname(bitmap), store->file_pages, bitmap_init_from_disk()
1142 printk(KERN_INFO "%s: bitmap initialisation failed: %d\n", bitmap_init_from_disk()
1143 bmname(bitmap), ret); bitmap_init_from_disk()
1147 void bitmap_write_all(struct bitmap *bitmap) bitmap_write_all() argument
1149 /* We don't actually write all bitmap blocks here, bitmap_write_all()
1154 if (!bitmap || !bitmap->storage.filemap) bitmap_write_all()
1156 if (bitmap->storage.file) bitmap_write_all()
1160 for (i = 0; i < bitmap->storage.file_pages; i++) bitmap_write_all()
1161 set_page_attr(bitmap, i, bitmap_write_all()
1163 bitmap->allclean = 0; bitmap_write_all()
1166 static void bitmap_count_page(struct bitmap_counts *bitmap, bitmap_count_page() argument
1169 sector_t chunk = offset >> bitmap->chunkshift; bitmap_count_page()
1171 bitmap->bp[page].count += inc; bitmap_count_page()
1172 bitmap_checkfree(bitmap, page); bitmap_count_page()
1175 static void bitmap_set_pending(struct bitmap_counts *bitmap, sector_t offset) bitmap_set_pending() argument
1177 sector_t chunk = offset >> bitmap->chunkshift; bitmap_set_pending()
1179 struct bitmap_page *bp = &bitmap->bp[page]; bitmap_set_pending()
1185 static bitmap_counter_t *bitmap_get_counter(struct bitmap_counts *bitmap,
1190 * bitmap daemon -- periodically wakes up to clean bits and flush pages
1196 struct bitmap *bitmap; bitmap_daemon_work() local
1206 bitmap = mddev->bitmap; bitmap_daemon_work()
1207 if (bitmap == NULL) { bitmap_daemon_work()
1211 if (time_before(jiffies, bitmap->daemon_lastrun bitmap_daemon_work()
1215 bitmap->daemon_lastrun = jiffies; bitmap_daemon_work()
1216 if (bitmap->allclean) { bitmap_daemon_work()
1220 bitmap->allclean = 1; bitmap_daemon_work()
1226 for (j = 0; j < bitmap->storage.file_pages; j++) bitmap_daemon_work()
1227 if (test_and_clear_page_attr(bitmap, j, bitmap_daemon_work()
1229 set_page_attr(bitmap, j, bitmap_daemon_work()
1232 if (bitmap->need_sync && bitmap_daemon_work()
1237 bitmap->need_sync = 0; bitmap_daemon_work()
1238 if (bitmap->storage.filemap) { bitmap_daemon_work()
1239 sb = kmap_atomic(bitmap->storage.sb_page); bitmap_daemon_work()
1241 cpu_to_le64(bitmap->events_cleared); bitmap_daemon_work()
1243 set_page_attr(bitmap, 0, bitmap_daemon_work()
1247 /* Now look at the bitmap counters and if any are '2' or '1', bitmap_daemon_work()
1250 counts = &bitmap->counts; bitmap_daemon_work()
1273 if (*bmc == 1 && !bitmap->need_sync) { bitmap_daemon_work()
1277 bitmap_file_clear_bit(bitmap, block); bitmap_daemon_work()
1281 bitmap->allclean = 0; bitmap_daemon_work()
1295 j < bitmap->storage.file_pages bitmap_daemon_work()
1296 && !test_bit(BITMAP_STALE, &bitmap->flags); bitmap_daemon_work()
1298 if (test_page_attr(bitmap, j, bitmap_daemon_work()
1302 if (test_and_clear_page_attr(bitmap, j, bitmap_daemon_work()
1304 write_page(bitmap, bitmap->storage.filemap[j], 0); bitmap_daemon_work()
1309 if (bitmap->allclean == 0) bitmap_daemon_work()
1315 static bitmap_counter_t *bitmap_get_counter(struct bitmap_counts *bitmap,
1318 __releases(bitmap->lock)
1319 __acquires(bitmap->lock)
1325 sector_t chunk = offset >> bitmap->chunkshift;
1331 err = bitmap_checkpage(bitmap, page, create);
1333 if (bitmap->bp[page].hijacked ||
1334 bitmap->bp[page].map == NULL)
1335 csize = ((sector_t)1) << (bitmap->chunkshift +
1338 csize = ((sector_t)1) << bitmap->chunkshift;
1346 if (bitmap->bp[page].hijacked) { /* hijacked pointer */
1351 &bitmap->bp[page].map)[hi];
1354 &(bitmap->bp[page].map[pageoff]);
1357 int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors, int behind) bitmap_startwrite() argument
1359 if (!bitmap) bitmap_startwrite()
1364 atomic_inc(&bitmap->behind_writes); bitmap_startwrite()
1365 bw = atomic_read(&bitmap->behind_writes); bitmap_startwrite()
1366 if (bw > bitmap->behind_writes_used) bitmap_startwrite()
1367 bitmap->behind_writes_used = bw; bitmap_startwrite()
1370 bw, bitmap->mddev->bitmap_info.max_write_behind); bitmap_startwrite()
1377 spin_lock_irq(&bitmap->counts.lock); bitmap_startwrite()
1378 bmc = bitmap_get_counter(&bitmap->counts, offset, &blocks, 1); bitmap_startwrite()
1380 spin_unlock_irq(&bitmap->counts.lock); bitmap_startwrite()
1390 prepare_to_wait(&bitmap->overflow_wait, &__wait, bitmap_startwrite()
1392 spin_unlock_irq(&bitmap->counts.lock); bitmap_startwrite()
1394 finish_wait(&bitmap->overflow_wait, &__wait); bitmap_startwrite()
1400 bitmap_file_set_bit(bitmap, offset); bitmap_startwrite()
1401 bitmap_count_page(&bitmap->counts, offset, 1); bitmap_startwrite()
1409 spin_unlock_irq(&bitmap->counts.lock); bitmap_startwrite()
1421 void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long sectors, bitmap_endwrite() argument
1424 if (!bitmap) bitmap_endwrite()
1427 if (atomic_dec_and_test(&bitmap->behind_writes)) bitmap_endwrite()
1428 wake_up(&bitmap->behind_wait); bitmap_endwrite()
1430 atomic_read(&bitmap->behind_writes), bitmap_endwrite()
1431 bitmap->mddev->bitmap_info.max_write_behind); bitmap_endwrite()
1439 spin_lock_irqsave(&bitmap->counts.lock, flags); bitmap_endwrite()
1440 bmc = bitmap_get_counter(&bitmap->counts, offset, &blocks, 0); bitmap_endwrite()
1442 spin_unlock_irqrestore(&bitmap->counts.lock, flags); bitmap_endwrite()
1446 if (success && !bitmap->mddev->degraded && bitmap_endwrite()
1447 bitmap->events_cleared < bitmap->mddev->events) { bitmap_endwrite()
1448 bitmap->events_cleared = bitmap->mddev->events; bitmap_endwrite()
1449 bitmap->need_sync = 1; bitmap_endwrite()
1450 sysfs_notify_dirent_safe(bitmap->sysfs_can_clear); bitmap_endwrite()
1457 wake_up(&bitmap->overflow_wait); bitmap_endwrite()
1461 bitmap_set_pending(&bitmap->counts, offset); bitmap_endwrite()
1462 bitmap->allclean = 0; bitmap_endwrite()
1464 spin_unlock_irqrestore(&bitmap->counts.lock, flags); bitmap_endwrite()
1474 static int __bitmap_start_sync(struct bitmap *bitmap, sector_t offset, sector_t *blocks, __bitmap_start_sync() argument
1479 if (bitmap == NULL) {/* FIXME or bitmap set as 'failed' */ __bitmap_start_sync()
1481 return 1; /* always resync if no bitmap */ __bitmap_start_sync()
1483 spin_lock_irq(&bitmap->counts.lock); __bitmap_start_sync()
1484 bmc = bitmap_get_counter(&bitmap->counts, offset, blocks, 0); __bitmap_start_sync()
1498 spin_unlock_irq(&bitmap->counts.lock); __bitmap_start_sync()
1502 int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, sector_t *blocks, bitmap_start_sync() argument
1517 rv |= __bitmap_start_sync(bitmap, offset, bitmap_start_sync()
1526 void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, sector_t *blocks, int aborted) bitmap_end_sync() argument
1531 if (bitmap == NULL) { bitmap_end_sync()
1535 spin_lock_irqsave(&bitmap->counts.lock, flags); bitmap_end_sync()
1536 bmc = bitmap_get_counter(&bitmap->counts, offset, blocks, 0); bitmap_end_sync()
1547 bitmap_set_pending(&bitmap->counts, offset); bitmap_end_sync()
1548 bitmap->allclean = 0; bitmap_end_sync()
1553 spin_unlock_irqrestore(&bitmap->counts.lock, flags); bitmap_end_sync()
1557 void bitmap_close_sync(struct bitmap *bitmap) bitmap_close_sync() argument
1559 /* Sync has finished, and any bitmap chunks that weren't synced bitmap_close_sync()
1565 if (!bitmap) bitmap_close_sync()
1567 while (sector < bitmap->mddev->resync_max_sectors) { bitmap_close_sync()
1568 bitmap_end_sync(bitmap, sector, &blocks, 0); bitmap_close_sync()
1574 void bitmap_cond_end_sync(struct bitmap *bitmap, sector_t sector) bitmap_cond_end_sync() argument
1579 if (!bitmap) bitmap_cond_end_sync()
1582 bitmap->last_end_sync = jiffies; bitmap_cond_end_sync()
1585 if (time_before(jiffies, (bitmap->last_end_sync bitmap_cond_end_sync()
1586 + bitmap->mddev->bitmap_info.daemon_sleep))) bitmap_cond_end_sync()
1588 wait_event(bitmap->mddev->recovery_wait, bitmap_cond_end_sync()
1589 atomic_read(&bitmap->mddev->recovery_active) == 0); bitmap_cond_end_sync()
1591 bitmap->mddev->curr_resync_completed = sector; bitmap_cond_end_sync()
1592 set_bit(MD_CHANGE_CLEAN, &bitmap->mddev->flags); bitmap_cond_end_sync()
1593 sector &= ~((1ULL << bitmap->counts.chunkshift) - 1); bitmap_cond_end_sync()
1595 while (s < sector && s < bitmap->mddev->resync_max_sectors) { bitmap_cond_end_sync()
1596 bitmap_end_sync(bitmap, s, &blocks, 0); bitmap_cond_end_sync()
1599 bitmap->last_end_sync = jiffies; bitmap_cond_end_sync()
1600 sysfs_notify(&bitmap->mddev->kobj, NULL, "sync_completed"); bitmap_cond_end_sync()
1604 static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset, int needed) bitmap_set_memory_bits() argument
1613 spin_lock_irq(&bitmap->counts.lock); bitmap_set_memory_bits()
1614 bmc = bitmap_get_counter(&bitmap->counts, offset, &secs, 1); bitmap_set_memory_bits()
1616 spin_unlock_irq(&bitmap->counts.lock); bitmap_set_memory_bits()
1621 bitmap_count_page(&bitmap->counts, offset, 1); bitmap_set_memory_bits()
1622 bitmap_set_pending(&bitmap->counts, offset); bitmap_set_memory_bits()
1623 bitmap->allclean = 0; bitmap_set_memory_bits()
1627 spin_unlock_irq(&bitmap->counts.lock); bitmap_set_memory_bits()
1630 /* dirty the memory and file bits for bitmap chunks "s" to "e" */ bitmap_dirty_bits()
1631 void bitmap_dirty_bits(struct bitmap *bitmap, unsigned long s, unsigned long e) bitmap_dirty_bits() argument
1636 sector_t sec = (sector_t)chunk << bitmap->counts.chunkshift; bitmap_dirty_bits()
1637 bitmap_set_memory_bits(bitmap, sec, 1); bitmap_dirty_bits()
1638 bitmap_file_set_bit(bitmap, sec); bitmap_dirty_bits()
1639 if (sec < bitmap->mddev->recovery_cp) bitmap_dirty_bits()
1644 bitmap->mddev->recovery_cp = sec; bitmap_dirty_bits()
1653 struct bitmap *bitmap = mddev->bitmap; bitmap_flush() local
1656 if (!bitmap) /* there was no bitmap */ bitmap_flush()
1663 bitmap->daemon_lastrun -= sleep; bitmap_flush()
1665 bitmap->daemon_lastrun -= sleep; bitmap_flush()
1667 bitmap->daemon_lastrun -= sleep; bitmap_flush()
1669 bitmap_update_sb(bitmap); bitmap_flush()
1675 static void bitmap_free(struct bitmap *bitmap) bitmap_free() argument
1680 if (!bitmap) /* there was no bitmap */ bitmap_free()
1683 if (mddev_is_clustered(bitmap->mddev) && bitmap->mddev->cluster_info && bitmap_free()
1684 bitmap->cluster_slot == md_cluster_ops->slot_number(bitmap->mddev)) bitmap_free()
1685 md_cluster_stop(bitmap->mddev); bitmap_free()
1688 wait_event(bitmap->write_wait, bitmap_free()
1689 atomic_read(&bitmap->pending_writes) == 0); bitmap_free()
1691 /* release the bitmap file */ bitmap_free()
1692 bitmap_file_unmap(&bitmap->storage); bitmap_free()
1694 bp = bitmap->counts.bp; bitmap_free()
1695 pages = bitmap->counts.pages; bitmap_free()
1704 kfree(bitmap); bitmap_free()
1709 struct bitmap *bitmap = mddev->bitmap; bitmap_destroy() local
1711 if (!bitmap) /* there was no bitmap */ bitmap_destroy()
1716 mddev->bitmap = NULL; /* disconnect from the md device */ bitmap_destroy()
1722 if (bitmap->sysfs_can_clear) bitmap_destroy()
1723 sysfs_put(bitmap->sysfs_can_clear); bitmap_destroy()
1725 bitmap_free(bitmap); bitmap_destroy()
1729 * initialize the bitmap structure
1732 struct bitmap *bitmap_create(struct mddev *mddev, int slot) bitmap_create()
1734 struct bitmap *bitmap; bitmap_create() local
1744 bitmap = kzalloc(sizeof(*bitmap), GFP_KERNEL); bitmap_create()
1745 if (!bitmap) bitmap_create()
1748 spin_lock_init(&bitmap->counts.lock); bitmap_create()
1749 atomic_set(&bitmap->pending_writes, 0); bitmap_create()
1750 init_waitqueue_head(&bitmap->write_wait); bitmap_create()
1751 init_waitqueue_head(&bitmap->overflow_wait); bitmap_create()
1752 init_waitqueue_head(&bitmap->behind_wait); bitmap_create()
1754 bitmap->mddev = mddev; bitmap_create()
1755 bitmap->cluster_slot = slot; bitmap_create()
1758 bm = sysfs_get_dirent(mddev->kobj.sd, "bitmap"); bitmap_create()
1760 bitmap->sysfs_can_clear = sysfs_get_dirent(bm, "can_clear"); bitmap_create()
1763 bitmap->sysfs_can_clear = NULL; bitmap_create()
1765 bitmap->storage.file = file; bitmap_create()
1774 /* read superblock from bitmap file (this sets mddev->bitmap_info.chunksize) */ bitmap_create()
1778 * instructing us to create a new on-disk bitmap instance. bitmap_create()
1781 err = bitmap_new_disk_sb(bitmap); bitmap_create()
1783 err = bitmap_read_sb(bitmap); bitmap_create()
1795 bitmap->daemon_lastrun = jiffies; bitmap_create()
1796 err = bitmap_resize(bitmap, blocks, mddev->bitmap_info.chunksize, 1); bitmap_create()
1800 printk(KERN_INFO "created bitmap (%lu pages) for device %s\n", bitmap_create()
1801 bitmap->counts.pages, bmname(bitmap)); bitmap_create()
1803 err = test_bit(BITMAP_WRITE_ERROR, &bitmap->flags) ? -EIO : 0; bitmap_create()
1807 return bitmap; bitmap_create()
1809 bitmap_free(bitmap); bitmap_create()
1818 struct bitmap *bitmap = mddev->bitmap; bitmap_load() local
1820 if (!bitmap) bitmap_load()
1823 /* Clear out old bitmap info first: Either there is none, or we bitmap_load()
1830 bitmap_start_sync(bitmap, sector, &blocks, 0); bitmap_load()
1833 bitmap_close_sync(bitmap); bitmap_load()
1836 || bitmap->events_cleared == mddev->events) bitmap_load()
1842 err = bitmap_init_from_disk(bitmap, start); bitmap_load()
1847 clear_bit(BITMAP_STALE, &bitmap->flags); bitmap_load()
1850 set_bit(MD_RECOVERY_NEEDED, &bitmap->mddev->recovery); bitmap_load()
1855 bitmap_update_sb(bitmap); bitmap_load()
1857 if (test_bit(BITMAP_WRITE_ERROR, &bitmap->flags)) bitmap_load()
1864 /* Loads the bitmap associated with slot and copies the resync information
1865 * to our bitmap
1873 struct bitmap *bitmap = bitmap_create(mddev, slot); bitmap_copy_from_slot() local
1875 if (IS_ERR(bitmap)) bitmap_copy_from_slot()
1876 return PTR_ERR(bitmap); bitmap_copy_from_slot()
1878 rv = bitmap_read_sb(bitmap); bitmap_copy_from_slot()
1882 rv = bitmap_init_from_disk(bitmap, 0); bitmap_copy_from_slot()
1886 counts = &bitmap->counts; bitmap_copy_from_slot()
1889 if (bitmap_file_test_bit(bitmap, block)) { bitmap_copy_from_slot()
1893 bitmap_file_clear_bit(bitmap, block); bitmap_copy_from_slot()
1894 bitmap_set_memory_bits(mddev->bitmap, block, 1); bitmap_copy_from_slot()
1895 bitmap_file_set_bit(mddev->bitmap, block); bitmap_copy_from_slot()
1900 bitmap_update_sb(bitmap); bitmap_copy_from_slot()
1904 for (i = 0; i < bitmap->storage.file_pages; i++) bitmap_copy_from_slot()
1905 set_page_attr(bitmap, i, BITMAP_PAGE_DIRTY); bitmap_copy_from_slot()
1906 bitmap_write_all(bitmap); bitmap_copy_from_slot()
1907 bitmap_unplug(bitmap); bitmap_copy_from_slot()
1912 bitmap_free(bitmap); bitmap_copy_from_slot()
1918 void bitmap_status(struct seq_file *seq, struct bitmap *bitmap) bitmap_status() argument
1923 if (!bitmap) bitmap_status()
1926 counts = &bitmap->counts; bitmap_status()
1928 chunk_kb = bitmap->mddev->bitmap_info.chunksize >> 10; bitmap_status()
1929 seq_printf(seq, "bitmap: %lu/%lu pages [%luKB], " bitmap_status()
1935 chunk_kb ? chunk_kb : bitmap->mddev->bitmap_info.chunksize, bitmap_status()
1937 if (bitmap->storage.file) { bitmap_status()
1939 seq_path(seq, &bitmap->storage.file->f_path, " \t\n"); bitmap_status()
1945 int bitmap_resize(struct bitmap *bitmap, sector_t blocks, bitmap_resize() argument
1950 * Then quiesce, copy bits, replace bitmap, and re-start bitmap_resize()
1952 * This function is called both to set up the initial bitmap bitmap_resize()
1953 * and to resize the bitmap while the array is active. bitmap_resize()
1973 long space = bitmap->mddev->bitmap_info.space; bitmap_resize()
1979 bytes = DIV_ROUND_UP(bitmap->counts.chunks, 8); bitmap_resize()
1980 if (!bitmap->mddev->bitmap_info.external) bitmap_resize()
1983 bitmap->mddev->bitmap_info.space = space; bitmap_resize()
1985 chunkshift = bitmap->counts.chunkshift; bitmap_resize()
1992 if (!bitmap->mddev->bitmap_info.external) bitmap_resize()
2000 if (bitmap->mddev->bitmap_info.offset || bitmap->mddev->bitmap_info.file) bitmap_resize()
2002 !bitmap->mddev->bitmap_info.external, bitmap_resize()
2003 mddev_is_clustered(bitmap->mddev) bitmap_resize()
2004 ? bitmap->cluster_slot : 0); bitmap_resize()
2018 bitmap->mddev->pers->quiesce(bitmap->mddev, 1); bitmap_resize()
2020 store.file = bitmap->storage.file; bitmap_resize()
2021 bitmap->storage.file = NULL; bitmap_resize()
2023 if (store.sb_page && bitmap->storage.sb_page) bitmap_resize()
2025 page_address(bitmap->storage.sb_page), bitmap_resize()
2027 bitmap_file_unmap(&bitmap->storage); bitmap_resize()
2028 bitmap->storage = store; bitmap_resize()
2030 old_counts = bitmap->counts; bitmap_resize()
2031 bitmap->counts.bp = new_bp; bitmap_resize()
2032 bitmap->counts.pages = pages; bitmap_resize()
2033 bitmap->counts.missing_pages = pages; bitmap_resize()
2034 bitmap->counts.chunkshift = chunkshift; bitmap_resize()
2035 bitmap->counts.chunks = chunks; bitmap_resize()
2036 bitmap->mddev->bitmap_info.chunksize = 1 << (chunkshift + bitmap_resize()
2042 spin_lock_irq(&bitmap->counts.lock); bitmap_resize()
2052 bmc_new = bitmap_get_counter(&bitmap->counts, block, bitmap_resize()
2060 bitmap_file_set_bit(bitmap, block); bitmap_resize()
2064 bitmap_count_page(&bitmap->counts, bitmap_resize()
2066 bitmap_set_pending(&bitmap->counts, bitmap_resize()
2080 bmc = bitmap_get_counter(&bitmap->counts, block, bitmap_resize()
2088 bitmap_count_page(&bitmap->counts, bitmap_resize()
2090 bitmap_set_pending(&bitmap->counts, bitmap_resize()
2096 for (i = 0; i < bitmap->storage.file_pages; i++) bitmap_resize()
2097 set_page_attr(bitmap, i, BITMAP_PAGE_DIRTY); bitmap_resize()
2099 spin_unlock_irq(&bitmap->counts.lock); bitmap_resize()
2102 bitmap_unplug(bitmap); bitmap_resize()
2103 bitmap->mddev->pers->quiesce(bitmap->mddev, 0); bitmap_resize()
2136 if (mddev->bitmap || mddev->bitmap_info.file || location_store()
2138 /* bitmap already configured. Only option is to clear it */ location_store()
2153 /* No bitmap, OK to set a location */ location_store()
2176 struct bitmap *bitmap; location_store() local
2178 bitmap = bitmap_create(mddev, -1); location_store()
2179 if (IS_ERR(bitmap)) location_store()
2180 rv = PTR_ERR(bitmap); location_store()
2182 mddev->bitmap = bitmap; location_store()
2196 /* Ensure new bitmap info is stored in location_store()
2208 /* 'bitmap/space' is the space available at 'location' for the
2209 * bitmap. This allows the kernel to know when it is safe to
2210 * resize the bitmap to match a resized array.
2231 if (mddev->bitmap && space_store()
2232 sectors < (mddev->bitmap->storage.bytes + 511) >> 9) space_store()
2281 * the bitmap is all clean and we don't need to timeout_store()
2326 /* Can only be changed when no bitmap is active */ chunksize_store()
2329 if (mddev->bitmap) chunksize_store()
2354 if (mddev->bitmap || metadata_store()
2375 if (mddev->bitmap) can_clear_show()
2376 len = sprintf(page, "%s\n", (mddev->bitmap->need_sync ? can_clear_show()
2386 if (mddev->bitmap == NULL) can_clear_store()
2389 mddev->bitmap->need_sync = 1; can_clear_store()
2393 mddev->bitmap->need_sync = 0; can_clear_store()
2407 if (mddev->bitmap == NULL) behind_writes_used_show()
2411 mddev->bitmap->behind_writes_used); behind_writes_used_show()
2419 if (mddev->bitmap) behind_writes_used_reset()
2420 mddev->bitmap->behind_writes_used = 0; behind_writes_used_reset()
2440 .name = "bitmap",
356 read_page(struct file *file, unsigned long index, struct bitmap *bitmap, unsigned long count, struct page *page) read_page() argument
H A Dbitmap.h2 * bitmap.h: Copyright (C) Peter T. Breuer (ptb@ot.uc3m.es) 2003
10 /* version 4 insists the bitmap is in little-endian order
17 * in-memory bitmap:
107 * bitmap structures:
112 /* use these for bitmap->flags and bitmap->sb->state bit-fields */
114 BITMAP_STALE = 1, /* the bitmap file is out of date or had -EIO */
119 /* the superblock at the front of the bitmap file -- little endian */
122 __le32 version; /* 4 the bitmap major for now, could change... */
124 __le64 events; /* 24 event counter for the bitmap (1)*/
127 __le32 state; /* 48 bitmap state information */
128 __le32 chunksize; /* 52 the bitmap chunk size in bytes */
132 * reserved for the bitmap. */
140 * When a bitmap is loaded, it is only accepted if this event counter is equal
146 * higher, it is accepted as conforming to the bitmap.
147 * (3)This is the number of sectors represented by the bitmap, and is the range that
154 /* the in-memory bitmap is represented by bitmap_pages */
176 /* the main bitmap structure - one per mddev */
177 struct bitmap { struct
183 * in the bitmap */
192 struct mddev *mddev; /* the md device that the bitmap is for */
199 struct page *sb_page; /* cached copy of the bitmap
206 unsigned long bytes; /* total bytes in the bitmap */
217 * the bitmap daemon - periodically wakes up and sweeps the bitmap
222 * update bitmap with resync progress */
224 atomic_t pending_writes; /* pending writes to the bitmap file */
233 /* the bitmap API */
235 /* these are used only by md/bitmap */
236 struct bitmap *bitmap_create(struct mddev *mddev, int slot);
241 void bitmap_print_sb(struct bitmap *bitmap);
242 void bitmap_update_sb(struct bitmap *bitmap);
243 void bitmap_status(struct seq_file *seq, struct bitmap *bitmap);
245 int bitmap_setallbits(struct bitmap *bitmap);
246 void bitmap_write_all(struct bitmap *bitmap);
248 void bitmap_dirty_bits(struct bitmap *bitmap, unsigned long s, unsigned long e);
251 int bitmap_startwrite(struct bitmap *bitmap, sector_t offset,
253 void bitmap_endwrite(struct bitmap *bitmap, sector_t offset,
255 int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, sector_t *blocks, int degraded);
256 void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, sector_t *blocks, int aborted);
257 void bitmap_close_sync(struct bitmap *bitmap);
258 void bitmap_cond_end_sync(struct bitmap *bitmap, sector_t sector);
260 void bitmap_unplug(struct bitmap *bitmap);
263 int bitmap_resize(struct bitmap *bitmap, sector_t blocks,
H A Draid1.c18 * - bitmap marked during normal i/o
19 * - bitmap used to skip nondirty blocks during sync
21 * Additions to bitmap code, (C) 2003-2004 Paul Clements, SteelEye Technology:
22 * - persistent bitmap code
42 #include "bitmap.h"
376 /* clear the bitmap if all writes complete successfully */ close_write()
377 bitmap_endwrite(r1_bio->mddev->bitmap, r1_bio->sector, close_write()
776 * bitmap updates get flushed here. flush_pending_writes()
785 /* flush any pending bitmap writes to flush_pending_writes()
787 bitmap_unplug(conf->mddev->bitmap); flush_pending_writes()
1062 bitmap_unplug(mddev->bitmap); raid1_unplug()
1086 struct bitmap *bitmap; make_request() local
1137 bitmap = mddev->bitmap; make_request()
1179 bitmap) { make_request()
1184 wait_event(bitmap->behind_wait, make_request()
1185 atomic_read(&bitmap->behind_writes) == 0); make_request()
1380 if (bitmap && make_request()
1381 (atomic_read(&bitmap->behind_writes) make_request()
1383 !waitqueue_active(&bitmap->behind_wait)) make_request()
1386 bitmap_startwrite(bitmap, r1_bio->sector, make_request()
1775 bitmap_end_sync(mddev->bitmap, s, end_sync_write()
2306 /* an I/O failed, we can't clear the bitmap */ handle_write_finished()
2507 * sync on the 'current' bitmap chunk (there will sync_request()
2512 bitmap_end_sync(mddev->bitmap, mddev->curr_resync, sync_request()
2517 bitmap_close_sync(mddev->bitmap); sync_request()
2522 if (mddev->bitmap == NULL && sync_request()
2532 if (!bitmap_start_sync(mddev->bitmap, sector_nr, &sync_blocks, 1) && sync_request()
2539 bitmap_cond_end_sync(mddev->bitmap, sector_nr); sync_request()
2692 if (!bitmap_start_sync(mddev->bitmap, sector_nr, sync_request()
2998 if (mddev->bitmap) { raid1_resize()
2999 int ret = bitmap_resize(mddev->bitmap, newsize, 0, 0); raid1_resize()
H A Dmd.c22 - persistent bitmap code
55 #include "bitmap.h"
941 * Check that the given mddev has no bitmap.
945 * has a bitmap. Otherwise, it returns 0.
1088 /* bitmap can use 60 K after the 4K superblocks */ super_90_validate()
1142 } else if (mddev->bitmap) { super_90_validate()
1143 /* if adding to array with a bitmap, then we can accept an super_90_validate()
1146 if (ev1 < mddev->bitmap->events_cleared) super_90_validate()
1254 if (mddev->bitmap && mddev->bitmap_info.file == NULL) super_90_sync()
1333 return 0; /* can't move bitmap */ super_90_rdev_size_change()
1575 /* Default location for bitmap is 1K after superblock super_1_validate()
1634 } else if (mddev->bitmap) { super_1_validate()
1635 /* If adding to array with a bitmap, then we can accept an super_1_validate()
1638 if (ev1 < mddev->bitmap->events_cleared) super_1_validate()
1720 if (mddev->bitmap && mddev->bitmap_info.file == NULL) { super_1_sync()
1731 if (rdev->saved_raid_disk >= 0 && mddev->bitmap) super_1_sync()
1841 /* minor version 0 with bitmap we can't move */ super_1_rdev_size_change()
1869 struct bitmap *bitmap; super_1_allow_new_offset() local
1882 * beyond write-intent bitmap super_1_allow_new_offset()
1886 bitmap = rdev->mddev->bitmap; super_1_allow_new_offset()
1887 if (bitmap && !rdev->mddev->bitmap_info.file && super_1_allow_new_offset()
1889 bitmap->storage.file_pages * (PAGE_SIZE>>9) > new_offset) super_1_allow_new_offset()
2325 bitmap_update_sb(mddev->bitmap); rdev_for_each()
2499 * so that it gets rebuilt based on bitmap state_store()
2608 * will land in the local bitmap, which will be synced state_store()
4035 if (!mddev->bitmap) bitmap_store()
4047 bitmap_dirty_bits(mddev->bitmap, chunk, end_chunk); bitmap_store()
4050 bitmap_unplug(mddev->bitmap); /* flush the bits to disk */ bitmap_store()
5151 struct bitmap *bitmap; local
5153 bitmap = bitmap_create(mddev, -1);
5154 if (IS_ERR(bitmap)) {
5155 err = PTR_ERR(bitmap);
5156 printk(KERN_ERR "%s: failed to create bitmap (%d)\n",
5159 mddev->bitmap = bitmap;
5348 struct bitmap *bitmap = mddev->bitmap; mddev_detach() local
5350 if (bitmap && atomic_read(&bitmap->behind_writes) > 0) { mddev_detach()
5354 wait_event(bitmap->behind_wait, mddev_detach()
5355 atomic_read(&bitmap->behind_writes) == 0); mddev_detach()
5723 if (mddev->bitmap && mddev->bitmap_info.offset)
5753 /* bitmap disabled, zero the first byte and copy out */ get_bitmap_file()
6119 /* we should be able to change the bitmap.. */ set_bitmap_file()
6126 if (mddev->bitmap || mddev->bitmap_info.file) set_bitmap_file()
6127 return -EEXIST; /* cannot add when bitmap is present */ set_bitmap_file()
6131 printk(KERN_ERR "%s: error: failed to get bitmap file\n", set_bitmap_file()
6138 printk(KERN_ERR "%s: error: bitmap file must be a regular file\n", set_bitmap_file()
6142 printk(KERN_ERR "%s: error: bitmap file must open for write\n", set_bitmap_file()
6146 printk(KERN_ERR "%s: error: bitmap file is already in use\n", set_bitmap_file()
6156 } else if (mddev->bitmap == NULL) set_bitmap_file()
6162 struct bitmap *bitmap; set_bitmap_file() local
6164 bitmap = bitmap_create(mddev, -1); set_bitmap_file()
6165 if (!IS_ERR(bitmap)) { set_bitmap_file()
6166 mddev->bitmap = bitmap; set_bitmap_file()
6169 err = PTR_ERR(bitmap); set_bitmap_file()
6378 if (mddev->bitmap && mddev->bitmap_info.offset) update_array_info()
6440 struct bitmap *bitmap; update_array_info() local
6441 /* add the bitmap */ update_array_info()
6442 if (mddev->bitmap) { update_array_info()
6455 bitmap = bitmap_create(mddev, -1); update_array_info()
6456 if (!IS_ERR(bitmap)) { update_array_info()
6457 mddev->bitmap = bitmap; update_array_info()
6460 rv = PTR_ERR(bitmap); update_array_info()
6465 /* remove the bitmap */ update_array_info()
6466 if (!mddev->bitmap) { update_array_info()
6470 if (mddev->bitmap->storage.file) { update_array_info()
7321 bitmap_status(seq, mddev->bitmap);
7715 /* we don't use the checkpoint if there's a bitmap */
7718 else if (!mddev->bitmap)
7736 /* If there is a bitmap, we need to make sure all
7740 * bitmap_endwrite) set a bit in the bitmap after the
7744 if (mddev->bitmap) {
8089 if (mddev->bitmap) md_check_recovery()
8215 * which has the bitmap stored on all devices. md_check_recovery()
8216 * So make sure all bitmap pages get written md_check_recovery()
8218 bitmap_write_all(mddev->bitmap); md_check_recovery()
/linux-4.1.27/lib/
H A Dmemweight.c3 #include <linux/bitmap.h>
14 const unsigned char *bitmap = ptr; memweight() local
16 for (; bytes > 0 && ((unsigned long)bitmap) % sizeof(long); memweight()
17 bytes--, bitmap++) memweight()
18 ret += hweight8(*bitmap); memweight()
23 ret += bitmap_weight((unsigned long *)bitmap, memweight()
26 bitmap += longs * sizeof(long); memweight()
33 for (; bytes > 0; bytes--, bitmap++) memweight()
34 ret += hweight8(*bitmap); memweight()
H A Dbitmap.c2 * lib/bitmap.c
3 * Helper functions for bitmap.h.
12 #include <linux/bitmap.h>
22 * given bitmap does _not_ need to be an exact multiple of
26 * of a bitmap are 'don't care'. The implementation makes
29 * The bitmap operations that return Boolean (bitmap_empty,
73 * __bitmap_shift_right - logical right shift of the bits in a bitmap
74 * @dst : destination bitmap
75 * @src : source bitmap
77 * @nbits : bitmap size, in bits
117 * __bitmap_shift_left - logical left shift of the bits in a bitmap
118 * @dst : destination bitmap
119 * @src : source bitmap
121 * @nbits : bitmap size, in bits
237 int __bitmap_weight(const unsigned long *bitmap, unsigned int bits) __bitmap_weight() argument
243 w += hweight_long(bitmap[k]); __bitmap_weight()
246 w += hweight_long(bitmap[k] & BITMAP_LAST_WORD_MASK(bits)); __bitmap_weight()
297 * @size: The bitmap size in bits
343 * __bitmap_parse - convert an ASCII hex string into a bitmap.
348 * @maskp: pointer to bitmap array that will contain result.
349 * @nmaskbits: size of bitmap, in bits.
372 /* Get the next chunk of the bitmap */ __bitmap_parse()
429 * bitmap_parse_user - convert an ASCII hex string in a user buffer into a bitmap
434 * @maskp: pointer to bitmap array that will contain result.
435 * @nmaskbits: size of bitmap, in bits.
439 * We cannot have this as an inline function in bitmap.h because it needs
456 * bitmap_print_to_pagebuf - convert bitmap to list or hex format ASCII string
457 * @list: indicates whether the bitmap must be list
459 * @maskp: pointer to bitmap to convert
460 * @nmaskbits: size of bitmap, in bits
483 * __bitmap_parselist - convert list format ASCII string to bitmap
589 * @maskp: pointer to bitmap array that will contain result.
590 * @nmaskbits: size of bitmap, in bits.
594 * We cannot have this as an inline function in bitmap.h because it needs
611 * bitmap_pos_to_ord - find ordinal of set bit at given position in bitmap
612 * @buf: pointer to a bitmap
637 * bitmap_ord_to_pos - find position of n-th set bit in bitmap
638 * @buf: pointer to bitmap
667 * bitmap_remap - Apply map defined by a pair of bitmaps to another bitmap
759 * bitmap_onto - translate one bitmap relative to another
760 * @dst: resulting translated bitmap
761 * @orig: original untranslated bitmap
762 * @relmap: bitmap relative to which translated
781 * @orig bitmap over itself so that all its set bits x are in the
822 * unsigned long *tmp; // a temporary bitmap's bits
830 * using bitmap_fold() to fold the @orig bitmap modulo ten
888 * bitmap_fold - fold larger bitmap into smaller, modulo specified size
889 * @dst: resulting smaller bitmap
890 * @orig: original larger bitmap
914 * bitmap: array of unsigned longs corresponding to the bitmap
917 * reg_op: operation(s) to perform on that region of bitmap
919 * Can set, verify and/or release a region of bits in a bitmap,
922 * A region of a bitmap is a sequence of bits in the bitmap, of
936 static int __reg_op(unsigned long *bitmap, unsigned int pos, int order, int reg_op) __reg_op() argument
939 int index; /* index first long of region in bitmap */ __reg_op()
940 int offset; /* bit offset region in bitmap[index] */ __reg_op()
941 int nlongs_reg; /* num longs spanned by region in bitmap */ __reg_op()
944 int i; /* scans bitmap by longs */ __reg_op()
968 if (bitmap[index + i] & mask) __reg_op()
976 bitmap[index + i] |= mask; __reg_op()
981 bitmap[index + i] &= ~mask; __reg_op()
990 * @bitmap: array of unsigned longs corresponding to the bitmap
991 * @bits: number of bits in the bitmap
994 * Find a region of free (zero) bits in a @bitmap of @bits bits and
999 * Return the bit offset in bitmap of the allocated region,
1002 int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order) bitmap_find_free_region() argument
1004 unsigned int pos, end; /* scans bitmap by regions of size order */ bitmap_find_free_region()
1007 if (!__reg_op(bitmap, pos, order, REG_OP_ISFREE)) bitmap_find_free_region()
1009 __reg_op(bitmap, pos, order, REG_OP_ALLOC); bitmap_find_free_region()
1017 * bitmap_release_region - release allocated bitmap region
1018 * @bitmap: array of unsigned longs corresponding to the bitmap
1023 * the found region (by clearing it in the bitmap).
1027 void bitmap_release_region(unsigned long *bitmap, unsigned int pos, int order) bitmap_release_region() argument
1029 __reg_op(bitmap, pos, order, REG_OP_RELEASE); bitmap_release_region()
1034 * bitmap_allocate_region - allocate bitmap region
1035 * @bitmap: array of unsigned longs corresponding to the bitmap
1039 * Allocate (set bits in) a specified region of a bitmap.
1044 int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order) bitmap_allocate_region() argument
1046 if (!__reg_op(bitmap, pos, order, REG_OP_ISFREE)) bitmap_allocate_region()
1048 return __reg_op(bitmap, pos, order, REG_OP_ALLOC); bitmap_allocate_region()
1053 * bitmap_copy_le - copy a bitmap, putting the bits into little-endian order.
1055 * @src: bitmap to copy
1056 * @nbits: number of bits in the bitmap
H A Didr.c14 * by the id to obtain the pointer. The bitmap makes allocating
177 __set_bit(id & IDR_MASK, p->bitmap); idr_mark_full()
184 while (bitmap_full(p->bitmap, IDR_SIZE)) { idr_mark_full()
188 __set_bit((id & IDR_MASK), p->bitmap); idr_mark_full()
237 m = find_next_zero_bit(p->bitmap, IDR_SIZE, n); sub_alloc()
332 bitmap_clear(new->bitmap, 0, IDR_SIZE); idr_get_empty_slot()
342 if (bitmap_full(p->bitmap, IDR_SIZE)) idr_get_empty_slot()
343 __set_bit(0, new->bitmap); idr_get_empty_slot()
521 __clear_bit(n, p->bitmap); sub_remove()
527 if (likely(p != NULL && test_bit(n, p->bitmap))) { sub_remove()
528 __clear_bit(n, p->bitmap); sub_remove()
577 bitmap_clear(to_free->bitmap, 0, IDR_SIZE); idr_remove()
815 if (unlikely(p == NULL || !test_bit(n, p->bitmap))) idr_replace()
868 static void free_bitmap(struct ida *ida, struct ida_bitmap *bitmap) free_bitmap() argument
875 ida->free_bitmap = bitmap; free_bitmap()
876 bitmap = NULL; free_bitmap()
881 kfree(bitmap); free_bitmap()
904 struct ida_bitmap *bitmap; ida_pre_get() local
906 bitmap = kmalloc(sizeof(struct ida_bitmap), gfp_mask); ida_pre_get()
907 if (!bitmap) ida_pre_get()
910 free_bitmap(ida, bitmap); ida_pre_get()
935 struct ida_bitmap *bitmap; ida_get_new_above() local
954 /* if bitmap isn't there, create a new one */ ida_get_new_above()
955 bitmap = (void *)pa[0]->ary[idr_id & IDR_MASK]; ida_get_new_above()
956 if (!bitmap) { ida_get_new_above()
958 bitmap = ida->free_bitmap; ida_get_new_above()
962 if (!bitmap) ida_get_new_above()
965 memset(bitmap, 0, sizeof(struct ida_bitmap)); ida_get_new_above()
967 (void *)bitmap); ida_get_new_above()
972 t = find_next_zero_bit(bitmap->bitmap, IDA_BITMAP_BITS, offset); ida_get_new_above()
984 __set_bit(t, bitmap->bitmap); ida_get_new_above()
985 if (++bitmap->nr_busy == IDA_BITMAP_BITS) ida_get_new_above()
1017 struct ida_bitmap *bitmap; ida_remove() local
1025 __clear_bit(n, p->bitmap); ida_remove()
1034 __clear_bit(n, p->bitmap); ida_remove()
1036 bitmap = (void *)p->ary[n]; ida_remove()
1037 if (!bitmap || !test_bit(offset, bitmap->bitmap)) ida_remove()
1040 /* update bitmap and remove it if empty */ ida_remove()
1041 __clear_bit(offset, bitmap->bitmap); ida_remove()
1042 if (--bitmap->nr_busy == 0) { ida_remove()
1043 __set_bit(n, p->bitmap); /* to please idr_remove() */ ida_remove()
1045 free_bitmap(ida, bitmap); ida_remove()
H A Diommu-helper.c6 #include <linux/bitmap.h>
H A Dgenalloc.c33 #include <linux/bitmap.h>
76 * @map: pointer to a bitmap
81 * can set/clear the same bitmap simultaneously without lock. If two
111 * @map: pointer to a bitmap
116 * can set/clear the same bitmap simultaneously without lock. If two
146 * @min_alloc_order: log base 2 of number of bytes each bitmap bit represents
174 * @nid: node id of the node the chunk structure and bitmap should be
499 * @size: The bitmap size in bits
516 * @size: The bitmap size in bits
535 * @size: The bitmap size in bits
540 * Iterate over the bitmap to find the smallest free region
576 * @min_alloc_order: log base 2 of number of bytes each bitmap bit represents
/linux-4.1.27/fs/minix/
H A DMakefile7 minix-objs := bitmap.o itree_v1.o itree_v2.o namei.o inode.o file.o dir.o
H A Dbitmap.c2 * linux/fs/minix/bitmap.c
12 /* bitmap.c contains the code that handles the inode and block bitmaps */
22 * bitmap consists of blocks filled with 16bit words
57 printk("minix_free_block: nonexistent bitmap buffer\n"); minix_free_block()
/linux-4.1.27/drivers/net/ethernet/mellanox/mlx4/
H A Dalloc.c38 #include <linux/bitmap.h>
44 u32 mlx4_bitmap_alloc(struct mlx4_bitmap *bitmap) mlx4_bitmap_alloc() argument
48 spin_lock(&bitmap->lock); mlx4_bitmap_alloc()
50 obj = find_next_zero_bit(bitmap->table, bitmap->max, bitmap->last); mlx4_bitmap_alloc()
51 if (obj >= bitmap->max) { mlx4_bitmap_alloc()
52 bitmap->top = (bitmap->top + bitmap->max + bitmap->reserved_top) mlx4_bitmap_alloc()
53 & bitmap->mask; mlx4_bitmap_alloc()
54 obj = find_first_zero_bit(bitmap->table, bitmap->max); mlx4_bitmap_alloc()
57 if (obj < bitmap->max) { mlx4_bitmap_alloc()
58 set_bit(obj, bitmap->table); mlx4_bitmap_alloc()
59 bitmap->last = (obj + 1); mlx4_bitmap_alloc()
60 if (bitmap->last == bitmap->max) mlx4_bitmap_alloc()
61 bitmap->last = 0; mlx4_bitmap_alloc()
62 obj |= bitmap->top; mlx4_bitmap_alloc()
67 --bitmap->avail; mlx4_bitmap_alloc()
69 spin_unlock(&bitmap->lock); mlx4_bitmap_alloc()
74 void mlx4_bitmap_free(struct mlx4_bitmap *bitmap, u32 obj, int use_rr) mlx4_bitmap_free() argument
76 mlx4_bitmap_free_range(bitmap, obj, 1, use_rr); mlx4_bitmap_free()
79 static unsigned long find_aligned_range(unsigned long *bitmap, find_aligned_range() argument
88 while ((start < nbits) && (test_bit(start, bitmap) || find_aligned_range()
100 if (test_bit(i, bitmap) || ((u32)i & skip_mask)) { find_aligned_range()
109 u32 mlx4_bitmap_alloc_range(struct mlx4_bitmap *bitmap, int cnt, mlx4_bitmap_alloc_range() argument
115 return mlx4_bitmap_alloc(bitmap); mlx4_bitmap_alloc_range()
117 spin_lock(&bitmap->lock); mlx4_bitmap_alloc_range()
119 obj = find_aligned_range(bitmap->table, bitmap->last, mlx4_bitmap_alloc_range()
120 bitmap->max, cnt, align, skip_mask); mlx4_bitmap_alloc_range()
121 if (obj >= bitmap->max) { mlx4_bitmap_alloc_range()
122 bitmap->top = (bitmap->top + bitmap->max + bitmap->reserved_top) mlx4_bitmap_alloc_range()
123 & bitmap->mask; mlx4_bitmap_alloc_range()
124 obj = find_aligned_range(bitmap->table, 0, bitmap->max, mlx4_bitmap_alloc_range()
128 if (obj < bitmap->max) { mlx4_bitmap_alloc_range()
129 bitmap_set(bitmap->table, obj, cnt); mlx4_bitmap_alloc_range()
130 if (obj == bitmap->last) { mlx4_bitmap_alloc_range()
131 bitmap->last = (obj + cnt); mlx4_bitmap_alloc_range()
132 if (bitmap->last >= bitmap->max) mlx4_bitmap_alloc_range()
133 bitmap->last = 0; mlx4_bitmap_alloc_range()
135 obj |= bitmap->top; mlx4_bitmap_alloc_range()
140 bitmap->avail -= cnt; mlx4_bitmap_alloc_range()
142 spin_unlock(&bitmap->lock); mlx4_bitmap_alloc_range()
147 u32 mlx4_bitmap_avail(struct mlx4_bitmap *bitmap) mlx4_bitmap_avail() argument
149 return bitmap->avail; mlx4_bitmap_avail()
152 static u32 mlx4_bitmap_masked_value(struct mlx4_bitmap *bitmap, u32 obj) mlx4_bitmap_masked_value() argument
154 return obj & (bitmap->max + bitmap->reserved_top - 1); mlx4_bitmap_masked_value()
157 void mlx4_bitmap_free_range(struct mlx4_bitmap *bitmap, u32 obj, int cnt, mlx4_bitmap_free_range() argument
160 obj &= bitmap->max + bitmap->reserved_top - 1; mlx4_bitmap_free_range()
162 spin_lock(&bitmap->lock); mlx4_bitmap_free_range()
164 bitmap->last = min(bitmap->last, obj); mlx4_bitmap_free_range()
165 bitmap->top = (bitmap->top + bitmap->max + bitmap->reserved_top) mlx4_bitmap_free_range()
166 & bitmap->mask; mlx4_bitmap_free_range()
168 bitmap_clear(bitmap->table, obj, cnt); mlx4_bitmap_free_range()
169 bitmap->avail += cnt; mlx4_bitmap_free_range()
170 spin_unlock(&bitmap->lock); mlx4_bitmap_free_range()
173 int mlx4_bitmap_init(struct mlx4_bitmap *bitmap, u32 num, u32 mask, mlx4_bitmap_init() argument
180 bitmap->last = 0; mlx4_bitmap_init()
181 bitmap->top = 0; mlx4_bitmap_init()
182 bitmap->max = num - reserved_top; mlx4_bitmap_init()
183 bitmap->mask = mask; mlx4_bitmap_init()
184 bitmap->reserved_top = reserved_top; mlx4_bitmap_init()
185 bitmap->avail = num - reserved_top - reserved_bot; mlx4_bitmap_init()
186 bitmap->effective_len = bitmap->avail; mlx4_bitmap_init()
187 spin_lock_init(&bitmap->lock); mlx4_bitmap_init()
188 bitmap->table = kzalloc(BITS_TO_LONGS(bitmap->max) * mlx4_bitmap_init()
190 if (!bitmap->table) mlx4_bitmap_init()
193 bitmap_set(bitmap->table, 0, reserved_bot); mlx4_bitmap_init()
198 void mlx4_bitmap_cleanup(struct mlx4_bitmap *bitmap) mlx4_bitmap_cleanup() argument
200 kfree(bitmap->table); mlx4_bitmap_cleanup()
218 struct mlx4_bitmap *bitmap; member in struct:mlx4_zone_entry
243 struct mlx4_bitmap *bitmap, mlx4_zone_add_one()
249 u32 mask = mlx4_bitmap_masked_value(bitmap, (u32)-1); mlx4_zone_add_one()
257 zone->bitmap = bitmap; mlx4_zone_add_one()
311 u32 cur_mask = mlx4_bitmap_masked_value(it->bitmap, (u32)-1); __mlx4_zone_remove_one_entry()
347 res = mlx4_bitmap_alloc_range(zone->bitmap, count, __mlx4_alloc_from_zone()
365 res = mlx4_bitmap_alloc_range(it->bitmap, count, __mlx4_alloc_from_zone()
385 res = mlx4_bitmap_alloc_range(it->bitmap, count, __mlx4_alloc_from_zone()
404 res = mlx4_bitmap_alloc_range(curr_node->bitmap, count, __mlx4_alloc_from_zone()
424 mlx4_bitmap_free_range(zone->bitmap, obj - zone->offset, count, zone->use_rr); __mlx4_free_from_zone()
444 struct mlx4_bitmap *bitmap; mlx4_zone_get_bitmap() local
450 bitmap = zone == NULL ? NULL : zone->bitmap; mlx4_zone_get_bitmap()
454 return bitmap; mlx4_zone_get_bitmap()
491 * the bigger bitmap. __mlx4_find_zone_by_uid_unique()
497 if (mobj < zone->bitmap->max) { __mlx4_find_zone_by_uid_unique()
498 u32 curr_dist = zone->bitmap->effective_len; __mlx4_find_zone_by_uid_unique()
242 mlx4_zone_add_one(struct mlx4_zone_allocator *zone_alloc, struct mlx4_bitmap *bitmap, u32 flags, int priority, int offset, u32 *puid) mlx4_zone_add_one() argument
H A Dqp.c506 struct mlx4_bitmap (*bitmap)[MLX4_QP_TABLE_ZONE_NUM] = NULL; mlx4_create_zones()
517 bitmap = kmalloc(sizeof(*bitmap), GFP_KERNEL); mlx4_create_zones()
519 if (NULL == bitmap) { mlx4_create_zones()
524 err = mlx4_bitmap_init(*bitmap + MLX4_QP_TABLE_ZONE_GENERAL, dev->caps.num_qps, mlx4_create_zones()
533 err = mlx4_zone_add_one(qp_table->zones, *bitmap + MLX4_QP_TABLE_ZONE_GENERAL, mlx4_create_zones()
541 err = mlx4_bitmap_init(*bitmap + MLX4_QP_TABLE_ZONE_RSS, mlx4_create_zones()
552 err = mlx4_zone_add_one(qp_table->zones, *bitmap + MLX4_QP_TABLE_ZONE_RSS, mlx4_create_zones()
570 for (k = MLX4_QP_TABLE_ZONE_RSS + 1; k < sizeof(*bitmap)/sizeof((*bitmap)[0]); mlx4_create_zones()
633 *bitmap + MLX4_QP_TABLE_ZONE_RSS, mlx4_create_zones()
644 err = mlx4_bitmap_init(*bitmap + k, roundup_pow_of_two(size), mlx4_create_zones()
648 /* Add an empty bitmap, we'll allocate from different zones (since mlx4_create_zones()
651 err = mlx4_bitmap_init(*bitmap + k, 1, mlx4_create_zones()
654 mlx4_bitmap_alloc_range(*bitmap + k, 1, 1, 0); mlx4_create_zones()
662 err = mlx4_zone_add_one(qp_table->zones, *bitmap + k, mlx4_create_zones()
675 qp_table->bitmap_gen = *bitmap; mlx4_create_zones()
681 mlx4_bitmap_cleanup(*bitmap + k); mlx4_create_zones()
682 kfree(bitmap); mlx4_create_zones()
698 struct mlx4_bitmap *bitmap = mlx4_cleanup_qp_zones() local
703 if (NULL == bitmap) mlx4_cleanup_qp_zones()
706 mlx4_bitmap_cleanup(bitmap); mlx4_cleanup_qp_zones()
H A Dpd.c149 uar->index = mlx4_bitmap_alloc(&mlx4_priv(dev)->uar_table.bitmap); mlx4_uar_alloc()
168 mlx4_bitmap_free(&mlx4_priv(dev)->uar_table.bitmap, uar->index, MLX4_USE_RR); mlx4_uar_free()
186 if (mlx4_bitmap_avail(&priv->uar_table.bitmap) < MLX4_NUM_RESERVED_UARS) { mlx4_bf_alloc()
279 return mlx4_bitmap_init(&mlx4_priv(dev)->uar_table.bitmap, mlx4_init_uar_table()
286 mlx4_bitmap_cleanup(&mlx4_priv(dev)->uar_table.bitmap); mlx4_cleanup_uar_table()
H A Dsrq.c102 *srqn = mlx4_bitmap_alloc(&srq_table->bitmap); __mlx4_srq_alloc_icm()
119 mlx4_bitmap_free(&srq_table->bitmap, *srqn, MLX4_NO_RR); __mlx4_srq_alloc_icm()
147 mlx4_bitmap_free(&srq_table->bitmap, srqn, MLX4_NO_RR); __mlx4_srq_free_icm()
285 err = mlx4_bitmap_init(&srq_table->bitmap, dev->caps.num_srqs, mlx4_init_srq_table()
297 mlx4_bitmap_cleanup(&mlx4_priv(dev)->srq_table.bitmap); mlx4_cleanup_srq_table()
H A Dmlx4.h648 struct mlx4_bitmap bitmap; member in struct:mlx4_uar_table
661 struct mlx4_bitmap bitmap; member in struct:mlx4_cq_table
669 struct mlx4_bitmap bitmap; member in struct:mlx4_eq_table
682 struct mlx4_bitmap bitmap; member in struct:mlx4_srq_table
712 struct mlx4_bitmap bitmap; member in struct:mlx4_mcg_table
903 u32 mlx4_bitmap_alloc(struct mlx4_bitmap *bitmap);
904 void mlx4_bitmap_free(struct mlx4_bitmap *bitmap, u32 obj, int use_rr);
905 u32 mlx4_bitmap_alloc_range(struct mlx4_bitmap *bitmap, int cnt,
907 void mlx4_bitmap_free_range(struct mlx4_bitmap *bitmap, u32 obj, int cnt,
909 u32 mlx4_bitmap_avail(struct mlx4_bitmap *bitmap);
910 int mlx4_bitmap_init(struct mlx4_bitmap *bitmap, u32 num, u32 mask,
912 void mlx4_bitmap_cleanup(struct mlx4_bitmap *bitmap);
1390 /* Attach a mlx4_bitmap <bitmap> of priority <priority> to the zone allocator
1393 * account. The use_rr mlx4_ib parameter for allocating objects from this <bitmap>
1400 struct mlx4_bitmap *bitmap,
1406 /* Remove bitmap indicated by <uid> from <zone_alloc> */
1415 * from the mlx4_bitmap whose uid is <uid>. The bitmap which we actually
H A Dcq.c217 *cqn = mlx4_bitmap_alloc(&cq_table->bitmap); __mlx4_cq_alloc_icm()
234 mlx4_bitmap_free(&cq_table->bitmap, *cqn, MLX4_NO_RR); __mlx4_cq_alloc_icm()
264 mlx4_bitmap_free(&cq_table->bitmap, cqn, MLX4_NO_RR); __mlx4_cq_free_icm()
395 err = mlx4_bitmap_init(&cq_table->bitmap, dev->caps.num_cqs, mlx4_init_cq_table()
408 mlx4_bitmap_cleanup(&mlx4_priv(dev)->cq_table.bitmap); mlx4_cleanup_cq_table()
/linux-4.1.27/drivers/s390/cio/
H A Didset.c7 #include <linux/bitmap.h>
15 unsigned long bitmap[0]; member in struct:idset
31 memset(set->bitmap, 0, bitmap_size(num_ssid, num_id)); idset_new()
43 memset(set->bitmap, 0xff, bitmap_size(set->num_ssid, set->num_id)); idset_fill()
48 set_bit(ssid * set->num_id + id, set->bitmap); idset_add()
53 clear_bit(ssid * set->num_id + id, set->bitmap); idset_del()
58 return test_bit(ssid * set->num_id + id, set->bitmap); idset_contains()
65 bitnum = find_first_bit(set->bitmap, set->num_ssid * set->num_id); idset_get_first()
93 bitmap_clear(set->bitmap, pos, set->num_id - schid.sch_no); idset_sch_del_subseq()
103 return bitmap_empty(set->bitmap, set->num_ssid * set->num_id); idset_is_empty()
110 bitmap_or(to->bitmap, to->bitmap, from->bitmap, len); idset_add_set()
H A Dchp.h32 static inline int chp_test_bit(u8 *bitmap, int num) chp_test_bit() argument
37 return (bitmap[byte] & mask) ? 1 : 0; chp_test_bit()
/linux-4.1.27/arch/alpha/include/asm/
H A Dmmu.h4 /* The alpha MMU context is one "unsigned long" bitmap per CPU */
/linux-4.1.27/fs/hfs/
H A DMakefile7 hfs-objs := bitmap.o bfind.o bnode.o brec.o btree.o \
H A Dbitmap.c2 * linux/fs/hfs/bitmap.c
10 * This file contains the code to modify the volume bitmap:
29 static u32 hfs_find_set_zero_bits(__be32 *bitmap, u32 size, u32 offset, u32 *max) hfs_find_set_zero_bits() argument
40 curr = bitmap + (offset / 32); hfs_find_set_zero_bits()
41 end = bitmap + ((size + 31) / 32); hfs_find_set_zero_bits()
70 start = (curr - bitmap) * 32 + i; hfs_find_set_zero_bits()
108 *max = (curr - bitmap) * 32 + i - start; hfs_find_set_zero_bits()
116 * Search for 'num_bits' consecutive cleared bits in the bitmap blocks of
127 * returned range. If the bitmap is fragmented, this will be less than
141 void *bitmap; hfs_vbm_search_free() local
149 bitmap = HFS_SB(sb)->bitmap; hfs_vbm_search_free()
151 pos = hfs_find_set_zero_bits(bitmap, HFS_SB(sb)->fs_ablocks, goal, num_bits); hfs_vbm_search_free()
154 pos = hfs_find_set_zero_bits(bitmap, goal, 0, num_bits); hfs_vbm_search_free()
174 * Clear the requested bits in the volume bitmap of the hfs filesystem
185 * -2: One or more of the bits are out of range of the bitmap.
189 * Starting with bit number 'start', 'count' bits in the volume bitmap
190 * are cleared. The affected bitmap blocks are marked "dirty", the free
209 /* bitmap is always on a 32-bit boundary */ hfs_clear_vbm_bits()
210 curr = HFS_SB(sb)->bitmap + (start / 32); hfs_clear_vbm_bits()
H A Dmdb.c65 * the B-trees and the volume bitmap.
169 HFS_SB(sb)->bitmap = (__be32 *)__get_free_pages(GFP_KERNEL, PAGE_SIZE < 8192 ? 1 : 0); hfs_mdb_get()
170 if (!HFS_SB(sb)->bitmap) hfs_mdb_get()
173 /* read in the bitmap */ hfs_mdb_get()
177 ptr = (u8 *)HFS_SB(sb)->bitmap; hfs_mdb_get()
181 pr_err("unable to read volume bitmap\n"); hfs_mdb_get()
310 ptr = (u8 *)HFS_SB(sb)->bitmap; hfs_mdb_commit()
314 pr_err("unable to read volume bitmap\n"); hfs_mdb_commit()
363 free_pages((unsigned long)HFS_SB(sb)->bitmap, PAGE_SIZE < 8192 ? 1 : 0); hfs_mdb_put()
H A Dhfs_fs.h108 __be32 *bitmap; /* The page holding the member in struct:hfs_sb_info
109 allocation bitmap */
127 in the bitmap */
172 /* bitmap.c */
/linux-4.1.27/fs/affs/
H A DMakefile9 affs-objs := super.o namei.o inode.o file.o dir.o amigaffs.o bitmap.o symlink.o
H A Dbitmap.c2 * linux/fs/affs/bitmap.c
6 * bitmap.c contains the code that handles all bitmap related stuff -
94 affs_error(sb,"affs_free_block","Cannot read bitmap block %u", bm->bm_key); affs_free_block()
106 * Since we have to byte-swap the bitmap on little-endian
180 /* find an unused block in this bitmap block */ affs_alloc_block()
234 affs_error(sb,"affs_read_block","Cannot read bitmap block %u", bm->bm_key); affs_alloc_block()
283 pr_err("Cannot read bitmap\n"); affs_init_bitmap()
293 pr_debug("read bitmap block %d: %d\n", blk, bm->bm_key); affs_init_bitmap()
305 pr_err("Cannot read bitmap extension\n"); affs_init_bitmap()
333 /* correct offset for the bitmap count below */ affs_init_bitmap()
342 /* recalculate bitmap count for last block */ affs_init_bitmap()
H A Daffs.h94 struct mutex s_bmlock; /* Protects bitmap access. */
96 u32 s_bmap_count; /* # of bitmap blocks. */
97 u32 s_bmap_bits; /* # of bits in one bitmap blocks */
155 /* bitmap. c */
/linux-4.1.27/arch/powerpc/sysdev/
H A Dmsi_bitmap.c13 #include <linux/bitmap.h>
24 offset = bitmap_find_next_zero_area(bmp->bitmap, bmp->irq_count, 0, msi_bitmap_alloc_hwirqs()
29 bitmap_set(bmp->bitmap, offset, num); msi_bitmap_alloc_hwirqs()
50 bitmap_clear(bmp->bitmap, offset, num); msi_bitmap_free_hwirqs()
62 bitmap_allocate_region(bmp->bitmap, hwirq, 0); msi_bitmap_reserve_hwirq()
68 * @bmp: pointer to the MSI bitmap.
72 * are reserved in the bitmap.
98 bitmap_allocate_region(bmp->bitmap, 0, get_count_order(bmp->irq_count)); msi_bitmap_reserve_dt_hwirqs()
106 bitmap_release_region(bmp->bitmap, *p + j, 0); msi_bitmap_reserve_dt_hwirqs()
123 pr_debug("msi_bitmap: allocator bitmap size is 0x%x bytes\n", size); msi_bitmap_alloc()
125 bmp->bitmap = zalloc_maybe_bootmem(size, GFP_KERNEL); msi_bitmap_alloc()
126 if (!bmp->bitmap) { msi_bitmap_alloc()
127 pr_debug("msi_bitmap: ENOMEM allocating allocator bitmap!\n"); msi_bitmap_alloc()
131 /* We zalloc'ed the bitmap, so all irqs are free by default */ msi_bitmap_alloc()
141 /* we can't free the bitmap we don't know if it's bootmem etc. */ msi_bitmap_free()
143 bmp->bitmap = NULL; msi_bitmap_free()
153 /* Can't allocate a bitmap of 0 irqs */ test_basics()
160 WARN_ON(bitmap_find_free_region(bmp.bitmap, size, get_count_order(size))); test_basics()
161 bitmap_release_region(bmp.bitmap, 0, get_count_order(size)); test_basics()
167 WARN_ON(bitmap_find_free_region(bmp.bitmap, size, get_count_order(size))); test_basics()
168 bitmap_release_region(bmp.bitmap, 0, get_count_order(size)); test_basics()
177 WARN_ON(bitmap_find_free_region(bmp.bitmap, size, 0) >= 0); test_basics()
204 /* Clients may WARN_ON bitmap == NULL for "not-allocated" */ test_basics()
205 WARN_ON(bmp.bitmap != NULL); test_basics()
207 kfree(bmp.bitmap); test_basics()
233 WARN_ON(bitmap_find_free_region(bmp.bitmap, size, get_count_order(size))); test_of_node()
234 bitmap_release_region(bmp.bitmap, 0, get_count_order(size)); test_of_node()
251 WARN_ON(!bitmap_equal(expected, bmp.bitmap, size)); test_of_node()
254 kfree(bmp.bitmap); test_of_node()
259 printk(KERN_DEBUG "Running MSI bitmap self-tests ...\n"); msi_bitmap_selftest()
H A Dppc4xx_msi.c54 struct msi_bitmap bitmap; member in struct:ppc4xx_msi
65 err = msi_bitmap_alloc(&msi_data->bitmap, msi_irqs, ppc4xx_msi_init_allocator()
70 err = msi_bitmap_reserve_dt_hwirqs(&msi_data->bitmap); ppc4xx_msi_init_allocator()
72 msi_bitmap_free(&msi_data->bitmap); ppc4xx_msi_init_allocator()
97 int_no = msi_bitmap_alloc_hwirqs(&msi_data->bitmap, 1); ppc4xx_setup_msi_irqs()
107 msi_bitmap_free_hwirqs(&msi_data->bitmap, int_no, 1); ppc4xx_setup_msi_irqs()
137 msi_bitmap_free_hwirqs(&msi_data->bitmap, hwirq, 1); ppc4xx_teardown_msi_irqs()
208 if (msi->bitmap.bitmap) ppc4xx_of_msi_remove()
209 msi_bitmap_free(&msi->bitmap); ppc4xx_of_msi_remove()
249 dev_err(&dev->dev, "Error allocating MSI bitmap\n"); ppc4xx_msi_probe()
H A Dfsl_msi.h46 struct msi_bitmap bitmap; member in struct:fsl_msi
H A Dmpic_msi.c12 #include <linux/bitmap.h>
25 if (!mpic->msi_bitmap.bitmap) mpic_msi_reserve_hwirq()
H A Dfsl_msi.c112 rc = msi_bitmap_alloc(&msi_data->bitmap, NR_MSI_IRQS_MAX, fsl_msi_init_allocator()
122 msi_bitmap_reserve_hwirq(&msi_data->bitmap, hwirq); fsl_msi_init_allocator()
140 msi_bitmap_free_hwirqs(&msi_data->bitmap, hwirq, 1); fsl_teardown_msi_irqs()
240 hwirq = msi_bitmap_alloc_hwirqs(&msi_data->bitmap, 1); fsl_setup_msi_irqs()
255 msi_bitmap_free_hwirqs(&msi_data->bitmap, hwirq, 1); fsl_setup_msi_irqs()
347 if (msi->bitmap.bitmap) fsl_of_msi_remove()
348 msi_bitmap_free(&msi->bitmap); fsl_of_msi_remove()
392 msi_bitmap_free_hwirqs(&msi->bitmap, fsl_msi_setup_hwirq()
481 dev_err(&dev->dev, "Error allocating MSI bitmap\n"); fsl_of_msi_probe()
/linux-4.1.27/fs/reiserfs/
H A Dresize.c23 struct reiserfs_bitmap_info *bitmap; reiserfs_resize() local
63 ("reiserfs_resize: unable to resize a reiserfs without distributed bitmap (fs version < 3.5.12)\n"); reiserfs_resize()
67 /* count used bits in last bitmap block */ reiserfs_resize()
71 /* count bitmap blocks in new fs */ reiserfs_resize()
93 * the bitmap node pointers from the old journal bitmap reiserfs_resize()
119 * allocate additional bitmap blocks, reallocate reiserfs_resize()
120 * array of bitmap block pointers reiserfs_resize()
122 bitmap = reiserfs_resize()
124 if (!bitmap) { reiserfs_resize()
133 bitmap[i] = old_bitmap[i]; reiserfs_resize()
145 * the uninitialized bitmap reiserfs_resize()
151 vfree(bitmap); reiserfs_resize()
156 reiserfs_cache_bitmap_metadata(s, bh, bitmap + i); reiserfs_resize()
164 bitmap[i].free_count = sb_blocksize(sb) * 8 - 1; reiserfs_resize()
167 /* free old bitmap blocks array */ reiserfs_resize()
168 SB_AP_BITMAP(s) = bitmap; reiserfs_resize()
181 /* Extend old last bitmap block - new blocks have been made available */ reiserfs_resize()
199 /* Correct new last bitmap block - It may not be full */ reiserfs_resize()
H A Dbitmap.c4 /* Reiserfs block (de)allocator, bitmap-based. */
54 * It is in the bitmap block number equal to the block get_bit_address()
58 /* Within that bitmap block it is located at bit offset *offset. */ get_bit_address()
85 reiserfs_error(s, "vs-4019", "bitmap block %lu(%u) " is_reusable()
92 reiserfs_error(s, "vs-4020", "bitmap block %lu(%u) " is_reusable()
100 reiserfs_error(s, "vs-4030", "bitmap for requested block " is_reusable()
141 * lengths in one bitmap block
159 reiserfs_error(s, "jdm-4055", "NULL bitmap info pointer " scan_bitmap_block()
160 "for bitmap %d", bmap_n); scan_bitmap_block()
172 return 0; /* No free blocks in this bitmap */ scan_bitmap_block()
180 * search for a zero bit fails or the rest of bitmap block scan_bitmap_block()
305 * If we don't have cached information on this bitmap block, we're block_group_used()
345 * bitmap and place new blocks there. Returns number of allocated blocks.
372 * When the bitmap is more than 10% free, anyone can allocate. scan_bitmap()
374 * bitmap are allowed. Once we pass 80% full, this restriction scan_bitmap()
479 reiserfs_error(th->t_super, "bitmap-4072", reiserfs_free_block()
788 * Relocation based on dirid, hashing them into a given bitmap block
814 * Relocation based on oid, hashing them into a given bitmap block
1393 reiserfs_error(sb, "reiserfs-2025", "bitmap block %lu is " reiserfs_cache_bitmap_metadata()
1408 unsigned int bitmap) reiserfs_read_bitmap_block()
1410 b_blocknr_t block = (sb->s_blocksize << 3) * bitmap; reiserfs_read_bitmap_block()
1411 struct reiserfs_bitmap_info *info = SB_AP_BITMAP(sb) + bitmap; reiserfs_read_bitmap_block()
1420 block = REISERFS_SB(sb)->s_sbh->b_blocknr + 1 + bitmap; reiserfs_read_bitmap_block()
1421 else if (bitmap == 0) reiserfs_read_bitmap_block()
1426 reiserfs_warning(sb, "sh-2029: %s: bitmap block (#%u) " reiserfs_read_bitmap_block()
1448 struct reiserfs_bitmap_info *bitmap; reiserfs_init_bitmap_cache() local
1451 bitmap = vmalloc(sizeof(*bitmap) * bmap_nr); reiserfs_init_bitmap_cache()
1452 if (bitmap == NULL) reiserfs_init_bitmap_cache()
1455 memset(bitmap, 0xff, sizeof(*bitmap) * bmap_nr); reiserfs_init_bitmap_cache()
1457 SB_AP_BITMAP(sb) = bitmap; reiserfs_init_bitmap_cache()
1407 reiserfs_read_bitmap_block(struct super_block *sb, unsigned int bitmap) reiserfs_read_bitmap_block() argument
H A DMakefile7 reiserfs-objs := bitmap.o do_balan.o namei.o inode.o file.o dir.o fix_node.o \
/linux-4.1.27/fs/ntfs/
H A Dbitmap.h2 * bitmap.h - Defines for NTFS kernel bitmap handling. Part of the Linux-NTFS
36 * ntfs_bitmap_set_bits_in_run - set a run of bits in a bitmap to a value
37 * @vi: vfs inode describing the bitmap
42 * Set @count bits starting at bit @start_bit in the bitmap described by the
55 * ntfs_bitmap_set_run - set a run of bits in a bitmap
56 * @vi: vfs inode describing the bitmap
60 * Set @count bits starting at bit @start_bit in the bitmap described by the
72 * ntfs_bitmap_clear_run - clear a run of bits in a bitmap
73 * @vi: vfs inode describing the bitmap
77 * Clear @count bits starting at bit @start_bit in the bitmap described by the
89 * ntfs_bitmap_set_bit - set a bit in a bitmap
90 * @vi: vfs inode describing the bitmap
93 * Set bit @bit in the bitmap described by the vfs inode @vi.
103 * ntfs_bitmap_clear_bit - clear a bit in a bitmap
104 * @vi: vfs inode describing the bitmap
107 * Clear bit @bit in the bitmap described by the vfs inode @vi.
H A DMakefile9 ntfs-$(CONFIG_NTFS_RW) += bitmap.o lcnalloc.o logfile.o quota.o usnjrnl.o
H A Dbitmap.c2 * bitmap.c - NTFS kernel bitmap handling. Part of the Linux-NTFS project.
26 #include "bitmap.h"
32 * __ntfs_bitmap_set_bits_in_run - set a run of bits in a bitmap to a value
33 * @vi: vfs inode describing the bitmap
39 * Set @count bits starting at bit @start_bit in the bitmap described by the
H A Dlcnalloc.h98 * - The volume lcn bitmap must be unlocked on entry and is unlocked
100 * - This function takes the volume lcn bitmap lock for writing and
101 * modifies the bitmap contents.
127 * Locking: - This function takes the volume lcn bitmap lock for writing and
128 * modifies the bitmap contents.
H A Dmft.c29 #include "bitmap.h"
1117 * Search for a free mft record in the mft bitmap attribute on the ntfs volume
1127 * initialized mft bitmap.
1143 "initialized mft bitmap."); ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1147 * bitmap. ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1173 ntfs_debug("Starting bitmap search: pass %u, pass_start 0x%llx, " ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1196 "bitmap, aborting."); ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1235 * continue searching the mft bitmap for a zero bit. ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1255 /* No free mft records in currently initialized mft bitmap. */ ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1257 "mft bitmap.)"); ntfs_mft_bitmap_find_and_alloc_free_rec_nolock()
1262 * ntfs_mft_bitmap_extend_allocation_nolock - extend mft bitmap by a cluster
1263 * @vol: volume on which to extend the mft bitmap attribute
1265 * Extend the mft bitmap attribute on the ntfs volume @vol by one cluster.
1298 ntfs_debug("Extending mft bitmap allocation."); ntfs_mft_bitmap_extend_allocation_nolock()
1302 * Determine the last lcn of the mft bitmap. The allocated size of the ntfs_mft_bitmap_extend_allocation_nolock()
1303 * mft bitmap cannot be zero so we are ok to do this. ntfs_mft_bitmap_extend_allocation_nolock()
1314 "cluster of mft bitmap attribute."); ntfs_mft_bitmap_extend_allocation_nolock()
1322 ntfs_debug("Last lcn of mft bitmap attribute is 0x%llx.", ntfs_mft_bitmap_extend_allocation_nolock()
1334 ntfs_error(vol->sb, "Failed to read from lcn bitmap."); ntfs_mft_bitmap_extend_allocation_nolock()
1347 /* Update the mft bitmap runlist. */ ntfs_mft_bitmap_extend_allocation_nolock()
1351 ntfs_debug("Appending one cluster to mft bitmap."); ntfs_mft_bitmap_extend_allocation_nolock()
1361 "the mft bitmap."); ntfs_mft_bitmap_extend_allocation_nolock()
1368 "bitmap."); ntfs_mft_bitmap_extend_allocation_nolock()
1379 ntfs_debug("Adding one run to mft bitmap."); ntfs_mft_bitmap_extend_allocation_nolock()
1386 * (non-terminator) runlist element of mft bitmap. ntfs_mft_bitmap_extend_allocation_nolock()
1405 "mft bitmap attribute."); ntfs_mft_bitmap_extend_allocation_nolock()
1412 /* Search back for the previous last allocated cluster of mft bitmap. */ ntfs_mft_bitmap_extend_allocation_nolock()
1423 "mft bitmap attribute extent."); ntfs_mft_bitmap_extend_allocation_nolock()
1436 "record for mft bitmap attribute."); ntfs_mft_bitmap_extend_allocation_nolock()
1445 "accommodate extended mft bitmap attribute " ntfs_mft_bitmap_extend_allocation_nolock()
1457 "mft bitmap attribute."); ntfs_mft_bitmap_extend_allocation_nolock()
1463 * We now have extended the mft bitmap allocated_size by one cluster. ntfs_mft_bitmap_extend_allocation_nolock()
1479 "extent of mft bitmap attribute."); ntfs_mft_bitmap_extend_allocation_nolock()
1503 "mft bitmap attribute.%s", es); ntfs_mft_bitmap_extend_allocation_nolock()
1565 * @vol: volume on which to extend the mft bitmap attribute
1567 * Extend the initialized portion of the mft bitmap attribute on the ntfs
1588 ntfs_debug("Extending mft bitmap initiailized (and data) size."); ntfs_mft_bitmap_extend_initialized_nolock()
1608 "mft bitmap attribute."); ntfs_mft_bitmap_extend_initialized_nolock()
1619 * with zeroes because the caller is holding the mft bitmap lock for ntfs_mft_bitmap_extend_initialized_nolock()
1636 /* Initialize the mft bitmap attribute value with zeroes. */ ntfs_mft_bitmap_extend_initialized_nolock()
1640 "bitmap."); ntfs_mft_bitmap_extend_initialized_nolock()
1643 ntfs_error(vol->sb, "Failed to write to mft bitmap."); ntfs_mft_bitmap_extend_initialized_nolock()
1660 "mft bitmap attribute.%s", es); ntfs_mft_bitmap_extend_initialized_nolock()
1844 /* Search back for the previous last allocated cluster of mft bitmap. */ ntfs_mft_data_extend_allocation_nolock()
2182 * To find a free mft record, we scan the mft bitmap for a zero bit. To
2196 * When scanning the mft bitmap, we only search up to the last allocated mft
2211 * If during any stage we overflow the initialized data in the mft bitmap, we
2213 * cluster if required. The bitmap data size has to be at least equal to the
2218 * - initialized / extended the mft bitmap if necessary,
2221 * mft bitmap,
2238 * rule because the bitmap is not essential for finding the mft records, but on
2239 * the other hand, handling the bitmap in this special way would make life
2241 * when reading the bitmap.
2290 * No free mft records left. If the mft bitmap already covers more ntfs_mft_record_alloc()
2293 * Note: We also have to make sure that the mft bitmap at least covers ntfs_mft_record_alloc()
2314 * The mft bitmap needs to be expanded until it covers the first unused ntfs_mft_record_alloc()
2330 /* Need to extend bitmap by one more cluster. */ ntfs_mft_record_alloc()
2370 /* @bit is the found free mft record, allocate it in the mft bitmap. */ ntfs_mft_record_alloc()
2374 ntfs_error(vol->sb, "Failed to allocate bit in mft bitmap."); ntfs_mft_record_alloc()
2378 ntfs_debug("Set bit 0x%llx in mft bitmap.", (long long)bit); ntfs_mft_record_alloc()
2381 * The mft bitmap is now uptodate. Deal with mft data attribute now. ntfs_mft_record_alloc()
2382 * Note, we keep hold of the mft bitmap lock for writing until all ntfs_mft_record_alloc()
2384 * will impact decisions for mft bitmap and mft record allocation done ntfs_mft_record_alloc()
2505 * We can finally drop the mft bitmap lock as the mft data attribute ntfs_mft_record_alloc()
2508 * set bit in the mft bitmap but this is actually not a problem since ntfs_mft_record_alloc()
2510 * that it is allocated in the mft bitmap means that no-one will try to ntfs_mft_record_alloc()
2538 "free in mft bitmap but is marked " ntfs_mft_record_alloc()
2750 ntfs_error(vol->sb, "Failed to clear bit in mft bitmap.%s", es); ntfs_mft_record_alloc()
2880 * the mft bitmap. Just emit a warning and leave the volume ntfs_extent_mft_record_free()
2883 ntfs_error(vol->sb, "Failed to clear bit in mft bitmap.%s", es); ntfs_extent_mft_record_free()
H A Dlcnalloc.c28 #include "bitmap.h"
47 * Locking: - The volume lcn bitmap must be locked for writing on entry and is
110 * mft bitmap attribute.
114 * access to the lcn bitmap in portions of up to 8192 bytes at a time, so we
141 * Locking: - The volume lcn bitmap must be unlocked on entry and is unlocked
143 * - This function takes the volume lcn bitmap lock for writing and
144 * modifies the bitmap contents.
247 * bmp_pos is the current bit position inside the bitmap. We use ntfs_cluster_alloc()
357 /* Allocate the bitmap bit. */ ntfs_cluster_alloc()
359 /* We need to write this bitmap page to disk. */ ntfs_cluster_alloc()
840 * - The volume lcn bitmap must be unlocked on entry and is unlocked
842 * - This function takes the volume lcn bitmap lock for writing and
843 * modifies the bitmap contents.
869 * Lock the lcn bitmap for writing but only if not rolling back. We __ntfs_cluster_free()
H A Dvolume.h70 bits in lcn bitmap. */
100 mft record bitmap ($MFT/$BITMAP). */
110 cluster bitmap ($Bitmap/$DATA). */
/linux-4.1.27/fs/hfsplus/
H A DMakefile8 bnode.o brec.o bfind.o tables.o unicode.o wrapper.o bitmap.o part_tbl.o \
H A Dbitmap.c2 * linux/fs/hfsplus/bitmap.c
92 hfs_dbg(BITMAP, "bitmap full\n"); hfsplus_block_allocate()
99 hfs_dbg(BITMAP, "bitmap full\n"); hfsplus_block_allocate()
/linux-4.1.27/fs/ext3/
H A DMakefile7 ext3-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \
H A Dbitmap.c2 * linux/fs/ext3/bitmap.c
H A Dballoc.c24 * blocks groups. Each group contains 1 bitmap block for blocks, 1 bitmap
28 * super block. Each descriptor contains the number of the bitmap block and
105 /* check whether block bitmap block number is set */ ext3_valid_block_bitmap()
109 /* bad block bitmap */ ext3_valid_block_bitmap()
112 /* check whether the inode bitmap block number is set */ ext3_valid_block_bitmap()
116 /* bad block bitmap */ ext3_valid_block_bitmap()
126 /* good bitmap for inode tables */ ext3_valid_block_bitmap()
131 "Invalid block bitmap - " ext3_valid_block_bitmap()
142 * Read the bitmap for a given block_group,and validate the
162 "Cannot read block bitmap - " read_block_bitmap()
173 "Cannot read block bitmap - " read_block_bitmap()
181 * bitmap read_block_bitmap()
556 * We are about to start releasing blocks in the bitmap, ext3_free_blocks_sb()
590 "No committed data in bitmap"); ext3_free_blocks_sb()
591 BUFFER_TRACE2(debug_bh, bitmap_bh, "bitmap"); ext3_free_blocks_sb()
616 * bitmap, because we know that there is no outstanding ext3_free_blocks_sb()
627 * We clear the bit in the bitmap after setting the committed ext3_free_blocks_sb()
651 /* We dirtied the bitmap block */ ext3_free_blocks_sb()
652 BUFFER_TRACE(bitmap_bh, "dirtied bitmap block"); ext3_free_blocks_sb()
696 * @bh: bufferhead contains the bitmap of the given block group
699 * allocated in the bitmap buffer's "last committed data" copy. This
733 * @bh: bufferhead contains the block group bitmap
736 * The bitmap search --- search forward alternately through the actual
737 * bitmap on disk and the last-committed copy in journal, until we find a
765 * allocatable block in bitmap.
766 * @bh: bufferhead contains the block group bitmap
769 * Find an allocatable block in a bitmap. We honor both the bitmap and
772 * the initial goal; then for a free byte somewhere in the bitmap; then
773 * for any free bit in the bitmap.
812 * The bitmap search --- search forward alternately through the actual find_next_usable_block()
813 * bitmap and the last-committed copy until we find a bit free in find_next_usable_block()
824 * @bh: the buffer_head contains the block group bitmap
826 * We think we can allocate this block in this bitmap. Try to set the bit.
829 * allocated and freed then clear the bit in the bitmap again and return
856 * @bitmap_bh: bufferhead holds the block bitmap
862 * first, then find the first free bit(s) from the bitmap (within the range),
872 * new bitmap. In that case we must release write access to the old one via
1060 * disk bitmap later and then, if there are free blocks then we adjust find_next_reservable_window()
1084 * there, we check the bitmap for the first free block after
1109 * @bitmap_bh: the block group block bitmap
1181 * need to check the bitmap after we found a reservable window. alloc_new_reservation()
1200 * searching the first free bit on the block bitmap and copy of alloc_new_reservation()
1201 * last committed bitmap alternatively, until we found a allocatable alloc_new_reservation()
1212 * no free block left on the bitmap, no point alloc_new_reservation()
1290 * @bitmap_bh: bufferhead holds the block bitmap
1301 * looking for a free bit on bitmap first, then look up the reservation list to
1329 * Make sure we use undo access for the bitmap, because it is critical ext3_try_to_allocate_with_rsv()
1330 * that we do the frozen_data COW on bitmap buffers in all cases even ext3_try_to_allocate_with_rsv()
1415 "bitmap block"); ext3_try_to_allocate_with_rsv()
1602 * skip this group (and avoid loading bitmap) if there ext3_new_blocks()
1682 /* Record bitmap buffer state in the newly allocated block */ ext3_new_blocks()
1686 BUFFER_TRACE2(debug_bh, bitmap_bh, "bitmap state"); ext3_new_blocks()
1914 * ext3_trim_all_free walks through group's block bitmap searching for free
1918 * the extent in the block bitmap. This is done until whole group is scanned.
1934 * We will update one block bitmap, and one group descriptor ext3_trim_all_free()
1974 * block bitmap ext3_trim_all_free()
2009 * Clear bits in the bitmap ext3_trim_all_free()
2050 /* We dirtied the bitmap block */ ext3_trim_all_free()
2051 BUFFER_TRACE(bitmap_bh, "dirtied bitmap block"); ext3_trim_all_free()
H A Dresize.c66 "Block bitmap not in group (block %u)", verify_group_input()
70 "Inode bitmap not in group (block %u)", verify_group_input()
79 "Block bitmap same as inode bitmap (%u)", verify_group_input()
83 "Block bitmap (%u) in inode table (%u-"E3FSBLK")", verify_group_input()
87 "Inode bitmap (%u) in inode table (%u-"E3FSBLK")", verify_group_input()
91 "Block bitmap (%u) in GDT table" verify_group_input()
96 "Inode bitmap (%u) in GDT table" verify_group_input()
137 * We can use memset for the rest of the bitmap as there are no other users.
139 static void mark_bitmap_end(int start_bit, int end_bit, char *bitmap) mark_bitmap_end() argument
148 ext3_set_bit(i, bitmap); mark_bitmap_end()
150 memset(bitmap + (i >> 3), 0xff, (end_bit - i) >> 3); mark_bitmap_end()
281 ext3_debug("mark block bitmap %#04x (+%ld)\n", input->block_bitmap, setup_new_group_blocks()
284 ext3_debug("mark inode bitmap %#04x (+%ld)\n", input->inode_bitmap, setup_new_group_blocks()
323 /* Mark unused entries in inode bitmap used */ setup_new_group_blocks()
324 ext3_debug("clear inode bitmap %#04x (+%ld)\n", setup_new_group_blocks()
1066 /* We will update the superblock, one block bitmap, and ext3_group_extend()
H A Dialloc.c28 * blocks groups. Each group contains 1 bitmap block for blocks, 1 bitmap
32 * super block. Each descriptor contains the number of the bitmap block and
38 * Read the inode allocation bitmap for a given block_group, reading
39 * into the specified slot in the superblock's bitmap cache.
41 * Return buffer_head of bitmap on success or NULL.
56 "Cannot read inode bitmap - " read_inode_bitmap()
502 * Likely a bitmap corruption causing inode to be allocated ext3_new_inode()
591 "inode bitmap error for orphan %lu", ino); ext3_orphan_get()
/linux-4.1.27/fs/ocfs2/
H A Dreservations.h55 * bitmap is provided. */
85 * ocfs2_resmap_init() - Initialize fields of a reservations bitmap
89 * @max_bitmap_bytes: Maximum size of the bitmap (typically blocksize)
92 * allocation mirror bitmap.
98 * ocfs2_resmap_restart() - "restart" a reservation bitmap
99 * @resmap: reservations bitmap
100 * @clen: Number of valid bits in the bitmap
101 * @disk_bitmap: the disk bitmap this resmap should refer to.
103 * Re-initialize the parameters of a reservation bitmap. This is
108 * reservations based on the new bitmap.
114 * ocfs2_resmap_uninit() - uninitialize a reservation bitmap structure
121 * @resmap: reservations bitmap
142 * @resmap: reservations bitmap
143 * @resv: optional reservation to recalulate based on new bitmap
151 * reservations bitmap. If resv is passed, it's next allocation window will be
H A Dlocalalloc.c253 * file. Otherwise, it has to go to the main bitmap.
272 * allocation to take up to half the bitmap. */ ocfs2_alloc_should_use_local()
372 * return any unused bits to the bitmap and write out a clean
483 * We want to free the bitmap bits outside of any recovery context as
557 * main bitmap.
592 /* we want the bitmap change to be recorded on disk asap */ ocfs2_complete_local_alloc_recovery()
737 void *bitmap; ocfs2_claim_local_alloc_bits() local
756 bitmap = la->la_bitmap; ocfs2_claim_local_alloc_bits()
773 ocfs2_set_bit(start++, bitmap); ocfs2_claim_local_alloc_bits()
793 void *bitmap; ocfs2_free_local_alloc_bits() local
803 bitmap = la->la_bitmap; ocfs2_free_local_alloc_bits()
817 ocfs2_clear_bit(start++, bitmap); ocfs2_free_local_alloc_bits()
845 void *bitmap = NULL; ocfs2_local_alloc_find_clear_bits() local
877 bitmap = OCFS2_LOCAL_ALLOC(alloc)->la_bitmap; ocfs2_local_alloc_find_clear_bits()
882 while ((bitoff = ocfs2_find_next_zero_bit(bitmap, left, startoff)) != -1) { ocfs2_local_alloc_find_clear_bits()
940 static void ocfs2_verify_zero_bits(unsigned long *bitmap,
946 if (ocfs2_test_bit(start + tmp, bitmap)) {
958 * sync the local alloc to main bitmap.
960 * assumes you've already locked the main bitmap -- the bitmap inode
973 void *bitmap; ocfs2_sync_local_to_main() local
991 bitmap = la->la_bitmap; ocfs2_sync_local_to_main()
995 while ((bit_off = ocfs2_find_next_zero_bit(bitmap, left, start)) ocfs2_sync_local_to_main()
1035 OCFS2_LA_EVENT_FRAGMENTED, /* The global bitmap has
1040 OCFS2_LA_EVENT_ENOSPC, /* Global bitmap doesn't have
1074 * bitmap. Drastically reduce the number of bits used ocfs2_recalc_la_window()
1083 * reason to assume the bitmap situation might ocfs2_recalc_la_window()
1099 * risk bouncing around the global bitmap during periods of ocfs2_recalc_la_window()
1160 * pass it the bitmap lock in lock_bh if you have it.
1229 * set all previously used bits in bitmap and update ocfs2_local_alloc_new_window()
1230 * la_bits_set before setting the bits in the main bitmap. */ ocfs2_local_alloc_new_window()
1263 /* This will lock the main bitmap for us. */ ocfs2_local_alloc_slide_window()
1286 * local alloc shutdown won't try to double free main bitmap ocfs2_local_alloc_slide_window()
H A Docfs2.h856 static inline void _ocfs2_set_bit(unsigned int bit, unsigned long *bitmap) _ocfs2_set_bit() argument
858 __set_bit_le(bit, bitmap); _ocfs2_set_bit()
862 static inline void _ocfs2_clear_bit(unsigned int bit, unsigned long *bitmap) _ocfs2_clear_bit() argument
864 __clear_bit_le(bit, bitmap); _ocfs2_clear_bit()
886 static inline void ocfs2_set_bit_unaligned(int bit, void *bitmap) ocfs2_set_bit_unaligned() argument
888 bitmap = correct_addr_and_bit_unaligned(&bit, bitmap); ocfs2_set_bit_unaligned()
889 ocfs2_set_bit(bit, bitmap); ocfs2_set_bit_unaligned()
892 static inline void ocfs2_clear_bit_unaligned(int bit, void *bitmap) ocfs2_clear_bit_unaligned() argument
894 bitmap = correct_addr_and_bit_unaligned(&bit, bitmap); ocfs2_clear_bit_unaligned()
895 ocfs2_clear_bit(bit, bitmap); ocfs2_clear_bit_unaligned()
898 static inline int ocfs2_test_bit_unaligned(int bit, void *bitmap) ocfs2_test_bit_unaligned() argument
900 bitmap = correct_addr_and_bit_unaligned(&bit, bitmap); ocfs2_test_bit_unaligned()
901 return ocfs2_test_bit(bit, bitmap); ocfs2_test_bit_unaligned()
904 static inline int ocfs2_find_next_zero_bit_unaligned(void *bitmap, int max, ocfs2_find_next_zero_bit_unaligned() argument
908 bitmap = correct_addr_and_bit_unaligned(&fix, bitmap); ocfs2_find_next_zero_bit_unaligned()
912 ret = ocfs2_find_next_zero_bit(bitmap, tmpmax, start) - fix; ocfs2_find_next_zero_bit_unaligned()
H A Dreservations.c174 mlog(ML_ERROR, "reservation %d extends past bitmap!\n", ocfs2_check_resmap()
399 * We are given a range within the bitmap, which corresponds to a gap
401 * can be anything from the whole bitmap, to a gap between
406 * This function searches the bitmap range starting at search_start
421 void *bitmap = resmap->m_disk_bitmap; ocfs2_resmap_find_free_bits() local
431 while ((offset = ocfs2_find_next_zero_bit(bitmap, resmap->m_bitmap_len, ocfs2_resmap_find_free_bits()
487 * - need to make sure we don't go past end of bitmap __ocfs2_resv_find_window()
586 * window and the end of the bitmap will work. __ocfs2_resv_find_window()
749 * through and test the bitmap . This avoids some ocfs2_resmap_resv_bits()
/linux-4.1.27/arch/x86/kernel/
H A Dioport.c2 * This contains the io-permission bitmap code - written by obz, with changes
17 #include <linux/bitmap.h>
21 * this changes the io permissions bitmap in the current task.
36 * IO bitmap up. ioperm() is much less timing critical than clone(), sys_ioperm()
40 unsigned long *bitmap = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL); sys_ioperm() local
42 if (!bitmap) sys_ioperm()
45 memset(bitmap, 0xff, IO_BITMAP_BYTES); sys_ioperm()
46 t->io_bitmap_ptr = bitmap; sys_ioperm()
54 * because the ->io_bitmap_max value must match the bitmap sys_ioperm()
H A Dtce_64.c110 * number of bytes needed for the bitmap size in number of tce_table_setparms()
116 printk(KERN_ERR "Calgary: cannot allocate bitmap\n"); tce_table_setparms()
/linux-4.1.27/include/linux/
H A Disicom.h61 /* isi kill queue bitmap */
66 /* isi_board status bitmap */
72 /* isi_port status bitmap */
H A Dbitmap.h13 * longs. The bitmap interface and available operations are listed
14 * here, in bitmap.h
17 * lib/bitmap.c. Functions implementations that are architecture
21 * See lib/bitmap.c for more details.
25 * The available bitmap operations and their rough meaning in the
26 * case that the bitmap is a single unsigned long are thus:
55 * bitmap_parse(buf, buflen, dst, nbits) Parse bitmap dst from kernel buf
56 * bitmap_parse_user(ubuf, ulen, dst, nbits) Parse bitmap dst from user buf
57 * bitmap_parselist(buf, dst, nbits) Parse bitmap dst from kernel buf
58 * bitmap_parselist_user(buf, dst, nbits) Parse bitmap dst from user buf
59 * bitmap_find_free_region(bitmap, bits, order) Find and allocate bit region
60 * bitmap_release_region(bitmap, pos, order) Free specified bit region
61 * bitmap_allocate_region(bitmap, pos, order) Allocate specified bit region
87 * lib/bitmap.c provides these functions:
90 extern int __bitmap_empty(const unsigned long *bitmap, unsigned int nbits);
91 extern int __bitmap_full(const unsigned long *bitmap, unsigned int nbits);
112 extern int __bitmap_weight(const unsigned long *bitmap, unsigned int nbits);
127 * @size: The bitmap size in bits
163 extern int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order);
164 extern void bitmap_release_region(unsigned long *bitmap, unsigned int pos, int order);
165 extern int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order);
171 extern unsigned int bitmap_ord_to_pos(const unsigned long *bitmap, unsigned int ord, unsigned int nbits);
H A Dlru_cache.h61 (coarse or fine grained) bitmap, or other meta data.
66 bitmap, trading frequency of meta data transactions against amount of
79 Tracking those blocks can be implemented as "dirty bitmap".
88 The on-disk "dirty bitmap" may be re-used as "write-intent" bitmap as well.
89 To reduce the frequency of bitmap updates for write-intent log purposes,
91 on-disk bitmap, while keeping the in-memory "dirty" bitmap as clean as
96 "Explicit (coarse) write intent bitmap"
97 An other implementation could chose a (probably coarse) explicit bitmap,
98 for write-intent log purposes, additionally to the fine grained dirty bitmap.
125 does not give much benefit over the "dirty chunks of bitmap" approach, other
130 the bitmap into one transaction to the activity log ring buffer.
H A Dgenalloc.h40 * @map: Pointer to bitmap
41 * @size: The bitmap size in bits
73 unsigned long bits[0]; /* bitmap for allocating memory chunk */
85 * @nid: node id of the node the chunk structure and bitmap should be
H A Dinput.h45 * @propbit: bitmap of device properties and quirks
46 * @evbit: bitmap of types of events supported by the device (EV_KEY,
48 * @keybit: bitmap of keys/buttons this device has
49 * @relbit: bitmap of relative axes for the device
50 * @absbit: bitmap of absolute axes for the device
51 * @mscbit: bitmap of miscellaneous events supported by the device
52 * @ledbit: bitmap of leds present on the device
53 * @sndbit: bitmap of sound effects supported by the device
54 * @ffbit: bitmap of force feedback effects supported by the device
55 * @swbit: bitmap of switches present on the device
484 * @ffbit: bitmap of force feedback capabilities truly supported by
H A Ddma-attrs.h4 #include <linux/bitmap.h>
H A Dnodemask.h5 * Nodemasks provide a bitmap suitable for representing the
8 * See detailed comments in the file linux/bitmap.h describing the
12 * lib/bitmap.c. For details of nodelist_parse(), see bitmap_parselist(),
13 * also in bitmap.c. For details of node_remap(), see bitmap_bitremap in
14 * lib/bitmap.c. For details of nodes_remap(), see bitmap_remap in
15 * lib/bitmap.c. For details of nodes_onto(), see bitmap_onto in
16 * lib/bitmap.c. For details of nodes_fold(), see bitmap_fold in
17 * lib/bitmap.c.
92 #include <linux/bitmap.h>
H A Dpercpu_ida.h31 * will just keep looking - but the bitmap _must_ be set whenever a
/linux-4.1.27/arch/arm/mach-tegra/
H A Dflowctrl.c82 /* clear wfe bitmap */ flowctrl_cpu_suspend_enter()
84 /* clear wfi bitmap */ flowctrl_cpu_suspend_enter()
92 /* clear wfe bitmap */ flowctrl_cpu_suspend_enter()
94 /* clear wfi bitmap */ flowctrl_cpu_suspend_enter()
123 /* clear wfe bitmap */ flowctrl_cpu_suspend_exit()
125 /* clear wfi bitmap */ flowctrl_cpu_suspend_exit()
131 /* clear wfe bitmap */ flowctrl_cpu_suspend_exit()
133 /* clear wfi bitmap */ flowctrl_cpu_suspend_exit()
/linux-4.1.27/arch/arm/include/asm/
H A Ddma-iommu.h19 size_t bitmap_size; /* size of a single bitmap */
20 size_t bits; /* per bitmap */
/linux-4.1.27/security/selinux/ss/
H A Debitmap.h2 * An extensible bitmap is a bitmap that supports an
7 * Each extensible bitmap is implemented as a linked
8 * list of bitmap nodes, where each bitmap node has
10 * the total bitmap.
40 struct ebitmap_node *node; /* first node in the bitmap */
41 u32 highbit; /* highest position in the total bitmap */
H A Debitmap.c2 * Implementation of the extensible bitmap type.
9 * Added support to import/export the NetLabel category bitmap
15 * Applied standard bit operations to improve bitmap scanning.
79 * ebitmap_netlbl_export - Export an ebitmap into a NetLabel category bitmap
81 * @catmap: the NetLabel category bitmap
84 * Export a SELinux extensibile bitmap into a NetLabel category bitmap.
131 * ebitmap_netlbl_import - Import a NetLabel category bitmap into an ebitmap
133 * @catmap: the NetLabel category bitmap
136 * Import a NetLabel category bitmap into a SELinux extensibile bitmap.
147 unsigned long bitmap; ebitmap_netlbl_import() local
150 rc = netlbl_catmap_getlong(catmap, &offset, &bitmap); ebitmap_netlbl_import()
156 /* don't waste ebitmap space if the netlabel bitmap is empty */ ebitmap_netlbl_import()
157 if (bitmap == 0) { ebitmap_netlbl_import()
178 e_iter->maps[idx] = bitmap; ebitmap_netlbl_import()
275 /* drop this node from the bitmap */ ebitmap_set_bit()
279 * within the bitmap ebitmap_set_bit()
310 /* this node will be the highest map within the bitmap */ ebitmap_set_bit()
393 "beyond the end of the bitmap (%u)\n", ebitmap_read()
/linux-4.1.27/fs/btrfs/tests/
H A Dfree-space-tests.c135 test_msg("Running bitmap only tests\n"); test_bitmaps()
139 test_msg("Couldn't create a bitmap entry %d\n", ret); test_bitmaps()
145 test_msg("Error removing bitmap full range %d\n", ret); test_bitmaps()
150 test_msg("Left some space in bitmap\n"); test_bitmaps()
156 test_msg("Couldn't add to our bitmap entry %d\n", ret); test_bitmaps()
167 * The first bitmap we have starts at offset 0 so the next one is just test_bitmaps()
168 * at the end of the first bitmap. test_bitmaps()
205 test_msg("Running bitmap and extent tests\n"); test_bitmaps_and_extents()
209 * bitmap, but the free space completely in the extent and then test_bitmaps_and_extents()
210 * completely in the bitmap. test_bitmaps_and_extents()
214 test_msg("Couldn't create bitmap entry %d\n", ret); test_bitmaps_and_extents()
235 /* Now to add back the extent entry and remove from the bitmap */ test_bitmaps_and_extents()
244 test_msg("Couldn't remove from bitmap %d\n", ret); test_bitmaps_and_extents()
249 test_msg("Left remnants in the bitmap\n"); test_bitmaps_and_extents()
254 * Ok so a little more evil, extent entry and bitmap at the same offset, test_bitmaps_and_extents()
259 test_msg("Couldn't add to a bitmap %d\n", ret); test_bitmaps_and_extents()
276 /* Now with the extent entry offset into the bitmap */ test_bitmaps_and_extents()
279 test_msg("Couldn't add space to the bitmap %d\n", ret); test_bitmaps_and_extents()
302 * bitmap entry, but we're trying to remove an offset that falls test_bitmaps_and_extents()
303 * completely within the bitmap range and is in both the extent entry test_bitmaps_and_extents()
304 * and the bitmap entry, looks like this test_bitmaps_and_extents()
307 * [ bitmap ] test_bitmaps_and_extents()
314 test_msg("Couldn't add bitmap %d\n", ret); test_bitmaps_and_extents()
341 * This blew up before, we have part of the free space in a bitmap and test_bitmaps_and_extents()
348 test_msg("Couldn't add bitmap entry %d\n", ret); test_bitmaps_and_extents()
360 test_msg("Error removing bitmap and extent overlapping %d\n", ret); test_bitmaps_and_extents()
418 /* And no extent nor bitmap entries in the cache anymore. */ check_cache_empty()
423 * Before we were able to steal free space from a bitmap entry to an extent
425 * One would be an extent entry and the other a bitmap entry. Since in order
445 test_msg("Running space stealing from bitmap to extent\n"); test_steal_space_from_bitmap_to_extent()
449 * immediately adjacent to a bitmap entry, where the bitmap starts test_steal_space_from_bitmap_to_extent()
455 * in an existing bitmap that covers the new free space range. test_steal_space_from_bitmap_to_extent()
482 test_msg("Couldn't add bitmap entry %d\n", ret); test_steal_space_from_bitmap_to_extent()
491 * Now make only the first 256Kb of the bitmap marked as free, so that test_steal_space_from_bitmap_to_extent()
501 test_msg("Failed to free part of bitmap space %d\n", ret); test_steal_space_from_bitmap_to_extent()
518 * Confirm that the bitmap range [128Mb + 768Kb, 256Mb[ isn't marked test_steal_space_from_bitmap_to_extent()
529 * covered by the bitmap, isn't marked as free. test_steal_space_from_bitmap_to_extent()
533 test_msg("Invalid bitmap region marked as free\n"); test_steal_space_from_bitmap_to_extent()
539 * by the bitmap too, isn't marked as free either. test_steal_space_from_bitmap_to_extent()
543 test_msg("Invalid bitmap region marked as free\n"); test_steal_space_from_bitmap_to_extent()
549 * lets make sure the free space cache marks it as free in the bitmap, test_steal_space_from_bitmap_to_extent()
564 * Confirm that no new extent entries or bitmap entries were added to test_steal_space_from_bitmap_to_extent()
573 * one, which is not contiguous with it and is part of the bitmap too. test_steal_space_from_bitmap_to_extent()
574 * The goal is to test that the bitmap entry space stealing doesn't test_steal_space_from_bitmap_to_extent()
585 * Confirm that no new extent entries or bitmap entries were added to test_steal_space_from_bitmap_to_extent()
612 * bitmap, because of the small 4Kb free space region. test_steal_space_from_bitmap_to_extent()
620 * space. Without stealing bitmap free space into extent entry space, test_steal_space_from_bitmap_to_extent()
625 * bitmap entry covering range: [128Mb, 128Mb + 768Kb[ test_steal_space_from_bitmap_to_extent()
629 * With the bitmap free space stealing, we get a single extent entry test_steal_space_from_bitmap_to_extent()
653 /* All that remains is a 4Kb free space region in a bitmap. Confirm. */ test_steal_space_from_bitmap_to_extent()
680 * to the right of the bitmap entry, so that we can check that stealing test_steal_space_from_bitmap_to_extent()
681 * space from a bitmap to the front of an extent entry works. test_steal_space_from_bitmap_to_extent()
698 test_msg("Couldn't add bitmap entry %d\n", ret); test_steal_space_from_bitmap_to_extent()
707 * Now make only the last 256Kb of the bitmap marked as free, so that test_steal_space_from_bitmap_to_extent()
717 test_msg("Failed to free part of bitmap space %d\n", ret); test_steal_space_from_bitmap_to_extent()
734 * Confirm that the bitmap range [0, 128Mb - 768Kb[ isn't marked test_steal_space_from_bitmap_to_extent()
745 * covered by the bitmap, isn't marked as free. test_steal_space_from_bitmap_to_extent()
749 test_msg("Invalid bitmap region marked as free\n"); test_steal_space_from_bitmap_to_extent()
755 * lets make sure the free space cache marks it as free in the bitmap, test_steal_space_from_bitmap_to_extent()
772 * Confirm that no new extent entries or bitmap entries were added to test_steal_space_from_bitmap_to_extent()
781 * one, which is not contiguous with it and is part of the bitmap too. test_steal_space_from_bitmap_to_extent()
782 * The goal is to test that the bitmap entry space stealing doesn't test_steal_space_from_bitmap_to_extent()
809 * bitmap, because of the small 8Kb free space region. test_steal_space_from_bitmap_to_extent()
817 * space. Without stealing bitmap free space into extent entry space, test_steal_space_from_bitmap_to_extent()
822 * bitmap entry covering range: [128Mb - 768Kb, 128Mb[ test_steal_space_from_bitmap_to_extent()
826 * With the bitmap free space stealing, we get a single extent entry test_steal_space_from_bitmap_to_extent()
850 /* All that remains is a 8Kb free space region in a bitmap. Confirm. */ test_steal_space_from_bitmap_to_extent()
/linux-4.1.27/include/acpi/
H A Dacpi_numa.h7 /* Proximity bitmap length */
/linux-4.1.27/fs/ext4/
H A DMakefile7 ext4-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o page-io.o \
H A Dbitmap.c2 * linux/fs/ext4/bitmap.c
13 unsigned int ext4_count_free(char *bitmap, unsigned int numchars) ext4_count_free() argument
15 return numchars * BITS_PER_BYTE - memweight(bitmap, numchars); ext4_count_free()
H A Dmballoc.c51 * - bitmap read-ahead (proposed by Oleg Drokin aka green)
109 * mapped to the buddy and bitmap information regarding different
113 * block bitmap and buddy information. The information are stored in the
117 * [ group 0 bitmap][ group 0 buddy] [group 1][ group 1]...
120 * one block each for bitmap and buddy information. So for each group we
159 * not, we search in the specific group using bitmap for best extents. The
177 * - on-disk bitmap
178 * - in-core buddy (actually includes buddy and bitmap)
198 * in-core buddy = on-disk bitmap + preallocation descriptors
209 * blocks: how many blocks marked used/free in on-disk bitmap, buddy and PA.
218 * note: 'buddy -= on-disk - PA' is used to show that on-disk bitmap
220 * bits from PA, only from on-disk bitmap
231 * on-disk bitmap if buddy has same bit set or/and PA covers corresponded
240 * we need to make sure that either on-disk bitmap or PA has uptodate data
269 * - PA is referenced until block isn't marked in on-disk bitmap
270 * - PA changes only after on-disk bitmap
273 * - buddy init as sum of on-disk bitmap and PAs is done atomically
286 * mark bits in on-disk bitmap
292 * mark bits in on-disk bitmap
298 * mark bits in on-disk bitmap
304 * load on-disk bitmap
333 * - generate in-core bitmap:
365 static void ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap,
367 static void ext4_mb_generate_from_freelist(struct super_block *sb, void *bitmap,
504 static void mb_cmp_bitmaps(struct ext4_buddy *e4b, void *bitmap) mb_cmp_bitmaps() argument
506 if (memcmp(e4b->bd_info->bb_bitmap, bitmap, e4b->bd_sb->s_blocksize)) { mb_cmp_bitmaps()
510 b2 = (unsigned char *) bitmap; mb_cmp_bitmaps()
535 static inline void mb_cmp_bitmaps(struct ext4_buddy *e4b, void *bitmap) mb_cmp_bitmaps() argument
660 * Clear the bits in bitmap which the blocks of the chunk(s) covered,
722 void *buddy, void *bitmap, ext4_group_t group) ext4_mb_generate_buddy()
734 /* initialize buddy from bitmap which is aggregation ext4_mb_generate_buddy()
735 * of on-disk bitmap and preallocations */ ext4_mb_generate_buddy()
736 i = mb_find_next_zero_bit(bitmap, max, 0); ext4_mb_generate_buddy()
741 i = mb_find_next_bit(bitmap, max, i); ext4_mb_generate_buddy()
749 i = mb_find_next_zero_bit(bitmap, max, i); ext4_mb_generate_buddy()
755 "block bitmap and bg descriptor " ext4_mb_generate_buddy()
760 * corrupt and update bb_free using bitmap value ext4_mb_generate_buddy()
800 * block bitmap and buddy information. The information are
804 * [ group 0 bitmap][ group 0 buddy] [group 1][ group 1]...
807 * one block each for bitmap and buddy information.
832 char *bitmap; ext4_mb_init_cache() local
880 mb_debug(1, "read bitmap for group %u\n", group); ext4_mb_init_cache()
908 bitmap = bh[group - first_group]->b_data; ext4_mb_init_cache()
911 * We place the buddy block and bitmap block ext4_mb_init_cache()
926 * incore got set to the group block bitmap below ext4_mb_init_cache()
935 /* this is block of bitmap */ ext4_mb_init_cache()
937 mb_debug(1, "put bitmap for group %u in page %lu/%x\n", ext4_mb_init_cache()
943 memcpy(data, bitmap, blocksize); ext4_mb_init_cache()
945 /* mark all preallocated blks used in in-core bitmap */ ext4_mb_init_cache()
969 * Lock the buddy and bitmap pages. This make sure other parallel init_group
971 * Return locked buddy and bitmap pages on e4b struct. If buddy and bitmap
987 * the buddy cache inode stores the block bitmap ext4_mb_get_buddy_page_lock()
1002 /* buddy and bitmap are on the same page */ ext4_mb_get_buddy_page_lock()
1074 * If both the bitmap and buddy are in ext4_mb_init_group()
1138 * the buddy cache inode stores the block bitmap ext4_mb_load_buddy()
1337 static inline int mb_buddy_adjust_border(int* bit, void* bitmap, int side) mb_buddy_adjust_border() argument
1339 if (mb_test_bit(*bit + side, bitmap)) { mb_buddy_adjust_border()
1340 mb_clear_bit(*bit, bitmap); mb_buddy_adjust_border()
1346 mb_set_bit(*bit, bitmap); mb_buddy_adjust_border()
1451 "(bit %u); block bitmap corrupt.", mb_free_blocks()
1473 * adjust bitmap bb_counters and borders appropriately. mb_free_blocks()
1647 * group until we update the bitmap. That would mean we ext4_mb_use_best_found()
1870 * The routine scans buddy structures (not bitmap!) from given order
1922 void *bitmap = e4b->bd_bitmap; ext4_mb_complex_scan_group() local
1933 i = mb_find_next_zero_bit(bitmap, ext4_mb_complex_scan_group()
1937 * IF we have corrupt bitmap, we won't find any ext4_mb_complex_scan_group()
1943 "group info. But bitmap says 0", ext4_mb_complex_scan_group()
1957 * indicate that the bitmap is corrupt. So exit ext4_mb_complex_scan_group()
1982 void *bitmap = e4b->bd_bitmap; ext4_mb_scan_aligned() local
1999 if (!mb_test_bit(i, bitmap)) { ext4_mb_scan_aligned()
2013 /* This is now called BEFORE we load the buddy bitmap. */ ext4_mb_good_group()
2581 /* order 0 is regular bitmap */ ext4_mb_init()
2917 * Fix the bitmap and repeat the block allocation ext4_mb_mark_diskspace_used()
3299 * in on-disk bitmap -- see ext4_mb_release_context() ext4_mb_use_group_pa()
3425 * but not yet committed and marks them used in in-core bitmap.
3426 * buddy must be generated from this bitmap
3429 static void ext4_mb_generate_from_freelist(struct super_block *sb, void *bitmap, ext4_mb_generate_from_freelist() argument
3441 ext4_set_bits(bitmap, entry->efd_start_cluster, entry->efd_count); ext4_mb_generate_from_freelist()
3449 * used in in-core bitmap. buddy must be generated from this bitmap
3453 void ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap, ext4_mb_generate_from_pa() argument
3482 ext4_set_bits(bitmap, start, len); ext4_mb_generate_from_pa()
3538 * copy on-disk bitmap to buddy ext4_mb_put_pa()
3539 * mark B in on-disk bitmap ext4_mb_put_pa()
3725 * finds all unused blocks in on-disk bitmap, frees them in
3726 * in-core bitmap and buddy.
3779 * from the bitmap and continue. ext4_mb_release_inode_pa()
3835 ext4_error(sb, "Error reading block bitmap for %u", group); ext4_mb_discard_group_preallocations()
4007 ext4_error(sb, "Error reading block bitmap for %u", ext4_discard_preallocations()
4576 * on-disk bitmap and lose not-yet-available ext4_mb_free_metadata()
4822 /* need to update group_info->bb_free and bitmap ext4_free_blocks()
4859 /* We dirtied the bitmap block */ ext4_free_blocks()
4860 BUFFER_TRACE(bitmap_bh, "dirtied bitmap block"); ext4_free_blocks()
4888 * This marks the blocks as free in the bitmap and buddy.
4976 * need to update group_info->bb_free and bitmap ext4_group_add_blocks()
4999 /* We dirtied the bitmap block */ ext4_group_add_blocks()
5000 BUFFER_TRACE(bitmap_bh, "dirtied bitmap block"); ext4_group_add_blocks()
5024 * one will allocate those blocks, mark it as used in buddy bitmap. This must
5063 * ext4_trim_all_free walks through group's buddy bitmap searching for free
5068 * ext4_trim_all_free walks through group's block bitmap searching for free
5070 * bitmap. Then issue a TRIM command on this extent and free the extent in
5071 * the group buddy bitmap. This is done until whole group is scanned.
5078 void *bitmap; ext4_trim_all_free() local
5091 bitmap = e4b.bd_bitmap; ext4_trim_all_free()
5102 start = mb_find_next_zero_bit(bitmap, max + 1, start); ext4_trim_all_free()
5105 next = mb_find_next_bit(bitmap, max + 1, start); ext4_trim_all_free()
721 ext4_mb_generate_buddy(struct super_block *sb, void *buddy, void *bitmap, ext4_group_t group) ext4_mb_generate_buddy() argument
H A Dballoc.c50 * allocation bitmap, given a block number
107 * used for the allocation bitmap or inode table explicitly. ext4_num_overhead_clusters()
177 /* Initializes an uninitialized block bitmap */ ext4_init_block_bitmap()
237 * the blocksize * 8 ( which is the size of bitmap ), set rest ext4_init_block_bitmap()
238 * of the block bitmap to 1 ext4_init_block_bitmap()
248 * the block bitmap is uninitialized, so we can't just count the bits
249 * in the bitmap. */ ext4_free_clusters_after_init()
260 * blocks groups. Each group contains 1 bitmap block for blocks, 1 bitmap
264 * super block. Each descriptor contains the number of the bitmap block and
312 * the block bitmap is valid.
328 * so the bitmap validation will be skipped for those groups ext4_valid_block_bitmap()
336 /* check whether block bitmap block number is set */ ext4_valid_block_bitmap()
340 /* bad block bitmap */ ext4_valid_block_bitmap()
343 /* check whether the inode bitmap block number is set */ ext4_valid_block_bitmap()
347 /* bad block bitmap */ ext4_valid_block_bitmap()
358 /* bad bitmap for inode tables */ ext4_valid_block_bitmap()
379 ext4_error(sb, "bg %u: block %llu: invalid block bitmap", ext4_validate_block_bitmap()
390 ext4_error(sb, "bg %u: bad block bitmap checksum", block_group); ext4_validate_block_bitmap()
406 * Read the bitmap for a given block_group,and validate the
424 ext4_error(sb, "Cannot get buffer for block bitmap - " ext4_read_block_bitmap_nowait()
455 * bitmap is also uptodate ext4_read_block_bitmap_nowait()
491 ext4_error(sb, "Cannot read block bitmap - " ext4_wait_block_bitmap()
497 /* Panic or remount fs read-only if block bitmap is invalid */ ext4_wait_block_bitmap()
H A Dialloc.c39 * blocks groups. Each group contains 1 bitmap block for blocks, 1 bitmap
43 * super block. Each descriptor contains the number of the bitmap block and
50 * We can use memset for the rest of the bitmap as there are no other users.
52 void ext4_mark_bitmap_end(int start_bit, int end_bit, char *bitmap) ext4_mark_bitmap_end() argument
61 ext4_set_bit(i, bitmap); ext4_mark_bitmap_end()
63 memset(bitmap + (i >> 3), 0xff, (end_bit - i) >> 3); ext4_mark_bitmap_end()
66 /* Initializes an uninitialized inode bitmap */ ext4_init_inode_bitmap()
116 * Read the inode allocation bitmap for a given block_group, reading
117 * into the specified slot in the superblock's bitmap cache.
119 * Return buffer_head of bitmap on success or NULL.
137 ext4_error(sb, "Cannot read inode bitmap - " ext4_read_inode_bitmap()
166 * bitmap is also uptodate ext4_read_inode_bitmap()
182 ext4_error(sb, "Cannot read inode bitmap - " ext4_read_inode_bitmap()
195 ext4_error(sb, "Corrupt inode bitmap - block_group = %u, " ext4_read_inode_bitmap()
287 /* Don't bother if the inode bitmap is corrupt. */ ext4_free_inode()
794 * Check free inodes count before loading bitmap. __ext4_new_inode()
855 ino++; /* the inode bitmap is zero-based */ __ext4_new_inode()
883 /* We may have to initialize the block bitmap if it isn't already */ __ext4_new_inode()
893 BUFFER_TRACE(block_bitmap_bh, "get block bitmap access"); __ext4_new_inode()
901 BUFFER_TRACE(block_bitmap_bh, "dirty block bitmap"); __ext4_new_inode()
1010 * Likely a bitmap corruption causing inode to be allocated __ext4_new_inode()
1126 ext4_error(sb, "inode bitmap error %ld for orphan %lu", ext4_orphan_get()
1290 * If inode bitmap was already initialized there may be some ext4_init_inode_table()
/linux-4.1.27/mm/
H A Dcma.h7 unsigned long *bitmap; member in struct:cma
H A Dcma_debug.c42 used = bitmap_weight(cma->bitmap, (int)cma->count); cma_used_get()
58 start = find_next_zero_bit(cma->bitmap, cma->count, end); cma_maxchunk_get()
61 end = find_next_bit(cma->bitmap, cma->count, start); cma_maxchunk_get()
189 debugfs_create_u32_array("bitmap", S_IRUGO, tmp, (u32*)cma->bitmap, u32s); cma_debugfs_add_one()
H A Dcma.c93 bitmap_clear(cma->bitmap, bitmap_no, bitmap_count); cma_clear_bitmap()
104 cma->bitmap = kzalloc(bitmap_size, GFP_KERNEL); cma_activate_area()
106 if (!cma->bitmap) cma_activate_area()
140 kfree(cma->bitmap); cma_activate_area()
164 * @order_per_bit: Order of pages represented by one bit on bitmap.
216 * @order_per_bit: Order of pages represented by one bit on bitmap.
385 bitmap_no = bitmap_find_next_zero_area_off(cma->bitmap, cma_alloc()
392 bitmap_set(cma->bitmap, bitmap_no, bitmap_count); cma_alloc()
H A Dkmemcheck.c24 "shadow bitmap\n"); kmemcheck_alloc_shadow()
/linux-4.1.27/drivers/net/wireless/ti/wl18xx/
H A Devent.h61 /* bitmap of removed links */
68 /* bitmap of roc completed (by role id) */
71 /* bitmap of stations (by role id) with bss loss */
74 /* bitmap of stations (by HLID) which exceeded max tx retries */
77 /* bitmap of inactive stations (by HLID) */
H A Dwl18xx.h76 /* A bitmap representing the currently suspended links. The suspend
143 * A bitmap (where each bit represents a single HLID)
149 * A bitmap (where each bit represents a single HLID) to indicate
/linux-4.1.27/drivers/block/drbd/
H A Ddrbd_bitmap.c53 * 1 << (38 - 3) bitmap bytes needed
55 * (that's 32 GiB of bitmap for 1 PiB storage)
64 * 22 --> we need that much 4KiB pages of bitmap.
73 * bitmap storage and IO:
75 * core memory. Currently we still hold the full bitmap in core as long
79 * We plan to reduce the amount of in-core bitmap pages by paging them in
120 struct drbd_bitmap *b = device->bitmap; __bm_print_lock_info()
123 drbd_err(device, "FIXME %s[%d] in %s, bitmap locked for '%s' by %s[%d]\n", __bm_print_lock_info()
131 struct drbd_bitmap *b = device->bitmap; drbd_bm_lock()
135 drbd_err(device, "FIXME no bitmap in drbd_bm_lock!?\n"); drbd_bm_lock()
142 drbd_warn(device, "%s[%d] going to '%s' but bitmap already locked for '%s' by %s[%d]\n", drbd_bm_lock()
149 drbd_err(device, "FIXME bitmap already locked in bm_lock\n"); drbd_bm_lock()
158 struct drbd_bitmap *b = device->bitmap; drbd_bm_unlock()
160 drbd_err(device, "FIXME no bitmap in drbd_bm_unlock!?\n"); drbd_bm_unlock()
164 if (!(BM_LOCKED_MASK & device->bitmap->bm_flags)) drbd_bm_unlock()
165 drbd_err(device, "FIXME bitmap not locked in bm_unlock\n"); drbd_bm_unlock()
174 /* at a granularity of 4k storage per bitmap bit:
177 * 1<<23 4k bitmap pages.
199 * use atomic bit manipulation, as set_out_of_sync (and therefore bitmap
214 * context, we can get away with a bit per page and one wait queue per bitmap.
218 struct drbd_bitmap *b = device->bitmap; bm_page_lock_io()
225 struct drbd_bitmap *b = device->bitmap; bm_page_unlock_io()
228 wake_up(&device->bitmap->bm_io_wait); bm_page_unlock_io()
248 * @page_nr: the bitmap page to mark with the "hint" flag
257 if (page_nr >= device->bitmap->bm_number_of_pages) { drbd_bm_mark_for_writeout()
259 page_nr, (int)device->bitmap->bm_number_of_pages); drbd_bm_mark_for_writeout()
262 page = device->bitmap->bm_pages[page_nr]; drbd_bm_mark_for_writeout()
332 /* word offset from start of bitmap to word number _in_page_
440 * allocates the drbd_bitmap, and stores it in device->bitmap.
444 struct drbd_bitmap *b = device->bitmap; drbd_bm_init()
453 device->bitmap = b; drbd_bm_init()
460 if (!expect(device->bitmap)) drbd_bm_capacity()
462 return device->bitmap->bm_dev_capacity; drbd_bm_capacity()
469 if (!expect(device->bitmap)) drbd_bm_cleanup()
471 bm_free_pages(device->bitmap->bm_pages, device->bitmap->bm_number_of_pages); drbd_bm_cleanup()
472 bm_vk_free(device->bitmap->bm_pages, (BM_P_VMALLOCED & device->bitmap->bm_flags)); drbd_bm_cleanup()
473 kfree(device->bitmap); drbd_bm_cleanup()
474 device->bitmap = NULL; drbd_bm_cleanup()
496 /* bitmap is always stored little endian, bm_clear_surplus()
532 /* bitmap is always stored little endian, bm_set_surplus()
555 /* you better not modify the bitmap while this is running,
628 * make sure the bitmap has enough room for the attached storage,
632 * In case this is actually a resize, we copy the old bitmap into the new one.
633 * Otherwise, the bitmap is initialized to all bits set.
637 struct drbd_bitmap *b = device->bitmap; drbd_bm_resize()
746 drbd_info(device, "resync bitmap: bits=%lu words=%lu pages=%lu\n", bits, words, want); drbd_bm_resize()
763 struct drbd_bitmap *b = device->bitmap; _drbd_bm_total_weight()
792 struct drbd_bitmap *b = device->bitmap; drbd_bm_words()
803 struct drbd_bitmap *b = device->bitmap; drbd_bm_bits()
810 /* merge number words from buffer into the bitmap starting at offset.
812 * bitmap must be locked by drbd_bm_lock.
818 struct drbd_bitmap *b = device->bitmap; drbd_bm_merge_lel()
861 /* copy number words from the bitmap starting at offset into the buffer.
867 struct drbd_bitmap *b = device->bitmap; drbd_bm_get_lel()
900 /* set all bits in the bitmap */ drbd_bm_set_all()
903 struct drbd_bitmap *b = device->bitmap; drbd_bm_set_all()
916 /* clear all bits in the bitmap */ drbd_bm_clear_all()
919 struct drbd_bitmap *b = device->bitmap; drbd_bm_clear_all()
948 struct drbd_bitmap *b = device->bitmap; drbd_bm_endio()
962 drbd_warn(device, "bitmap page idx %u changed during IO!\n", idx); drbd_bm_endio()
972 drbd_err(device, "IO ERROR %d on bitmap page idx %u\n", drbd_bm_endio()
976 dynamic_drbd_dbg(device, "bitmap page idx %u completed\n", idx); drbd_bm_endio()
997 struct drbd_bitmap *b = device->bitmap; __must_hold()
1044 * bm_rw: read/write the whole bitmap from/to its on disk location.
1049 struct drbd_bitmap *b = device->bitmap; __must_hold()
1056 * We are protected against bitmap disappearing/resizing by holding an __must_hold()
1058 * For read/write, we are protected against changes to the bitmap by __must_hold()
1059 * the bitmap lock (see drbd_bitmap_io). __must_hold()
1060 * For lazy writeout, we don't care for ongoing changes to the bitmap, __must_hold()
1140 /* summary for global bitmap IO */ __must_hold()
1142 drbd_info(device, "bitmap %s of %u pages took %lu jiffies\n", __must_hold()
1147 drbd_alert(device, "we had at least one MD IO ERROR during bitmap IO\n"); __must_hold()
1172 * drbd_bm_read() - Read the whole bitmap from its on disk location.
1181 * drbd_bm_write() - Write the whole bitmap to its on disk location.
1192 * drbd_bm_write_all() - Write the whole bitmap to its on disk location.
1203 * drbd_bm_write_lazy() - Write bitmap pages 0 to @upper_idx-1, if they have changed.
1213 * drbd_bm_write_copy_pages() - Write the whole bitmap to its on disk location.
1217 * In contrast to drbd_bm_write(), this will copy the bitmap pages
1219 * while still allowing the bitmap to change, for example if a resync or online
1229 * drbd_bm_write_hinted() - Write bitmap pages with "hint" marks, if they have changed.
1248 struct drbd_bitmap *b = device->bitmap; __bm_find_next()
1288 struct drbd_bitmap *b = device->bitmap; bm_find_next()
1338 * Must hold bitmap lock already. */ __bm_change_bits_to()
1342 struct drbd_bitmap *b = device->bitmap; __bm_change_bits_to()
1392 struct drbd_bitmap *b = device->bitmap; bm_change_bits_to()
1439 * remote bitmap as well, and is reconstructed during the next bm_set_full_words_within_one_page()
1440 * bitmap exchange, if lost locally due to a crash. */ bm_set_full_words_within_one_page()
1449 * Can be called to set the whole bitmap in one go.
1461 struct drbd_bitmap *b = device->bitmap; _drbd_bm_set_bits()
1496 bm_set_full_words_within_one_page(device->bitmap, page_nr, first_word, last_word); _drbd_bm_set_bits()
1505 /* consider bitmap->bm_bits = 32768, bitmap->bm_number_of_pages = 1. (or multiples). _drbd_bm_set_bits()
1509 * as we did not allocate it, it is not present in bitmap->bm_pages. _drbd_bm_set_bits()
1512 bm_set_full_words_within_one_page(device->bitmap, last_page, first_word, last_word); _drbd_bm_set_bits()
1534 struct drbd_bitmap *b = device->bitmap; drbd_bm_test_bit()
1565 struct drbd_bitmap *b = device->bitmap; drbd_bm_count_bits()
1571 /* If this is called without a bitmap, that is a bug. But just to be drbd_bm_count_bits()
1574 * local read there (no bitmap probably implies no disk) */ drbd_bm_count_bits()
1607 * value is zero, or we already "locked" this "bitmap extent" by other means.
1610 * worth of the bitmap a "bitmap extent".
1614 * reference count of some bitmap extent element from some lru instead...
1619 struct drbd_bitmap *b = device->bitmap; drbd_bm_e_weight()
H A Ddrbd_int.h176 DRBD_FAULT_BM_ALLOC = 7, /* bitmap allocation */
208 /* for sending/receiving the bitmap,
213 * of the bitmap, so we don't need to
217 /* during xfer, current position within the bitmap */
237 * the plain text bitmap much more convenient. */ bm_xfer_ctx_bit_to_word_offset()
508 once no more io in flight, start bitmap io */
509 BITMAP_IO_QUEUED, /* Started bitmap IO */
562 * would be unexpected. Used during bitmap receive. Setting new bits
597 s32 bm_offset; /* signed relative sector offset to bitmap */
918 struct drbd_bitmap *bitmap; member in struct:drbd_device
1155 * ==> bitmap sectors = md_size_sect - bm_offset
1165 * ==> bitmap sectors = Y = al_offset - bm_offset
1216 /* resync bitmap */
1217 /* 16MB sized 'bitmap extent' to track syncer usage */
1232 * Example: 1GB disk @ 4096 byte blocks ==> we need 32 KB bitmap.
1239 /* We do bitmap IO in units of 4k blocks.
1243 /* mostly arbitrarily set the represented size of one bitmap extent,
1244 * aka resync extent, to 16 MiB (which is also 512 Byte worth of bitmap
1266 /* first storage sector a bitmap extent corresponds to */
1268 /* how much _storage_ sectors we have per bitmap extent */
1270 /* how many bits are covered by one bitmap extent (resync extent) */
1276 /* in one sector of the bitmap, we have this many activity_log extents. */
1280 * we need that many (long words/bytes) to store the bitmap
1282 * we can store the bitmap for that many AL_EXTENTS within
1283 * one sector of the _on_disk_ bitmap:
1296 * log, leaving this many sectors for the bitmap.
1308 /* adjust by one page worth of bitmap,
1353 * may process the whole bitmap in one go */
1389 extern struct kmem_cache *drbd_bm_ext_cache; /* bitmap extents */
1413 * for meta data IO (activity log, bitmap).
1759 * If we can not write the bitmap after a READ error, __drbd_chk_io_error_()
2235 /* to avoid potential deadlock or bitmap corruption, may_inc_ap_bio()
2269 * until the bitmap is no longer on the fly during connection inc_ap_bio()
H A Ddrbd_vli.h32 * the bitmap transfer time can take much too long,
35 * We try to reduce the transferred bitmap information
64 * parts of the bitmap, though.
70 * To avoid yet an other configuration parameter (choice of bitmap compression
/linux-4.1.27/fs/xfs/
H A Dxfs_bit.c27 * Return whether bitmap is empty.
28 * Size is number of words in the bitmap, which is padded to word boundary
45 * Count the number of contiguous bits set in the bitmap starting with bit
46 * start_bit. Size is the size of the bitmap in words.
84 * beyond the end of the bitmap.
86 * Size is the number of words, not bytes, in the bitmap.
H A Dxfs_rtalloc.c42 * bitmap block combination.
51 xfs_rtblock_t bbno, /* bitmap block number */ xfs_rtget_summary()
61 * by low and high, for the bitmap block bbno.
69 xfs_rtblock_t bbno, /* bitmap block number */ xfs_rtany_summary()
115 xfs_rtblock_t bbno; /* bitmap block number */ xfs_rtcopy_summary()
148 * Updates all the summary information as well as the bitmap.
217 * Modify the bitmap to mark this extent allocated. xfs_rtallocate_range()
225 * bitmap block bbno. If we don't get maxlen then use prod to trim
233 xfs_rtblock_t bbno, /* bitmap block number */ xfs_rtallocate_extent_block()
252 * Loop over all the extents starting in this bitmap block, xfs_rtallocate_extent_block()
435 xfs_rtblock_t bbno; /* bitmap block number */ xfs_rtallocate_extent_near()
437 int i; /* bitmap block offset (loop control) */ xfs_rtallocate_extent_near()
470 * Loop over all bitmap blocks (bbno + i is current block). xfs_rtallocate_extent_near()
475 * starting in this bitmap block. xfs_rtallocate_extent_near()
514 * Loop backwards through the bitmap blocks from xfs_rtallocate_extent_near()
517 * bitmap block and is long enough. xfs_rtallocate_extent_near()
522 * this bitmap block. xfs_rtallocate_extent_near()
555 * There weren't intervening bitmap blocks xfs_rtallocate_extent_near()
629 int i; /* bitmap block number */ xfs_rtallocate_extent_size()
640 * At each level, look at all the bitmap blocks, to see if there xfs_rtallocate_extent_size()
647 * Loop over all the bitmap blocks. xfs_rtallocate_extent_size()
680 * allocator is beyond the next bitmap block, xfs_rtallocate_extent_size()
681 * skip to that bitmap block. xfs_rtallocate_extent_size()
705 * Loop over all the bitmap blocks, try an allocation xfs_rtallocate_extent_size()
743 * allocator is beyond the next bitmap block, xfs_rtallocate_extent_size()
744 * skip to that bitmap block. xfs_rtallocate_extent_size()
758 * Allocate space to the bitmap or summary file, and zero it, for growfs.
765 xfs_inode_t *ip) /* inode (bitmap/summary) */ xfs_growfs_rt_alloc()
804 * Allocate blocks to the bitmap file. xfs_growfs_rt_alloc()
841 * Lock the bitmap inode. xfs_growfs_rt_alloc()
889 xfs_rtblock_t bmbno; /* bitmap block number */ xfs_growfs_rt()
894 xfs_extlen_t nrbmblocks; /* new number of rt bitmap blocks */ xfs_growfs_rt()
901 xfs_extlen_t rbmblocks; /* current number of rt bitmap blocks */ xfs_growfs_rt()
947 * Get the old block counts for bitmap and summary inodes. xfs_growfs_rt()
953 * Allocate space to the bitmap and summary files, as necessary. xfs_growfs_rt()
966 * Loop over the bitmap blocks. xfs_growfs_rt()
967 * We will do everything one bitmap block at a time. xfs_growfs_rt()
1008 * Lock out other callers by grabbing the bitmap inode lock. xfs_growfs_rt()
1013 * Update the bitmap inode's size. xfs_growfs_rt()
1222 * Get the bitmap and summary inodes into the mount structure
1261 * Use the sequence number stored in the atime field of the bitmap inode.
H A Dxfs_rtalloc.h69 * Get the bitmap and summary inodes into the mount structure
78 * Use the sequence number stored in the atime field of the bitmap inode.
/linux-4.1.27/net/netfilter/ipset/
H A DMakefile10 # bitmap types
H A Dip_set_bitmap_ip.c10 /* Kernel module implementing an IP set type: the bitmap:ip type */
35 IP_SET_MODULE_DESC("bitmap:ip", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);
218 /* Create bitmap:ip type of sets */
339 .name = "bitmap:ip",
H A Dip_set_bitmap_port.c8 /* Kernel module implementing an IP set type: the bitmap:port type */
30 IP_SET_MODULE_DESC("bitmap:port", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);
208 /* Create bitmap:ip type of sets */
276 .name = "bitmap:port",
H A Dip_set_bitmap_ipmac.c11 /* Kernel module implementing an IP set type: the bitmap:ip,mac type */
35 IP_SET_MODULE_DESC("bitmap:ip,mac", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);
288 /* Create bitmap:ip,mac type of sets */
377 .name = "bitmap:ip,mac",
/linux-4.1.27/include/asm-generic/bitops/
H A Dsched.h9 * way of searching a 100-bit bitmap. It's guaranteed that at least
H A Dfind.h9 * @size: The bitmap size in bits
23 * @size: The bitmap size in bits
/linux-4.1.27/fs/nfs/
H A Dnfs4xdr.c371 1 /* bitmap size */ + \
372 1 /* notification bitmap length */ + \
373 1 /* notification bitmap, word 0 */)
378 1 /* notification bitmap length */ + \
379 1 /* notification bitmap, word 0 */)
1017 * 16(bitmap) + 4(attrlen) + 8(size) + 4(mode) + 4(atime) + 4(mtime) encode_attrs()
1172 static void encode_getattr_one(struct xdr_stream *xdr, uint32_t bitmap, struct compound_hdr *hdr) encode_getattr_one() argument
1179 *p = cpu_to_be32(bitmap); encode_getattr_one()
1595 dprintk("%s: cookie = %llu, verifier = %08x:%08x, bitmap = %08x:%08x:%08x\n", encode_readdir()
1922 *p++ = cpu_to_be32(1); /* bitmap length */ encode_getdeviceinfo()
2878 /* set up reply kvec. Subtract notification bitmap max size (2) nfs4_xdr_enc_getdeviceinfo()
2879 * so that notification bitmap is put in xdr_buf tail */ nfs4_xdr_enc_getdeviceinfo()
3104 static int decode_attr_bitmap(struct xdr_stream *xdr, uint32_t *bitmap) decode_attr_bitmap() argument
3114 bitmap[0] = bitmap[1] = bitmap[2] = 0; decode_attr_bitmap()
3119 bitmap[0] = be32_to_cpup(p++); decode_attr_bitmap()
3121 bitmap[1] = be32_to_cpup(p++); decode_attr_bitmap()
3123 bitmap[2] = be32_to_cpup(p); decode_attr_bitmap()
3147 static int decode_attr_supported(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *bitmask) decode_attr_supported() argument
3149 if (likely(bitmap[0] & FATTR4_WORD0_SUPPORTED_ATTRS)) { decode_attr_supported()
3154 bitmap[0] &= ~FATTR4_WORD0_SUPPORTED_ATTRS; decode_attr_supported()
3162 static int decode_attr_type(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *type) decode_attr_type() argument
3168 if (unlikely(bitmap[0] & (FATTR4_WORD0_TYPE - 1U))) decode_attr_type()
3170 if (likely(bitmap[0] & FATTR4_WORD0_TYPE)) { decode_attr_type()
3179 bitmap[0] &= ~FATTR4_WORD0_TYPE; decode_attr_type()
3190 uint32_t *bitmap, uint32_t *type) decode_attr_fh_expire_type()
3195 if (unlikely(bitmap[0] & (FATTR4_WORD0_FH_EXPIRE_TYPE - 1U))) decode_attr_fh_expire_type()
3197 if (likely(bitmap[0] & FATTR4_WORD0_FH_EXPIRE_TYPE)) { decode_attr_fh_expire_type()
3202 bitmap[0] &= ~FATTR4_WORD0_FH_EXPIRE_TYPE; decode_attr_fh_expire_type()
3211 static int decode_attr_change(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *change) decode_attr_change() argument
3217 if (unlikely(bitmap[0] & (FATTR4_WORD0_CHANGE - 1U))) decode_attr_change()
3219 if (likely(bitmap[0] & FATTR4_WORD0_CHANGE)) { decode_attr_change()
3224 bitmap[0] &= ~FATTR4_WORD0_CHANGE; decode_attr_change()
3235 static int decode_attr_size(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *size) decode_attr_size() argument
3241 if (unlikely(bitmap[0] & (FATTR4_WORD0_SIZE - 1U))) decode_attr_size()
3243 if (likely(bitmap[0] & FATTR4_WORD0_SIZE)) { decode_attr_size()
3248 bitmap[0] &= ~FATTR4_WORD0_SIZE; decode_attr_size()
3258 static int decode_attr_link_support(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) decode_attr_link_support() argument
3263 if (unlikely(bitmap[0] & (FATTR4_WORD0_LINK_SUPPORT - 1U))) decode_attr_link_support()
3265 if (likely(bitmap[0] & FATTR4_WORD0_LINK_SUPPORT)) { decode_attr_link_support()
3270 bitmap[0] &= ~FATTR4_WORD0_LINK_SUPPORT; decode_attr_link_support()
3279 static int decode_attr_symlink_support(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) decode_attr_symlink_support() argument
3284 if (unlikely(bitmap[0] & (FATTR4_WORD0_SYMLINK_SUPPORT - 1U))) decode_attr_symlink_support()
3286 if (likely(bitmap[0] & FATTR4_WORD0_SYMLINK_SUPPORT)) { decode_attr_symlink_support()
3291 bitmap[0] &= ~FATTR4_WORD0_SYMLINK_SUPPORT; decode_attr_symlink_support()
3300 static int decode_attr_fsid(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_fsid *fsid) decode_attr_fsid() argument
3307 if (unlikely(bitmap[0] & (FATTR4_WORD0_FSID - 1U))) decode_attr_fsid()
3309 if (likely(bitmap[0] & FATTR4_WORD0_FSID)) { decode_attr_fsid()
3315 bitmap[0] &= ~FATTR4_WORD0_FSID; decode_attr_fsid()
3327 static int decode_attr_lease_time(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) decode_attr_lease_time() argument
3332 if (unlikely(bitmap[0] & (FATTR4_WORD0_LEASE_TIME - 1U))) decode_attr_lease_time()
3334 if (likely(bitmap[0] & FATTR4_WORD0_LEASE_TIME)) { decode_attr_lease_time()
3339 bitmap[0] &= ~FATTR4_WORD0_LEASE_TIME; decode_attr_lease_time()
3348 static int decode_attr_error(struct xdr_stream *xdr, uint32_t *bitmap, int32_t *res) decode_attr_error() argument
3352 if (unlikely(bitmap[0] & (FATTR4_WORD0_RDATTR_ERROR - 1U))) decode_attr_error()
3354 if (likely(bitmap[0] & FATTR4_WORD0_RDATTR_ERROR)) { decode_attr_error()
3358 bitmap[0] &= ~FATTR4_WORD0_RDATTR_ERROR; decode_attr_error()
3367 static int decode_attr_filehandle(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_fh *fh) decode_attr_filehandle() argument
3375 if (unlikely(bitmap[0] & (FATTR4_WORD0_FILEHANDLE - 1U))) decode_attr_filehandle()
3377 if (likely(bitmap[0] & FATTR4_WORD0_FILEHANDLE)) { decode_attr_filehandle()
3391 bitmap[0] &= ~FATTR4_WORD0_FILEHANDLE; decode_attr_filehandle()
3399 static int decode_attr_aclsupport(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) decode_attr_aclsupport() argument
3404 if (unlikely(bitmap[0] & (FATTR4_WORD0_ACLSUPPORT - 1U))) decode_attr_aclsupport()
3406 if (likely(bitmap[0] & FATTR4_WORD0_ACLSUPPORT)) { decode_attr_aclsupport()
3411 bitmap[0] &= ~FATTR4_WORD0_ACLSUPPORT; decode_attr_aclsupport()
3420 static int decode_attr_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *fileid) decode_attr_fileid() argument
3426 if (unlikely(bitmap[0] & (FATTR4_WORD0_FILEID - 1U))) decode_attr_fileid()
3428 if (likely(bitmap[0] & FATTR4_WORD0_FILEID)) { decode_attr_fileid()
3433 bitmap[0] &= ~FATTR4_WORD0_FILEID; decode_attr_fileid()
3443 static int decode_attr_mounted_on_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *fileid) decode_attr_mounted_on_fileid() argument
3449 if (unlikely(bitmap[1] & (FATTR4_WORD1_MOUNTED_ON_FILEID - 1U))) decode_attr_mounted_on_fileid()
3451 if (likely(bitmap[1] & FATTR4_WORD1_MOUNTED_ON_FILEID)) { decode_attr_mounted_on_fileid()
3456 bitmap[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID; decode_attr_mounted_on_fileid()
3466 static int decode_attr_files_avail(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) decode_attr_files_avail() argument
3472 if (unlikely(bitmap[0] & (FATTR4_WORD0_FILES_AVAIL - 1U))) decode_attr_files_avail()
3474 if (likely(bitmap[0] & FATTR4_WORD0_FILES_AVAIL)) { decode_attr_files_avail()
3479 bitmap[0] &= ~FATTR4_WORD0_FILES_AVAIL; decode_attr_files_avail()
3488 static int decode_attr_files_free(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) decode_attr_files_free() argument
3494 if (unlikely(bitmap[0] & (FATTR4_WORD0_FILES_FREE - 1U))) decode_attr_files_free()
3496 if (likely(bitmap[0] & FATTR4_WORD0_FILES_FREE)) { decode_attr_files_free()
3501 bitmap[0] &= ~FATTR4_WORD0_FILES_FREE; decode_attr_files_free()
3510 static int decode_attr_files_total(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) decode_attr_files_total() argument
3516 if (unlikely(bitmap[0] & (FATTR4_WORD0_FILES_TOTAL - 1U))) decode_attr_files_total()
3518 if (likely(bitmap[0] & FATTR4_WORD0_FILES_TOTAL)) { decode_attr_files_total()
3523 bitmap[0] &= ~FATTR4_WORD0_FILES_TOTAL; decode_attr_files_total()
3577 static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs4_fs_locations *res) decode_attr_fs_locations() argument
3583 if (unlikely(bitmap[0] & (FATTR4_WORD0_FS_LOCATIONS -1U))) decode_attr_fs_locations()
3586 if (unlikely(!(bitmap[0] & FATTR4_WORD0_FS_LOCATIONS))) decode_attr_fs_locations()
3656 static int decode_attr_maxfilesize(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) decode_attr_maxfilesize() argument
3662 if (unlikely(bitmap[0] & (FATTR4_WORD0_MAXFILESIZE - 1U))) decode_attr_maxfilesize()
3664 if (likely(bitmap[0] & FATTR4_WORD0_MAXFILESIZE)) { decode_attr_maxfilesize()
3669 bitmap[0] &= ~FATTR4_WORD0_MAXFILESIZE; decode_attr_maxfilesize()
3678 static int decode_attr_maxlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *maxlink) decode_attr_maxlink() argument
3684 if (unlikely(bitmap[0] & (FATTR4_WORD0_MAXLINK - 1U))) decode_attr_maxlink()
3686 if (likely(bitmap[0] & FATTR4_WORD0_MAXLINK)) { decode_attr_maxlink()
3691 bitmap[0] &= ~FATTR4_WORD0_MAXLINK; decode_attr_maxlink()
3700 static int decode_attr_maxname(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *maxname) decode_attr_maxname() argument
3706 if (unlikely(bitmap[0] & (FATTR4_WORD0_MAXNAME - 1U))) decode_attr_maxname()
3708 if (likely(bitmap[0] & FATTR4_WORD0_MAXNAME)) { decode_attr_maxname()
3713 bitmap[0] &= ~FATTR4_WORD0_MAXNAME; decode_attr_maxname()
3722 static int decode_attr_maxread(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) decode_attr_maxread() argument
3728 if (unlikely(bitmap[0] & (FATTR4_WORD0_MAXREAD - 1U))) decode_attr_maxread()
3730 if (likely(bitmap[0] & FATTR4_WORD0_MAXREAD)) { decode_attr_maxread()
3739 bitmap[0] &= ~FATTR4_WORD0_MAXREAD; decode_attr_maxread()
3748 static int decode_attr_maxwrite(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) decode_attr_maxwrite() argument
3754 if (unlikely(bitmap[0] & (FATTR4_WORD0_MAXWRITE - 1U))) decode_attr_maxwrite()
3756 if (likely(bitmap[0] & FATTR4_WORD0_MAXWRITE)) { decode_attr_maxwrite()
3765 bitmap[0] &= ~FATTR4_WORD0_MAXWRITE; decode_attr_maxwrite()
3774 static int decode_attr_mode(struct xdr_stream *xdr, uint32_t *bitmap, umode_t *mode) decode_attr_mode() argument
3781 if (unlikely(bitmap[1] & (FATTR4_WORD1_MODE - 1U))) decode_attr_mode()
3783 if (likely(bitmap[1] & FATTR4_WORD1_MODE)) { decode_attr_mode()
3789 bitmap[1] &= ~FATTR4_WORD1_MODE; decode_attr_mode()
3799 static int decode_attr_nlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *nlink) decode_attr_nlink() argument
3805 if (unlikely(bitmap[1] & (FATTR4_WORD1_NUMLINKS - 1U))) decode_attr_nlink()
3807 if (likely(bitmap[1] & FATTR4_WORD1_NUMLINKS)) { decode_attr_nlink()
3812 bitmap[1] &= ~FATTR4_WORD1_NUMLINKS; decode_attr_nlink()
3822 static int decode_attr_owner(struct xdr_stream *xdr, uint32_t *bitmap, decode_attr_owner() argument
3831 if (unlikely(bitmap[1] & (FATTR4_WORD1_OWNER - 1U))) decode_attr_owner()
3833 if (likely(bitmap[1] & FATTR4_WORD1_OWNER)) { decode_attr_owner()
3856 bitmap[1] &= ~FATTR4_WORD1_OWNER; decode_attr_owner()
3865 static int decode_attr_group(struct xdr_stream *xdr, uint32_t *bitmap, decode_attr_group() argument
3874 if (unlikely(bitmap[1] & (FATTR4_WORD1_OWNER_GROUP - 1U))) decode_attr_group()
3876 if (likely(bitmap[1] & FATTR4_WORD1_OWNER_GROUP)) { decode_attr_group()
3899 bitmap[1] &= ~FATTR4_WORD1_OWNER_GROUP; decode_attr_group()
3908 static int decode_attr_rdev(struct xdr_stream *xdr, uint32_t *bitmap, dev_t *rdev) decode_attr_rdev() argument
3915 if (unlikely(bitmap[1] & (FATTR4_WORD1_RAWDEV - 1U))) decode_attr_rdev()
3917 if (likely(bitmap[1] & FATTR4_WORD1_RAWDEV)) { decode_attr_rdev()
3928 bitmap[1] &= ~ FATTR4_WORD1_RAWDEV; decode_attr_rdev()
3938 static int decode_attr_space_avail(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) decode_attr_space_avail() argument
3944 if (unlikely(bitmap[1] & (FATTR4_WORD1_SPACE_AVAIL - 1U))) decode_attr_space_avail()
3946 if (likely(bitmap[1] & FATTR4_WORD1_SPACE_AVAIL)) { decode_attr_space_avail()
3951 bitmap[1] &= ~FATTR4_WORD1_SPACE_AVAIL; decode_attr_space_avail()
3960 static int decode_attr_space_free(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) decode_attr_space_free() argument
3966 if (unlikely(bitmap[1] & (FATTR4_WORD1_SPACE_FREE - 1U))) decode_attr_space_free()
3968 if (likely(bitmap[1] & FATTR4_WORD1_SPACE_FREE)) { decode_attr_space_free()
3973 bitmap[1] &= ~FATTR4_WORD1_SPACE_FREE; decode_attr_space_free()
3982 static int decode_attr_space_total(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) decode_attr_space_total() argument
3988 if (unlikely(bitmap[1] & (FATTR4_WORD1_SPACE_TOTAL - 1U))) decode_attr_space_total()
3990 if (likely(bitmap[1] & FATTR4_WORD1_SPACE_TOTAL)) { decode_attr_space_total()
3995 bitmap[1] &= ~FATTR4_WORD1_SPACE_TOTAL; decode_attr_space_total()
4004 static int decode_attr_space_used(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *used) decode_attr_space_used() argument
4010 if (unlikely(bitmap[1] & (FATTR4_WORD1_SPACE_USED - 1U))) decode_attr_space_used()
4012 if (likely(bitmap[1] & FATTR4_WORD1_SPACE_USED)) { decode_attr_space_used()
4017 bitmap[1] &= ~FATTR4_WORD1_SPACE_USED; decode_attr_space_used()
4047 static int decode_attr_time_access(struct xdr_stream *xdr, uint32_t *bitmap, struct timespec *time) decode_attr_time_access() argument
4053 if (unlikely(bitmap[1] & (FATTR4_WORD1_TIME_ACCESS - 1U))) decode_attr_time_access()
4055 if (likely(bitmap[1] & FATTR4_WORD1_TIME_ACCESS)) { decode_attr_time_access()
4059 bitmap[1] &= ~FATTR4_WORD1_TIME_ACCESS; decode_attr_time_access()
4065 static int decode_attr_time_metadata(struct xdr_stream *xdr, uint32_t *bitmap, struct timespec *time) decode_attr_time_metadata() argument
4071 if (unlikely(bitmap[1] & (FATTR4_WORD1_TIME_METADATA - 1U))) decode_attr_time_metadata()
4073 if (likely(bitmap[1] & FATTR4_WORD1_TIME_METADATA)) { decode_attr_time_metadata()
4077 bitmap[1] &= ~FATTR4_WORD1_TIME_METADATA; decode_attr_time_metadata()
4083 static int decode_attr_time_delta(struct xdr_stream *xdr, uint32_t *bitmap, decode_attr_time_delta() argument
4090 if (unlikely(bitmap[1] & (FATTR4_WORD1_TIME_DELTA - 1U))) decode_attr_time_delta()
4092 if (likely(bitmap[1] & FATTR4_WORD1_TIME_DELTA)) { decode_attr_time_delta()
4094 bitmap[1] &= ~FATTR4_WORD1_TIME_DELTA; decode_attr_time_delta()
4101 static int decode_attr_security_label(struct xdr_stream *xdr, uint32_t *bitmap, decode_attr_security_label() argument
4110 if (unlikely(bitmap[2] & (FATTR4_WORD2_SECURITY_LABEL - 1U))) decode_attr_security_label()
4112 if (likely(bitmap[2] & FATTR4_WORD2_SECURITY_LABEL)) { decode_attr_security_label()
4136 bitmap[2] &= ~FATTR4_WORD2_SECURITY_LABEL; decode_attr_security_label()
4151 static int decode_attr_time_modify(struct xdr_stream *xdr, uint32_t *bitmap, struct timespec *time) decode_attr_time_modify() argument
4157 if (unlikely(bitmap[1] & (FATTR4_WORD1_TIME_MODIFY - 1U))) decode_attr_time_modify()
4159 if (likely(bitmap[1] & FATTR4_WORD1_TIME_MODIFY)) { decode_attr_time_modify()
4163 bitmap[1] &= ~FATTR4_WORD1_TIME_MODIFY; decode_attr_time_modify()
4300 uint32_t attrlen, bitmap[3] = {0}; decode_server_caps() local
4305 if ((status = decode_attr_bitmap(xdr, bitmap)) != 0) decode_server_caps()
4309 if ((status = decode_attr_supported(xdr, bitmap, res->attr_bitmask)) != 0) decode_server_caps()
4311 if ((status = decode_attr_fh_expire_type(xdr, bitmap, decode_server_caps()
4314 if ((status = decode_attr_link_support(xdr, bitmap, &res->has_links)) != 0) decode_server_caps()
4316 if ((status = decode_attr_symlink_support(xdr, bitmap, &res->has_symlinks)) != 0) decode_server_caps()
4318 if ((status = decode_attr_aclsupport(xdr, bitmap, &res->acl_bitmask)) != 0) decode_server_caps()
4329 uint32_t attrlen, bitmap[3] = {0}; decode_statfs() local
4334 if ((status = decode_attr_bitmap(xdr, bitmap)) != 0) decode_statfs()
4339 if ((status = decode_attr_files_avail(xdr, bitmap, &fsstat->afiles)) != 0) decode_statfs()
4341 if ((status = decode_attr_files_free(xdr, bitmap, &fsstat->ffiles)) != 0) decode_statfs()
4343 if ((status = decode_attr_files_total(xdr, bitmap, &fsstat->tfiles)) != 0) decode_statfs()
4345 if ((status = decode_attr_space_avail(xdr, bitmap, &fsstat->abytes)) != 0) decode_statfs()
4347 if ((status = decode_attr_space_free(xdr, bitmap, &fsstat->fbytes)) != 0) decode_statfs()
4349 if ((status = decode_attr_space_total(xdr, bitmap, &fsstat->tbytes)) != 0) decode_statfs()
4361 uint32_t attrlen, bitmap[3] = {0}; decode_pathconf() local
4366 if ((status = decode_attr_bitmap(xdr, bitmap)) != 0) decode_pathconf()
4371 if ((status = decode_attr_maxlink(xdr, bitmap, &pathconf->max_link)) != 0) decode_pathconf()
4373 if ((status = decode_attr_maxname(xdr, bitmap, &pathconf->max_namelen)) != 0) decode_pathconf()
4383 uint32_t *bitmap, decode_threshold_hint()
4390 if (likely(bitmap[0] & hint_bit)) { decode_threshold_hint()
4407 uint32_t bitmap[3] = {0,}, attrlen; decode_first_threshold_item4() local
4418 /* thi_hintset bitmap */ decode_first_threshold_item4()
4419 status = decode_attr_bitmap(xdr, bitmap); decode_first_threshold_item4()
4428 status = decode_threshold_hint(xdr, bitmap, &res->rd_sz, THRESHOLD_RD); decode_first_threshold_item4()
4431 status = decode_threshold_hint(xdr, bitmap, &res->wr_sz, THRESHOLD_WR); decode_first_threshold_item4()
4434 status = decode_threshold_hint(xdr, bitmap, &res->rd_io_sz, decode_first_threshold_item4()
4438 status = decode_threshold_hint(xdr, bitmap, &res->wr_io_sz, decode_first_threshold_item4()
4444 res->bm = bitmap[0]; decode_first_threshold_item4()
4458 uint32_t *bitmap, decode_attr_mdsthreshold()
4465 if (unlikely(bitmap[2] & (FATTR4_WORD2_MDSTHRESHOLD - 1U))) decode_attr_mdsthreshold()
4467 if (bitmap[2] & FATTR4_WORD2_MDSTHRESHOLD) { decode_attr_mdsthreshold()
4483 bitmap[2] &= ~FATTR4_WORD2_MDSTHRESHOLD; decode_attr_mdsthreshold()
4491 static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap, decode_getfattr_attrs() argument
4501 status = decode_attr_type(xdr, bitmap, &type); decode_getfattr_attrs()
4510 status = decode_attr_change(xdr, bitmap, &fattr->change_attr); decode_getfattr_attrs()
4515 status = decode_attr_size(xdr, bitmap, &fattr->size); decode_getfattr_attrs()
4520 status = decode_attr_fsid(xdr, bitmap, &fattr->fsid); decode_getfattr_attrs()
4526 status = decode_attr_error(xdr, bitmap, &err); decode_getfattr_attrs()
4530 status = decode_attr_filehandle(xdr, bitmap, fh); decode_getfattr_attrs()
4534 status = decode_attr_fileid(xdr, bitmap, &fattr->fileid); decode_getfattr_attrs()
4539 status = decode_attr_fs_locations(xdr, bitmap, fs_loc); decode_getfattr_attrs()
4544 status = decode_attr_mode(xdr, bitmap, &fmode); decode_getfattr_attrs()
4552 status = decode_attr_nlink(xdr, bitmap, &fattr->nlink); decode_getfattr_attrs()
4557 status = decode_attr_owner(xdr, bitmap, server, &fattr->uid, fattr->owner_name); decode_getfattr_attrs()
4562 status = decode_attr_group(xdr, bitmap, server, &fattr->gid, fattr->group_name); decode_getfattr_attrs()
4567 status = decode_attr_rdev(xdr, bitmap, &fattr->rdev); decode_getfattr_attrs()
4572 status = decode_attr_space_used(xdr, bitmap, &fattr->du.nfs3.used); decode_getfattr_attrs()
4577 status = decode_attr_time_access(xdr, bitmap, &fattr->atime); decode_getfattr_attrs()
4582 status = decode_attr_time_metadata(xdr, bitmap, &fattr->ctime); decode_getfattr_attrs()
4587 status = decode_attr_time_modify(xdr, bitmap, &fattr->mtime); decode_getfattr_attrs()
4592 status = decode_attr_mounted_on_fileid(xdr, bitmap, &fattr->mounted_on_fileid); decode_getfattr_attrs()
4597 status = decode_attr_mdsthreshold(xdr, bitmap, fattr->mdsthreshold); decode_getfattr_attrs()
4602 status = decode_attr_security_label(xdr, bitmap, label); decode_getfattr_attrs()
4619 bitmap[3] = {0}; decode_getfattr_generic() local
4626 status = decode_attr_bitmap(xdr, bitmap); decode_getfattr_generic()
4634 status = decode_getfattr_attrs(xdr, bitmap, fattr, fh, fs_loc, decode_getfattr_generic()
4696 static int decode_attr_pnfstype(struct xdr_stream *xdr, uint32_t *bitmap, decode_attr_pnfstype() argument
4701 dprintk("%s: bitmap is %x\n", __func__, bitmap[1]); decode_attr_pnfstype()
4702 if (unlikely(bitmap[1] & (FATTR4_WORD1_FS_LAYOUT_TYPES - 1U))) decode_attr_pnfstype()
4704 if (bitmap[1] & FATTR4_WORD1_FS_LAYOUT_TYPES) { decode_attr_pnfstype()
4706 bitmap[1] &= ~FATTR4_WORD1_FS_LAYOUT_TYPES; decode_attr_pnfstype()
4715 static int decode_attr_layout_blksize(struct xdr_stream *xdr, uint32_t *bitmap, decode_attr_layout_blksize() argument
4720 dprintk("%s: bitmap is %x\n", __func__, bitmap[2]); decode_attr_layout_blksize()
4722 if (bitmap[2] & FATTR4_WORD2_LAYOUT_BLKSIZE) { decode_attr_layout_blksize()
4729 bitmap[2] &= ~FATTR4_WORD2_LAYOUT_BLKSIZE; decode_attr_layout_blksize()
4737 uint32_t attrlen, bitmap[3]; decode_fsinfo() local
4742 if ((status = decode_attr_bitmap(xdr, bitmap)) != 0) decode_fsinfo()
4749 if ((status = decode_attr_lease_time(xdr, bitmap, &fsinfo->lease_time)) != 0) decode_fsinfo()
4751 if ((status = decode_attr_maxfilesize(xdr, bitmap, &fsinfo->maxfilesize)) != 0) decode_fsinfo()
4753 if ((status = decode_attr_maxread(xdr, bitmap, &fsinfo->rtmax)) != 0) decode_fsinfo()
4756 if ((status = decode_attr_maxwrite(xdr, bitmap, &fsinfo->wtmax)) != 0) decode_fsinfo()
4759 status = decode_attr_time_delta(xdr, bitmap, &fsinfo->time_delta); decode_fsinfo()
4762 status = decode_attr_pnfstype(xdr, bitmap, &fsinfo->layouttype); decode_fsinfo()
4765 status = decode_attr_layout_blksize(xdr, bitmap, &fsinfo->blksize); decode_fsinfo()
5208 bitmap[3] = {0}; decode_getacl() local
5221 if ((status = decode_attr_bitmap(xdr, bitmap)) != 0) decode_getacl()
5226 if (unlikely(bitmap[0] & (FATTR4_WORD0_ACL - 1U))) decode_getacl()
5228 if (likely(bitmap[0] & FATTR4_WORD0_ACL)) { decode_getacl()
5230 /* The bitmap (xdr len + bitmaps) and the attr xdr len words decode_getacl()
5794 /* Parse notification bitmap, verifying that it is zero. */ decode_getdeviceinfo()
7225 uint32_t bitmap[3] = {0}; nfs4_decode_dirent() local
7260 if (decode_attr_bitmap(xdr, bitmap) < 0) nfs4_decode_dirent()
7266 if (decode_getfattr_attrs(xdr, bitmap, entry->fattr, entry->fh, nfs4_decode_dirent()
3189 decode_attr_fh_expire_type(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *type) decode_attr_fh_expire_type() argument
4382 decode_threshold_hint(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res, uint32_t hint_bit) decode_threshold_hint() argument
4457 decode_attr_mdsthreshold(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs4_threshold *res) decode_attr_mdsthreshold() argument
H A Dcallback_xdr.c121 static __be32 decode_bitmap(struct xdr_stream *xdr, uint32_t *bitmap) decode_bitmap() argument
134 bitmap[0] = ntohl(*p++); decode_bitmap()
136 bitmap[1] = ntohl(*p); decode_bitmap()
202 status = decode_bitmap(xdr, args->bitmap); decode_getattr_args()
332 tmp = ntohl(*p++); /* bitmap size */ decode_devicenotify_args()
500 uint32_t bitmap[2]; decode_recallany_args() local
508 status = decode_bitmap(xdr, bitmap); decode_recallany_args()
511 args->craa_type_mask = bitmap[0]; decode_recallany_args()
545 static __be32 encode_attr_bitmap(struct xdr_stream *xdr, const uint32_t *bitmap, __be32 **savep) encode_attr_bitmap() argument
550 bm[0] = htonl(bitmap[0] & CB_SUPPORTED_ATTR0); encode_attr_bitmap()
551 bm[1] = htonl(bitmap[1] & CB_SUPPORTED_ATTR1); encode_attr_bitmap()
575 static __be32 encode_attr_change(struct xdr_stream *xdr, const uint32_t *bitmap, uint64_t change) encode_attr_change() argument
579 if (!(bitmap[0] & FATTR4_WORD0_CHANGE)) encode_attr_change()
588 static __be32 encode_attr_size(struct xdr_stream *xdr, const uint32_t *bitmap, uint64_t size) encode_attr_size() argument
592 if (!(bitmap[0] & FATTR4_WORD0_SIZE)) encode_attr_size()
613 static __be32 encode_attr_ctime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec *time) encode_attr_ctime() argument
615 if (!(bitmap[1] & FATTR4_WORD1_TIME_METADATA)) encode_attr_ctime()
620 static __be32 encode_attr_mtime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec *time) encode_attr_mtime() argument
622 if (!(bitmap[1] & FATTR4_WORD1_TIME_MODIFY)) encode_attr_mtime()
662 status = encode_attr_bitmap(xdr, res->bitmap, &savep); encode_getattr_res()
665 status = encode_attr_change(xdr, res->bitmap, res->change_attr); encode_getattr_res()
668 status = encode_attr_size(xdr, res->bitmap, res->size); encode_getattr_res()
671 status = encode_attr_ctime(xdr, res->bitmap, &res->ctime); encode_getattr_res()
674 status = encode_attr_mtime(xdr, res->bitmap, &res->mtime); encode_getattr_res()
H A Dcallback.h66 uint32_t bitmap[2]; member in struct:cb_getattrargs
71 uint32_t bitmap[2]; member in struct:cb_getattrres
H A Dcallback_proc.c36 res->bitmap[0] = res->bitmap[1] = 0; nfs4_callback_getattr()
56 res->bitmap[0] = (FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE) & nfs4_callback_getattr()
57 args->bitmap[0]; nfs4_callback_getattr()
58 res->bitmap[1] = (FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY) & nfs4_callback_getattr()
59 args->bitmap[1]; nfs4_callback_getattr()
/linux-4.1.27/drivers/uwb/
H A Ddrp-ie.c139 * Fill a DRP IE's allocation fields from a MAS bitmap.
154 /* Determine unique MAS bitmaps in zones from bitmap. */ uwb_drp_ie_from_bm()
260 * Set MAS bits from given MAS bitmap in a single zone of large bitmap.
262 * We are given a zone id and the MAS bitmap of bits that need to be set in
264 * adds settings - we cannot simply assign the MAS bitmap contents to the
266 * bits that are set in the given MAS bitmap.
282 * uwb_drp_ie_zones_to_bm - convert DRP allocation fields to a bitmap
283 * @mas: MAS bitmap that will be populated to correspond to the
288 * bitmap, 16 bit MAS bitmap) as described in [ECMA-368] section
289 * 16.8.6. The output is a full 256 bit MAS bitmap.
H A Ddrp-avail.c40 #include <linux/bitmap.h>
158 * Initialize bitmap from data buffer.
160 * The bitmap to be converted could come from a IE, for example a
171 * The DRP Availability bitmap is in octets from 0 to 32, so octet
172 * 32 contains bits for MAS 1-8, etc. If the bitmap is smaller than 32
173 * octets, the bits in octets not included at the end of the bitmap are
174 * treated as zero. In this case (when the bitmap is smaller than 32
175 * octets) the MAS represented range from MAS 1 to MAS (size of bitmap)
190 * The resulting bitmap will have the following mapping:
196 * @bmp_itr: pointer to bitmap (can be declared with DECLARE_BITMAP)
197 * @buffer: pointer to buffer containing bitmap data in big endian
199 * @buffer_size:number of bytes with which bitmap should be initialized
221 * Extract DRP Availability bitmap from the notification.
223 * The notification that comes in contains a bitmap of (UWB_NUM_MAS / 8) bytes
265 * this bitmap is needed to generate the real availability (which
H A Die-rcv.c23 #include <linux/bitmap.h>
/linux-4.1.27/fs/btrfs/
H A Dfree-space-cache.c521 void *bitmap) io_ctl_add_entry()
531 entry->type = (bitmap) ? BTRFS_FREE_SPACE_BITMAP : io_ctl_add_entry()
550 static int io_ctl_add_bitmap(struct btrfs_io_ctl *io_ctl, void *bitmap) io_ctl_add_bitmap() argument
566 memcpy(io_ctl->cur, bitmap, PAGE_CACHE_SIZE); io_ctl_add_bitmap()
626 memcpy(entry->bitmap, io_ctl->cur, PAGE_CACHE_SIZE); io_ctl_read_bitmap()
652 if (e->bitmap || prev->bitmap) merge_space_tree()
780 e->bitmap = kzalloc(PAGE_CACHE_SIZE, GFP_NOFS); __load_free_space_cache()
781 if (!e->bitmap) { __load_free_space_cache()
807 * the bitmap entries are added to the cache. __load_free_space_cache()
939 e->bitmap); write_cache_extent_entries()
943 if (e->bitmap) { write_cache_extent_entries()
1099 ret = io_ctl_add_bitmap(io_ctl, entry->bitmap); list_for_each_safe()
1294 * or freeing the bitmap. __btrfs_write_out_cache()
1438 struct rb_node *node, int bitmap) tree_insert_offset()
1454 * we could have a bitmap entry and an extent entry tree_insert_offset()
1459 * extent is faster than allocating from a bitmap. So tree_insert_offset()
1460 * if we're inserting a bitmap and we find an entry at tree_insert_offset()
1463 * found a bitmap, we want to go left, or before tree_insert_offset()
1466 if (bitmap) { tree_insert_offset()
1467 if (info->bitmap) { tree_insert_offset()
1473 if (!info->bitmap) { tree_insert_offset()
1523 if (entry->bitmap) tree_search_offset()
1527 * bitmap entry and extent entry may share same offset, tree_search_offset()
1528 * in that case, bitmap entry comes after extent entry. tree_search_offset()
1537 WARN_ON(!entry->bitmap); tree_search_offset()
1540 if (entry->bitmap) { tree_search_offset()
1543 * we should return it instead of the bitmap entry tree_search_offset()
1549 if (!prev->bitmap && tree_search_offset()
1576 if (entry->bitmap) { tree_search_offset()
1581 if (!prev->bitmap && tree_search_offset()
1594 if (entry->bitmap) { tree_search_offset()
1631 ASSERT(info->bytes || info->bitmap); link_free_space()
1633 &info->offset_index, (info->bitmap != NULL)); link_free_space()
1668 * we want to account for 1 more bitmap than what we have so we can make recalculate_thresholds()
1700 bitmap_clear(info->bitmap, start, count); __bitmap_clear_bits()
1723 bitmap_set(info->bitmap, start, count); bitmap_set_bits()
1747 for_each_set_bit_from(i, bitmap_info->bitmap, BITS_PER_BITMAP) { search_bitmap()
1748 next_zero = find_next_zero_bit(bitmap_info->bitmap, search_bitmap()
1815 if (entry->bitmap) { find_free_space()
1853 kfree(bitmap_info->bitmap); free_bitmap()
1871 * We need to search for bits in this bitmap. We could only cover some remove_from_bitmap()
1872 * of the extent in this bitmap thanks to how we add space, so we need remove_from_bitmap()
1886 /* Cannot clear past the end of the bitmap */ remove_from_bitmap()
1899 * no entry after this bitmap, but we still have bytes to remove_from_bitmap()
1909 * if the next entry isn't a bitmap we need to return to let the remove_from_bitmap()
1912 if (!bitmap_info->bitmap) remove_from_bitmap()
1916 * Ok the next item is a bitmap, but it may not actually hold remove_from_bitmap()
1959 * extent, and don't have to deal with the bitmap use_bitmap()
1967 * the overhead of a bitmap if we don't have to. use_bitmap()
1979 * megabytes, so don't bother with a bitmap for those entries. However use_bitmap()
1980 * some block groups can be smaller than what a bitmap would cover but use_bitmap()
1982 * so allow those block groups to still be allowed to have a bitmap use_bitmap()
2016 * have a cluster here, and if so and it has our bitmap we need to add insert_into_bitmap()
2017 * the free space to that bitmap. insert_into_bitmap()
2035 if (!entry->bitmap) { insert_into_bitmap()
2073 if (info && info->bitmap) { insert_into_bitmap()
2092 /* allocate the bitmap */ insert_into_bitmap()
2093 info->bitmap = kzalloc(PAGE_CACHE_SIZE, GFP_NOFS); insert_into_bitmap()
2095 if (!info->bitmap) { insert_into_bitmap()
2104 if (info->bitmap) insert_into_bitmap()
2105 kfree(info->bitmap); insert_into_bitmap()
2133 if (right_info && !right_info->bitmap) { try_merge_free_space()
2143 if (left_info && !left_info->bitmap && try_merge_free_space()
2162 struct btrfs_free_space *bitmap; steal_from_bitmap_to_end() local
2169 bitmap = tree_search_offset(ctl, bitmap_offset, 1, 0); steal_from_bitmap_to_end()
2170 if (!bitmap) steal_from_bitmap_to_end()
2173 i = offset_to_bit(bitmap->offset, ctl->unit, end); steal_from_bitmap_to_end()
2174 j = find_next_zero_bit(bitmap->bitmap, BITS_PER_BITMAP, i); steal_from_bitmap_to_end()
2181 bitmap_clear_bits(ctl, bitmap, end, bytes); steal_from_bitmap_to_end()
2183 __bitmap_clear_bits(ctl, bitmap, end, bytes); steal_from_bitmap_to_end()
2185 if (!bitmap->bytes) steal_from_bitmap_to_end()
2186 free_bitmap(ctl, bitmap); steal_from_bitmap_to_end()
2195 struct btrfs_free_space *bitmap; steal_from_bitmap_to_front() local
2203 /* If we're on a boundary, try the previous logical bitmap. */ steal_from_bitmap_to_front()
2210 bitmap = tree_search_offset(ctl, bitmap_offset, 1, 0); steal_from_bitmap_to_front()
2211 if (!bitmap) steal_from_bitmap_to_front()
2214 i = offset_to_bit(bitmap->offset, ctl->unit, info->offset) - 1; steal_from_bitmap_to_front()
2217 for_each_clear_bit_from(j, bitmap->bitmap, BITS_PER_BITMAP) { steal_from_bitmap_to_front()
2234 bitmap_clear_bits(ctl, bitmap, info->offset, bytes); steal_from_bitmap_to_front()
2236 __bitmap_clear_bits(ctl, bitmap, info->offset, bytes); steal_from_bitmap_to_front()
2238 if (!bitmap->bytes) steal_from_bitmap_to_front()
2239 free_bitmap(ctl, bitmap); steal_from_bitmap_to_front()
2247 * entry, try to see if there's adjacent free space in bitmap entries, and if
2252 * region (e.g. 1 extent entry + 1 bitmap entry starting where the extent entry
2263 ASSERT(!info->bitmap); steal_from_bitmap()
2302 * before we do that see if we need to drop this into a bitmap __btrfs_add_free_space()
2314 * going to add the new free space to existing bitmap entries - because __btrfs_add_free_space()
2353 * to remove, look for a bitmap instead btrfs_remove_free_space()
2360 * bitmap but then couldn't find the other part this may btrfs_remove_free_space()
2369 if (!info->bitmap) { btrfs_remove_free_space()
2437 "entry offset %llu, bytes %llu, bitmap %s", btrfs_dump_free_space()
2439 (info->bitmap) ? "yes" : "no"); btrfs_dump_free_space()
2493 bool bitmap; __btrfs_return_cluster_to_free_space() local
2500 bitmap = (entry->bitmap != NULL); __btrfs_return_cluster_to_free_space()
2501 if (!bitmap) { __btrfs_return_cluster_to_free_space()
2506 entry->offset, &entry->offset_index, bitmap); __btrfs_return_cluster_to_free_space()
2524 if (!info->bitmap) { __btrfs_remove_free_space_cache_locked()
2582 if (entry->bitmap) { btrfs_find_space_for_alloc()
2710 (!entry->bitmap && entry->offset < min_start)) { btrfs_alloc_from_cluster()
2719 if (entry->bitmap) { btrfs_alloc_from_cluster()
2755 if (entry->bitmap) { btrfs_alloc_from_cluster()
2756 kfree(entry->bitmap); btrfs_alloc_from_cluster()
2791 for_each_set_bit_from(i, entry->bitmap, BITS_PER_BITMAP) { btrfs_bitmap_cluster()
2792 next_zero = find_next_zero_bit(entry->bitmap, btrfs_bitmap_cluster()
2858 while (entry->bitmap || entry->bytes < min_bytes) { setup_cluster_no_bitmap()
2859 if (entry->bitmap && list_empty(&entry->list)) setup_cluster_no_bitmap()
2876 if (entry->bitmap) { setup_cluster_no_bitmap()
2907 if (entry->bitmap || entry->bytes < min_bytes) setup_cluster_no_bitmap()
2941 * The bitmap that covers offset won't be in the list unless offset setup_cluster_bitmap()
3142 while (entry->bitmap) { trim_no_bitmap()
3341 * the tree, if the left-most item is a bitmap.
3357 if (!entry->bitmap) { btrfs_find_ino_for_alloc()
3503 * Use this if you need to make a bitmap or extent entry specifically, it
3509 u64 offset, u64 bytes, bool bitmap) test_add_free_space_entry()
3524 if (!bitmap) { test_add_free_space_entry()
3547 info->bitmap = map; test_add_free_space_entry()
3591 if (info->bitmap) { test_check_exists()
520 io_ctl_add_entry(struct btrfs_io_ctl *io_ctl, u64 offset, u64 bytes, void *bitmap) io_ctl_add_entry() argument
1437 tree_insert_offset(struct rb_root *root, u64 offset, struct rb_node *node, int bitmap) tree_insert_offset() argument
3508 test_add_free_space_entry(struct btrfs_block_group_cache *cache, u64 offset, u64 bytes, bool bitmap) test_add_free_space_entry() argument
H A Dfree-space-cache.h26 unsigned long *bitmap; member in struct:btrfs_free_space
128 u64 offset, u64 bytes, bool bitmap);
/linux-4.1.27/net/netlabel/
H A Dnetlabel_kapi.c412 * @catmap: pointer to the category bitmap
472 * @catmap: the category bitmap
476 * This function walks a LSM secattr category bitmap starting at @offset and
485 NETLBL_CATMAP_MAPTYPE bitmap; netlbl_catmap_walk() local
498 bitmap = iter->bitmap[idx] >> bit; netlbl_catmap_walk()
501 if (bitmap != 0) { netlbl_catmap_walk()
502 while ((bitmap & NETLBL_CATMAP_BIT) == 0) { netlbl_catmap_walk()
503 bitmap >>= 1; netlbl_catmap_walk()
516 bitmap = iter->bitmap[idx]; netlbl_catmap_walk()
525 * @catmap: the category bitmap
529 * This function walks a LSM secattr category bitmap starting at @offset and
531 * the end of the bitmap.
541 NETLBL_CATMAP_MAPTYPE bitmap; netlbl_catmap_walkrng() local
557 bitmap = iter->bitmap[idx]; netlbl_catmap_walkrng()
558 while (bitmask != 0 && (bitmap & bitmask) != 0) { netlbl_catmap_walkrng()
583 * netlbl_catmap_getlong - Export an unsigned long bitmap
584 * @catmap: pointer to the category bitmap
586 * @bitmap: the exported bitmap
589 * Export a bitmap with an offset greater than or equal to @offset and return
590 * it in @bitmap. The @offset must be aligned to an unsigned long and will be
598 unsigned long *bitmap) netlbl_catmap_getlong()
625 *bitmap = iter->bitmap[idx] >> (off % NETLBL_CATMAP_SIZE); netlbl_catmap_getlong()
632 * @catmap: pointer to the category bitmap
654 iter->bitmap[idx] |= NETLBL_CATMAP_BIT << (bit % NETLBL_CATMAP_MAPSIZE); netlbl_catmap_setbit()
661 * @catmap: pointer to the category bitmap
695 * netlbl_catmap_setlong - Import an unsigned long bitmap
696 * @catmap: pointer to the category bitmap
697 * @offset: offset to the start of the imported bitmap
698 * @bitmap: the bitmap to import
702 * Import the bitmap specified in @bitmap into @catmap, using the offset
709 unsigned long bitmap, netlbl_catmap_setlong()
725 iter->bitmap[idx] |= bitmap << (offset % NETLBL_CATMAP_MAPSIZE); netlbl_catmap_setlong()
596 netlbl_catmap_getlong(struct netlbl_lsm_catmap *catmap, u32 *offset, unsigned long *bitmap) netlbl_catmap_getlong() argument
707 netlbl_catmap_setlong(struct netlbl_lsm_catmap **catmap, u32 offset, unsigned long bitmap, gfp_t flags) netlbl_catmap_setlong() argument
/linux-4.1.27/fs/nilfs2/
H A Dalloc.c77 a bitmap block */ nilfs_palloc_init_blockgroup()
118 * nilfs_palloc_bitmap_blkoff - get block offset of a bitmap block
122 * nilfs_palloc_bitmap_blkoff() returns block offset of the bitmap
262 * nilfs_palloc_get_bitmap_block - get buffer head of a bitmap block
338 * @bitmap: bitmap of the group
344 unsigned char *bitmap, nilfs_palloc_find_available_slot()
353 pos = nilfs_find_next_zero_bit(bitmap, end, target); nilfs_palloc_find_available_slot()
356 nilfs_mdt_bgl_lock(inode, group), pos, bitmap)) nilfs_palloc_find_available_slot()
367 while (*((unsigned long *)bitmap + curr / BITS_PER_LONG) nilfs_palloc_find_available_slot()
372 pos = nilfs_find_next_zero_bit(bitmap, end, curr); nilfs_palloc_find_available_slot()
376 bitmap)) nilfs_palloc_find_available_slot()
474 unsigned char *bitmap; nilfs_palloc_prepare_alloc_entry() local
511 bitmap = bitmap_kaddr + bh_offset(bitmap_bh); nilfs_palloc_prepare_alloc_entry()
513 inode, group, group_offset, bitmap, nilfs_palloc_prepare_alloc_entry()
574 unsigned char *bitmap; nilfs_palloc_commit_free_entry() local
582 bitmap = bitmap_kaddr + bh_offset(req->pr_bitmap_bh); nilfs_palloc_commit_free_entry()
585 group_offset, bitmap)) nilfs_palloc_commit_free_entry()
612 unsigned char *bitmap; nilfs_palloc_abort_alloc_entry() local
620 bitmap = bitmap_kaddr + bh_offset(req->pr_bitmap_bh); nilfs_palloc_abort_alloc_entry()
622 group_offset, bitmap)) nilfs_palloc_abort_alloc_entry()
708 unsigned char *bitmap; nilfs_palloc_freev() local
728 bitmap = bitmap_kaddr + bh_offset(bitmap_bh); nilfs_palloc_freev()
736 group_offset, bitmap)) { nilfs_palloc_freev()
341 nilfs_palloc_find_available_slot(struct inode *inode, unsigned long group, unsigned long target, unsigned char *bitmap, int bsize) nilfs_palloc_find_available_slot() argument
H A Dalloc.h37 * that a bitmap block can maintain.
57 * @pr_bitmap_bh: buffer head of the buffer containing a block group bitmap
95 * @prev_bitmap: blockgroup bitmap cache
/linux-4.1.27/drivers/misc/vmw_vmci/
H A Dvmci_doorbell.c64 * The max_notify_idx is one larger than the currently known bitmap index in
65 * use, and is used to determine how much of the bitmap needs to be scanned.
71 * within the bitmap (if notify_idx_count + 1 < max_notify_idx).
124 * Find doorbell entry by bitmap index.
156 * bitmap with "not too much" sharing between resources. If we dbell_index_table_add()
157 * use less that the full bitmap, we either add to the end if dbell_index_table_add()
159 * or we search for unused ones. If we use the full bitmap, we dbell_index_table_add()
234 * index in the bitmap in the device backend. A notification state
252 * Unlinks the given doorbell handle from an index in the bitmap in
331 * Register the notification bitmap with the host.
347 pr_devel("Failed to register (PPN=%u) as notification bitmap (error=%d)\n", vmci_dbell_register_notification_bitmap()
380 * Scans the notification bitmap, collects pending notifications,
381 * resets the bitmap and invokes appropriate callbacks.
383 void vmci_dbell_scan_notification_entries(u8 *bitmap) vmci_dbell_scan_notification_entries() argument
388 if (bitmap[idx] & 0x1) { vmci_dbell_scan_notification_entries()
389 bitmap[idx] &= ~1; vmci_dbell_scan_notification_entries()
H A Dvmci_doorbell.h49 void vmci_dbell_scan_notification_entries(u8 *bitmap);
/linux-4.1.27/drivers/gpu/drm/qxl/
H A Dqxl_image.c203 image->u.bitmap.format = SPICE_BITMAP_FMT_1BIT_BE; qxl_image_init_helper()
206 image->u.bitmap.format = SPICE_BITMAP_FMT_24BIT; qxl_image_init_helper()
209 image->u.bitmap.format = SPICE_BITMAP_FMT_32BIT; qxl_image_init_helper()
215 image->u.bitmap.flags = QXL_BITMAP_TOP_DOWN; qxl_image_init_helper()
216 image->u.bitmap.x = width; qxl_image_init_helper()
217 image->u.bitmap.y = height; qxl_image_init_helper()
218 image->u.bitmap.stride = chunk_stride; qxl_image_init_helper()
219 image->u.bitmap.palette = 0; qxl_image_init_helper()
220 image->u.bitmap.data = qxl_bo_physical_address(qdev, chunk_bo, 0); qxl_image_init_helper()
/linux-4.1.27/arch/mips/lasat/
H A Dpicvue.h29 int pvc_program_cg(int charnum, u8 bitmap[BM_SIZE]);
H A Dpicvue.c148 int pvc_program_cg(int charnum, u8 bitmap[BM_SIZE]) pvc_program_cg() argument
160 pvc_write(bitmap[i], MODE_DATA); pvc_program_cg()
/linux-4.1.27/arch/powerpc/include/asm/
H A Dmsi_bitmap.h19 unsigned long *bitmap; member in struct:msi_bitmap
/linux-4.1.27/fs/udf/
H A Dballoc.c35 struct udf_bitmap *bitmap, unsigned int block, read_block_bitmap()
42 loc.logicalBlockNum = bitmap->s_extPosition; read_block_bitmap()
49 bitmap->s_block_bitmap[bitmap_nr] = bh; read_block_bitmap()
54 struct udf_bitmap *bitmap, __load_block_bitmap()
58 int nr_groups = bitmap->s_nr_groups; __load_block_bitmap()
65 if (bitmap->s_block_bitmap[block_group]) __load_block_bitmap()
68 retval = read_block_bitmap(sb, bitmap, block_group, block_group); __load_block_bitmap()
76 struct udf_bitmap *bitmap, load_block_bitmap()
81 slot = __load_block_bitmap(sb, bitmap, block_group); load_block_bitmap()
86 if (!bitmap->s_block_bitmap[slot]) load_block_bitmap()
106 struct udf_bitmap *bitmap, udf_bitmap_free_blocks()
147 bitmap_nr = load_block_bitmap(sb, bitmap, block_group); udf_bitmap_free_blocks()
151 bh = bitmap->s_block_bitmap[bitmap_nr]; udf_bitmap_free_blocks()
172 struct udf_bitmap *bitmap, udf_bitmap_prealloc_blocks()
197 bitmap_nr = load_block_bitmap(sb, bitmap, block_group); udf_bitmap_prealloc_blocks()
200 bh = bitmap->s_block_bitmap[bitmap_nr]; udf_bitmap_prealloc_blocks()
222 struct udf_bitmap *bitmap, uint16_t partition, udf_bitmap_new_block()
239 nr_groups = bitmap->s_nr_groups; udf_bitmap_new_block()
244 bitmap_nr = load_block_bitmap(sb, bitmap, block_group); udf_bitmap_new_block()
247 bh = bitmap->s_block_bitmap[bitmap_nr]; udf_bitmap_new_block()
283 bitmap_nr = load_block_bitmap(sb, bitmap, block_group); udf_bitmap_new_block()
286 bh = bitmap->s_block_bitmap[bitmap_nr]; udf_bitmap_new_block()
34 read_block_bitmap(struct super_block *sb, struct udf_bitmap *bitmap, unsigned int block, unsigned long bitmap_nr) read_block_bitmap() argument
53 __load_block_bitmap(struct super_block *sb, struct udf_bitmap *bitmap, unsigned int block_group) __load_block_bitmap() argument
75 load_block_bitmap(struct super_block *sb, struct udf_bitmap *bitmap, unsigned int block_group) load_block_bitmap() argument
105 udf_bitmap_free_blocks(struct super_block *sb, struct udf_bitmap *bitmap, struct kernel_lb_addr *bloc, uint32_t offset, uint32_t count) udf_bitmap_free_blocks() argument
171 udf_bitmap_prealloc_blocks(struct super_block *sb, struct udf_bitmap *bitmap, uint16_t partition, uint32_t first_block, uint32_t block_count) udf_bitmap_prealloc_blocks() argument
221 udf_bitmap_new_block(struct super_block *sb, struct udf_bitmap *bitmap, uint16_t partition, uint32_t goal, int *err) udf_bitmap_new_block() argument
H A Dsuper.c38 * 12/20/98 find the free space bitmap (if it exists)
56 #include <linux/bitmap.h>
277 static void udf_sb_free_bitmap(struct udf_bitmap *bitmap) udf_sb_free_bitmap() argument
280 int nr_groups = bitmap->s_nr_groups; udf_sb_free_bitmap()
285 if (bitmap->s_block_bitmap[i]) udf_sb_free_bitmap()
286 brelse(bitmap->s_block_bitmap[i]); udf_sb_free_bitmap()
289 kfree(bitmap); udf_sb_free_bitmap()
291 vfree(bitmap); udf_sb_free_bitmap()
1011 * bitmap file entry udf_load_metadata_files()
1013 * Load only if bitmap file location differs from 0xFFFFFFFF (DCN-5102) udf_load_metadata_files()
1025 udf_warn(sb, "bitmap inode efe not found but it's ok since the disc is mounted read-only\n"); udf_load_metadata_files()
1027 udf_err(sb, "bitmap inode efe not found and attempted read-write mount\n"); udf_load_metadata_files()
1063 struct udf_bitmap *bitmap; udf_sb_alloc_bitmap() local
1072 bitmap = kzalloc(size, GFP_KERNEL); udf_sb_alloc_bitmap()
1074 bitmap = vzalloc(size); /* TODO: get rid of vzalloc */ udf_sb_alloc_bitmap()
1076 if (bitmap == NULL) udf_sb_alloc_bitmap()
1079 bitmap->s_nr_groups = nr_groups; udf_sb_alloc_bitmap()
1080 return bitmap; udf_sb_alloc_bitmap()
1134 struct udf_bitmap *bitmap = udf_sb_alloc_bitmap(sb, p_index); udf_fill_partdesc_info() local
1135 if (!bitmap) udf_fill_partdesc_info()
1137 map->s_uspace.s_bitmap = bitmap; udf_fill_partdesc_info()
1138 bitmap->s_extPosition = le32_to_cpu( udf_fill_partdesc_info()
1142 p_index, bitmap->s_extPosition); udf_fill_partdesc_info()
1169 struct udf_bitmap *bitmap = udf_sb_alloc_bitmap(sb, p_index); udf_fill_partdesc_info() local
1170 if (!bitmap) udf_fill_partdesc_info()
1172 map->s_fspace.s_bitmap = bitmap; udf_fill_partdesc_info()
1173 bitmap->s_extPosition = le32_to_cpu( udf_fill_partdesc_info()
1177 p_index, bitmap->s_extPosition); udf_fill_partdesc_info()
2350 struct udf_bitmap *bitmap) udf_count_free_bitmap()
2362 loc.logicalBlockNum = bitmap->s_extPosition; udf_count_free_bitmap()
2349 udf_count_free_bitmap(struct super_block *sb, struct udf_bitmap *bitmap) udf_count_free_bitmap() argument
/linux-4.1.27/include/uapi/linux/dvb/
H A Dosd.h112 OSD_BITMAP1, /* 1 bit bitmap */
113 OSD_BITMAP2, /* 2 bit bitmap */
114 OSD_BITMAP4, /* 4 bit bitmap */
115 OSD_BITMAP8, /* 8 bit bitmap */
116 OSD_BITMAP1HR, /* 1 Bit bitmap half resolution */
117 OSD_BITMAP2HR, /* 2 bit bitmap half resolution */
118 OSD_BITMAP4HR, /* 4 bit bitmap half resolution */
119 OSD_BITMAP8HR, /* 8 bit bitmap half resolution */
/linux-4.1.27/include/uapi/linux/
H A Defs_fs_sb.h38 __be32 fs_bmsize; /* size of bitmap in bytes */
41 __be32 fs_bmblock; /* bitmap location. */
H A Dvirtio_9p.h32 /* The feature bitmap for virtio 9P */
H A Dvirtio_input.h64 __u8 bitmap[128]; member in union:virtio_input_config::__anon13773
/linux-4.1.27/arch/s390/lib/
H A Dfind.c10 * in a bitmap starting at bit 0 (MSB) and we don't want to scan the bitmap
/linux-4.1.27/drivers/net/ethernet/mellanox/mlx5/core/
H A Duar.c146 uuari->bitmap = kcalloc(BITS_TO_LONGS(tot_uuars), sizeof(*uuari->bitmap), mlx5_alloc_uuars()
148 if (!uuari->bitmap) { mlx5_alloc_uuars()
200 kfree(uuari->bitmap); mlx5_alloc_uuars()
220 kfree(uuari->bitmap); mlx5_free_uuars()
H A Dalloc.c37 #include <linux/bitmap.h>
145 bitmap_fill(pgdir->bitmap, MLX5_DB_PER_PAGE); mlx5_alloc_db_pgdir()
162 i = find_first_bit(pgdir->bitmap, MLX5_DB_PER_PAGE); mlx5_alloc_db_from_pgdir()
166 __clear_bit(i, pgdir->bitmap); mlx5_alloc_db_from_pgdir()
213 __set_bit(db->index, db->u.pgdir->bitmap); mlx5_db_free()
215 if (bitmap_full(db->u.pgdir->bitmap, MLX5_DB_PER_PAGE)) { mlx5_db_free()
/linux-4.1.27/arch/ia64/include/asm/
H A Dmmu_context.h40 unsigned long *bitmap; /* bitmap size is max_ctx+1 */ member in struct:ia64_ctx
92 ia64_ctx.next = find_next_zero_bit(ia64_ctx.bitmap, get_mmu_context()
94 ia64_ctx.limit = find_next_bit(ia64_ctx.bitmap, get_mmu_context()
100 __set_bit(context, ia64_ctx.bitmap); get_mmu_context()
/linux-4.1.27/drivers/net/wireless/rtlwifi/
H A Dcam.c283 u32 bitmap = (rtlpriv->sec.hwsec_cam_bitmap) >> 4; rtl_cam_get_free_entry() local
300 if ((bitmap & BIT(0)) == 0) { rtl_cam_get_free_entry()
309 bitmap = bitmap >> 1; rtl_cam_get_free_entry()
318 u32 bitmap; rtl_cam_del_entry() local
335 bitmap = (rtlpriv->sec.hwsec_cam_bitmap) >> i; rtl_cam_del_entry()
336 if (((bitmap & BIT(0)) == BIT(0)) && rtl_cam_del_entry()
/linux-4.1.27/drivers/base/
H A Ddma-coherent.c16 unsigned long *bitmap; member in struct:dma_coherent_mem
41 dma_mem->bitmap = kzalloc(bitmap_size, GFP_KERNEL); dma_init_coherent_memory()
42 if (!dma_mem->bitmap) dma_init_coherent_memory()
71 kfree(mem->bitmap); dma_release_coherent_memory()
131 err = bitmap_allocate_region(mem->bitmap, pos, get_order(size)); dma_mark_declared_memory_occupied()
175 pageno = bitmap_find_free_region(mem->bitmap, mem->size, order); dma_alloc_from_coherent()
223 bitmap_release_region(mem->bitmap, page, order); dma_release_from_coherent()
/linux-4.1.27/include/net/
H A Dieee80211_radiotap.h50 * based on a bitmap indicating which fields are present.
76 __le32 it_present; /* A bitmap telling which
79 * bitmap by another 32 bits.
94 * IEEE80211_RADIOTAP_CHANNEL 2 x __le16 MHz, bitmap
155 * IEEE80211_RADIOTAP_FLAGS u8 bitmap
165 * IEEE80211_RADIOTAP_RX_FLAGS __le16 bitmap
169 * IEEE80211_RADIOTAP_TX_FLAGS __le16 bitmap
183 * Contains a bitmap of known fields/flags, the flags, and
218 /* valid in every it_present bitmap, even vendor namespaces */
H A Dnetlabel.h142 * struct netlbl_lsm_catmap - NetLabel LSM secattr category bitmap
143 * @startbit: the value of the lowest order bit in the bitmap
144 * @bitmap: the category bitmap
145 * @next: pointer to the next bitmap "node" or NULL
150 * practical to transfer a full bitmap internally so NetLabel adopts a sparse
151 * bitmap structure modeled after SELinux's ebitmap structure.
152 * The catmap bitmap field MUST be a power of two in length and large
167 NETLBL_CATMAP_MAPTYPE bitmap[NETLBL_CATMAP_MAPCNT]; member in struct:netlbl_lsm_catmap
178 * @attr.mls.cat: MLS category bitmap
193 /* bitmap values for 'flags' */
202 /* bitmap meta-values for 'flags' */
276 * @catmap: the category bitmap
395 unsigned long *bitmap);
405 unsigned long bitmap,
510 unsigned long *bitmap) netlbl_catmap_getlong()
529 unsigned long bitmap, netlbl_catmap_setlong()
508 netlbl_catmap_getlong(struct netlbl_lsm_catmap *catmap, u32 *offset, unsigned long *bitmap) netlbl_catmap_getlong() argument
527 netlbl_catmap_setlong(struct netlbl_lsm_catmap **catmap, u32 offset, unsigned long bitmap, gfp_t flags) netlbl_catmap_setlong() argument
/linux-4.1.27/arch/c6x/mm/
H A Ddma-coherent.c18 #include <linux/bitmap.h>
39 /* bitmap lock */
133 /* allocate bitmap */ coherent_mem_init()
/linux-4.1.27/fs/ext2/
H A Dballoc.c27 * blocks groups. Each group contains 1 bitmap block for blocks, 1 bitmap
31 * super block. Each descriptor contains the number of the bitmap block and
85 /* check whether block bitmap block number is set */ ext2_valid_block_bitmap()
89 /* bad block bitmap */ ext2_valid_block_bitmap()
92 /* check whether the inode bitmap block number is set */ ext2_valid_block_bitmap()
96 /* bad block bitmap */ ext2_valid_block_bitmap()
106 /* good bitmap for inode tables */ ext2_valid_block_bitmap()
111 "Invalid block bitmap - " ext2_valid_block_bitmap()
118 * Read the bitmap for a given block_group,and validate the
137 "Cannot read block bitmap - " read_block_bitmap()
148 "Cannot read block bitmap - " read_block_bitmap()
157 * bitmap read_block_bitmap()
572 * @bh: bufferhead contains the block group bitmap
575 * The bitmap search --- search forward through the actual bitmap on disk until
593 * allocatable block in bitmap.
594 * @bh: bufferhead contains the block group bitmap
597 * Find an allocatable block in a bitmap. We perform the "most
599 * the initial goal; then for a free byte somewhere in the bitmap;
600 * then for any free bit in the bitmap.
645 * @bitmap_bh: bufferhead holds the block bitmap
651 * first, then find the first free bit(s) from the bitmap (within the range),
661 * new bitmap.
846 * disk bitmap later and then, if there are free blocks then we adjust find_next_reservable_window()
870 * there, we check the bitmap for the first free block after
895 * @bitmap_bh: the block group block bitmap
966 * need to check the bitmap after we found a reservable window. alloc_new_reservation()
985 * Search the first free bit on the block bitmap. Search starts from alloc_new_reservation()
995 * no free block left on the bitmap, no point alloc_new_reservation()
1069 * @bitmap_bh: bufferhead holds the block bitmap
1079 * looking for a free bit on bitmap first, then look up the reservation list to
1207 * bitmap, and then for any free bit if that fails.
1323 * skip this group (and avoid loading bitmap) if there ext2_new_blocks()
/linux-4.1.27/net/ipv4/
H A Dcipso_ipv4.c89 /* Restricted bitmap (tag #1) flags */
105 /* Base length of the restrictive category bitmap tag (tag #1). */
111 /* Base length of the ranged categories bitmap tag (tag #5). */
138 * cipso_v4_bitmap_walk - Walk a bitmap looking for a bit
139 * @bitmap: the bitmap
145 * Starting at @offset, walk the bitmap from left to right until either the
149 static int cipso_v4_bitmap_walk(const unsigned char *bitmap, cipso_v4_bitmap_walk() argument
161 byte = bitmap[byte_offset]; cipso_v4_bitmap_walk()
173 byte = bitmap[++byte_offset]; cipso_v4_bitmap_walk()
182 * cipso_v4_bitmap_setbit - Sets a single bit in a bitmap
183 * @bitmap: the bitmap
191 static void cipso_v4_bitmap_setbit(unsigned char *bitmap, cipso_v4_bitmap_setbit() argument
202 bitmap[byte_spot] |= bitmask; cipso_v4_bitmap_setbit()
204 bitmap[byte_spot] &= ~bitmask; cipso_v4_bitmap_setbit()
816 * cipso_v4_map_cat_rbm_valid - Checks to see if the category bitmap is valid
818 * @bitmap: category bitmap
819 * @bitmap_len: bitmap length in bytes
822 * Checks the given category bitmap against the given DOI definition and
823 * returns a negative value if any of the categories in the bitmap do not have
828 const unsigned char *bitmap, cipso_v4_map_cat_rbm_valid()
843 cat = cipso_v4_bitmap_walk(bitmap, cipso_v4_map_cat_rbm_valid()
866 * @net_cat: the zero'd out category bitmap in network/CIPSO format
867 * @net_cat_len: the length of the CIPSO bitmap in bytes
870 * Perform a label mapping to translate a local MLS category bitmap to the
871 * correct CIPSO bitmap using the given DOI definition. Returns the minimum
872 * size in bytes of the network bitmap on success, negative values otherwise.
926 * @net_cat: the category bitmap in network/CIPSO format
927 * @net_cat_len: the length of the CIPSO bitmap in bytes
931 * Perform a label mapping to translate a CIPSO bitmap to the correct local
932 * MLS category bitmap using the given DOI definition. Returns zero on
1027 * Perform a label mapping to translate a local MLS category bitmap to the
1029 * size in bytes of the network category bitmap on success, negative values
1059 * @net_cat_len: the length of the CIPSO bitmap in bytes
1064 * local MLS category bitmap using the given DOI definition. Returns zero on
1135 * Perform a label mapping to translate a local MLS category bitmap to the
1137 * size in bytes of the network category bitmap on success, negative values
1191 * @net_cat_len: the length of the CIPSO bitmap in bytes
1196 * local MLS category bitmap using the given DOI definition. Returns zero on
1252 * cipso_v4_gentag_rbm - Generate a CIPSO restricted bitmap tag (type #1)
1259 * Generate a CIPSO option using the restricted bitmap tag, tag type #1. The
1309 * cipso_v4_parsetag_rbm - Parse a CIPSO restricted bitmap tag
1315 * Parse a CIPSO restricted bitmap tag (tag type #1) and return the security
827 cipso_v4_map_cat_rbm_valid(const struct cipso_v4_doi *doi_def, const unsigned char *bitmap, u32 bitmap_len) cipso_v4_map_cat_rbm_valid() argument
/linux-4.1.27/drivers/crypto/ux500/cryp/
H A Dcryp_irq.c12 #include <linux/bitmap.h>
/linux-4.1.27/include/video/
H A Dmaxinefb.h31 #define IMS332_REG_CURSOR_RAM 0x200 /* hardware cursor bitmap */
/linux-4.1.27/tools/include/asm-generic/bitops/
H A Dfind.h9 * @size: The bitmap size in bits
/linux-4.1.27/drivers/hid/
H A Dhid-picolcd_fb.c151 static int picolcd_fb_update_tile(u8 *vbitmap, const u8 *bitmap, int bpp, picolcd_fb_update_tile() argument
160 const u8 *bdata = bitmap + tile * 256 + chip * 8 + b * 32; picolcd_fb_update_tile()
168 const u8 *bdata = bitmap + (tile * 256 + chip * 8 + b * 32) * 8; picolcd_fb_update_tile()
221 memset(fbdata->bitmap, 0, PICOLCDFB_SIZE*fbdata->bpp); picolcd_fb_reset()
260 fbdata->vbitmap, fbdata->bitmap, picolcd_fb_update()
396 o_fb = fbdata->bitmap; picolcd_set_par()
550 fbdata->bitmap = vmalloc(PICOLCDFB_SIZE*8); picolcd_init_framebuffer()
551 if (fbdata->bitmap == NULL) { picolcd_init_framebuffer()
555 info->screen_base = (char __force __iomem *)fbdata->bitmap; picolcd_init_framebuffer()
556 info->fix.smem_start = (unsigned long)fbdata->bitmap; picolcd_init_framebuffer()
588 vfree(fbdata->bitmap); picolcd_init_framebuffer()
/linux-4.1.27/drivers/net/wireless/ti/wl12xx/
H A Devent.h76 /* bitmap of aged stations (by HLID) */
79 /* bitmap of stations (by HLID) which exceeded max tx retries */
H A Dwl12xx.h141 * A bitmap (where each bit represents a single HLID)
147 * A bitmap (where each bit represents a single HLID) to indicate
H A Dacx.c45 wl1271_warning("wl1271 bitmap config opt failed: %d", ret); wl1271_acx_host_if_cfg_bitmap()
/linux-4.1.27/arch/sparc/lib/
H A Dbitext.c13 #include <linux/bitmap.h>
68 "bitmap out: size %d used %d off %d len %d align %d count %d\n", bit_map_string_get()
/linux-4.1.27/arch/mips/dec/prom/
H A Dmemory.c57 * Use the REX prom calls to get hold of the memory bitmap, and thence
73 if (bm->bitmap[i] == 0xff) rex_setup_memory_region()
/linux-4.1.27/fs/ocfs2/cluster/
H A Dnodemanager.h69 /* this bitmap is part of a hack for disk bitmap.. will go eventually. - zab */
/linux-4.1.27/drivers/staging/comedi/drivers/
H A Dni_usb6501.c175 const u8 *port, u8 *bitmap) ni6501_port_command()
183 if (command != SET_PORT_DIR && !bitmap) ni6501_port_command()
200 tx[17] = bitmap[0]; ni6501_port_command()
238 bitmap[0] = devpriv->usb_rx_buf[14]; ni6501_port_command()
239 /* mask bitmap for comparing */ ni6501_port_command()
377 u8 bitmap; ni6501_dio_insn_bits() local
383 bitmap = (s->state >> port * 8) & 0xFF; ni6501_dio_insn_bits()
385 &port, &bitmap); ni6501_dio_insn_bits()
394 ret = ni6501_port_command(dev, READ_PORT, &port, &bitmap); ni6501_dio_insn_bits()
397 data[1] |= bitmap << port * 8; ni6501_dio_insn_bits()
174 ni6501_port_command(struct comedi_device *dev, int command, const u8 *port, u8 *bitmap) ni6501_port_command() argument
/linux-4.1.27/fs/xfs/libxfs/
H A Dxfs_rtbitmap.c41 * Realtime allocator bitmap functions shared with userspace.
45 * Get a buffer for the bitmap or summary file block specified.
52 xfs_rtblock_t block, /* block number in bitmap or summary */ xfs_rtbuf_get()
53 int issum, /* is summary not bitmap */ xfs_rtbuf_get()
57 xfs_inode_t *ip; /* bitmap or summary inode */ xfs_rtbuf_get()
92 xfs_rtblock_t block; /* bitmap block number */ xfs_rtfind_back()
105 * Compute and read in starting bitmap block for starting block. xfs_rtfind_back()
267 xfs_rtblock_t block; /* bitmap block number */ xfs_rtfind_forw()
280 * Compute and read in starting bitmap block for starting block. xfs_rtfind_forw()
425 * bitmap block combination.
437 xfs_rtblock_t bbno, /* bitmap block number */ xfs_rtmodify_summary_int()
501 xfs_rtblock_t bbno, /* bitmap block number */ xfs_rtmodify_summary()
511 * Set the given range of bitmap bits to the given value.
524 xfs_rtblock_t block; /* bitmap block number */ xfs_rtmodify_range()
535 * Compute starting bitmap block number. xfs_rtmodify_range()
539 * Read the bitmap block, and point to its data. xfs_rtmodify_range()
669 * Updates all the summary information as well as the bitmap.
687 * Modify the bitmap to mark this extent freed. xfs_rtfree_range()
759 xfs_rtblock_t block; /* bitmap block number */ xfs_rtcheck_range()
770 * Compute starting bitmap block number xfs_rtcheck_range()
774 * Read the bitmap block. xfs_rtcheck_range()
H A Dxfs_types.h32 typedef __int32_t xfs_suminfo_t; /* type of bitmap summary info */
33 typedef __int32_t xfs_rtword_t; /* word type for bitmap manipulations */
H A Dxfs_bit.h78 /* Return whether bitmap is empty (1 == empty) */
/linux-4.1.27/drivers/staging/rtl8188eu/hal/
H A Drtl8188e_cmd.c151 /* bitmap[0:27] = tx_rate_bitmap */
152 /* bitmap[28:31]= Rate Adaptive id */
155 void rtl8188e_Add_RateATid(struct adapter *pAdapter, u32 bitmap, u8 arg, u8 rssi_level) rtl8188e_Add_RateATid() argument
163 raid = (bitmap>>28) & 0x0f; rtl8188e_Add_RateATid()
164 bitmap &= 0x0fffffff; rtl8188e_Add_RateATid()
167 bitmap = ODM_Get_Rate_Bitmap(&haldata->odmpriv, macid, bitmap, rssi_level); rtl8188e_Add_RateATid()
169 bitmap |= ((raid<<28)&0xf0000000); rtl8188e_Add_RateATid()
171 init_rate = get_highest_rate_idx(bitmap&0x0fffffff)&0x3f; rtl8188e_Add_RateATid()
178 raid = (bitmap>>28) & 0x0f; rtl8188e_Add_RateATid()
180 bitmap &= 0x0fffffff; rtl8188e_Add_RateATid()
183 __func__, macid, raid, bitmap, shortGIrate); rtl8188e_Add_RateATid()
185 ODM_RA_UpdateRateInfo_8188E(&(haldata->odmpriv), macid, raid, bitmap, shortGIrate); rtl8188e_Add_RateATid()
/linux-4.1.27/arch/um/drivers/
H A Dubd_kern.c124 unsigned long *bitmap; member in struct:cow
157 .bitmap = NULL, \
727 vfree(ubd_dev->cow.bitmap); ubd_close_dev()
728 ubd_dev->cow.bitmap = NULL; ubd_close_dev()
771 ubd_dev->cow.bitmap = vmalloc(ubd_dev->cow.bitmap_len); ubd_open_dev()
772 if(ubd_dev->cow.bitmap == NULL){ ubd_open_dev()
773 printk(KERN_ERR "Failed to vmalloc COW bitmap\n"); ubd_open_dev()
778 err = read_cow_bitmap(ubd_dev->fd, ubd_dev->cow.bitmap, ubd_open_dev()
1153 __u64 *cow_offset, unsigned long *bitmap, cowify_bitmap()
1163 if(ubd_test_bit(sector + i, (unsigned char *) bitmap)) cowify_bitmap()
1167 ubd_set_bit(sector + i, (unsigned char *) bitmap); cowify_bitmap()
1184 bitmap_words[0] = bitmap[*cow_offset]; cowify_bitmap()
1185 bitmap_words[1] = bitmap[*cow_offset + 1]; cowify_bitmap()
1191 static void cowify_req(struct io_thread_req *req, unsigned long *bitmap, cowify_req() argument
1202 if(ubd_test_bit(sector + i, (unsigned char *) bitmap)) cowify_req()
1208 &req->cow_offset, bitmap, bitmap_offset, cowify_req()
1237 cowify_req(io_req, ubd_dev->cow.bitmap, prepare_request()
1382 printk("do_io - bitmap lseek failed : err = %d\n", -n); update_bitmap()
1389 printk("do_io - bitmap update failed, err = %d fd = %d\n", -n, update_bitmap()
1152 cowify_bitmap(__u64 io_offset, int length, unsigned long *cow_mask, __u64 *cow_offset, unsigned long *bitmap, __u64 bitmap_offset, unsigned long *bitmap_words, __u64 bitmap_len) cowify_bitmap() argument
H A Dcow_user.c58 * bitmap and data
61 * for the traditional COW bitmap.
64 * by the bitmap alignment.
65 * The bitmap and data portions of the file will be aligned as specified
108 /* COW format definitions - for now, we have only the usual COW bitmap */
422 cow_printf("cow bitmap lseek failed : err = %d\n", -err); init_cow_file()
428 * this also sets the entire COW bitmap init_cow_file()
433 cow_printf("Write of bitmap to new COW file '%s' failed, " init_cow_file()
/linux-4.1.27/drivers/net/wireless/ath/wcn36xx/
H A Dsmd.h115 void set_feat_caps(u32 *bitmap, enum place_holder_in_cap_bitmap cap);
116 int get_feat_caps(u32 *bitmap, enum place_holder_in_cap_bitmap cap);
117 void clear_feat_caps(u32 *bitmap, enum place_holder_in_cap_bitmap cap);
/linux-4.1.27/fs/f2fs/
H A Dsegment.h149 unsigned long *dirty_segmap; /* dirty segment bitmap */
151 unsigned int offset; /* last scanned bitmap offset */
152 unsigned int ofs_unit; /* bitmap search unit */
159 unsigned char *cur_valid_map; /* validity bitmap of blocks */
161 * # of valid blocks and the validity bitmap stored in the the last
189 char *sit_bitmap; /* SIT bitmap pointer */
190 unsigned int bitmap_size; /* SIT bitmap size */
192 unsigned long *tmp_map; /* bitmap for temporal use */
193 unsigned long *dirty_sentries_bitmap; /* bitmap for dirty sentries */
212 unsigned long *free_segmap; /* free segment bitmap */
213 unsigned long *free_secmap; /* free section bitmap */
584 /* check bitmap with valid block count */ check_block_count()
H A Ddir.c128 if (!test_bit_le(bit_pos, d->bitmap)) { find_target_dentry()
339 test_and_set_bit_le(0, (void *)d->bitmap); do_make_empty_dir()
340 test_and_set_bit_le(1, (void *)d->bitmap); do_make_empty_dir()
453 int room_for_filename(const void *bitmap, int slots, int max_slots) room_for_filename() argument
458 zero_start = find_next_zero_bit_le(bitmap, max_slots, bit_start); room_for_filename()
462 zero_end = find_next_bit_le(bitmap, max_slots, zero_start); room_for_filename()
488 test_and_set_bit_le(bit_pos + i, (void *)d->bitmap); f2fs_update_dentry()
741 bit_pos = find_next_bit_le(d->bitmap, d->max, bit_pos); f2fs_fill_dentries()
/linux-4.1.27/drivers/cpufreq/
H A Dspeedstep-lib.c38 u8 bitmap; /* power on configuration bits pentium3_get_frequency() member in struct:__anon3781
61 u8 bitmap; /* power on configuration bits [18: 19] pentium3_get_frequency() member in struct:__anon3782
81 while (msr_tmp != msr_decode_fsb[i].bitmap) { pentium3_get_frequency()
82 if (msr_decode_fsb[i].bitmap == 0xff) pentium3_get_frequency()
94 while (msr_lo != msr_decode_mult[j].bitmap) { pentium3_get_frequency()
95 if (msr_decode_mult[j].bitmap == 0xff) pentium3_get_frequency()
/linux-4.1.27/fs/hpfs/
H A Dalloc.c6 * HPFS bitmap operations
64 * Check if a sector is allocated in bitmap
74 hpfs_error(s, "sector '%s' - %08x not allocated in bitmap", msg, sec); chk_if_allocated()
82 hpfs_error(s, "sector '%s' - %08x not allocated in directory bitmap", msg, sec); chk_if_allocated()
96 * allocated in bitmap.
196 * 2) search bitmap where free sectors last found
/linux-4.1.27/drivers/md/persistent-data/
H A Ddm-space-map-common.h21 * block that is used as a bitmap. Within the bitmap hold 2 bits per
/linux-4.1.27/arch/score/kernel/
H A Dsetup.c65 /* Reserve space for the bootmem bitmap. */ bootmem_init()
78 /* Reserve space for the initrd bitmap. */ bootmem_init()
/linux-4.1.27/arch/powerpc/mm/
H A Dmmu_context_hash32.c38 * that we can use a bitmap to indicate which contexts are in use.
39 * Using a bitmap means that we entirely avoid all of the problems
/linux-4.1.27/fs/gfs2/
H A Drgrp.h17 * bitmap, one 64-bit word in the bitmap will represent 32 blocks.
/linux-4.1.27/net/sched/
H A Dsch_generic.c459 * - bitmap indicating which of the bands contain skbs
462 u32 bitmap; member in struct:pfifo_fast_priv
467 * Convert a bitmap to the first band number where an skb is queued, where:
468 * bitmap=0 means there are no skbs on any band.
469 * bitmap=1 means there is an skb on band 0.
470 * bitmap=7 means there are skbs on all 3 bands, etc.
487 priv->bitmap |= (1 << band); pfifo_fast_enqueue()
498 int band = bitmap2band[priv->bitmap]; pfifo_fast_dequeue()
506 priv->bitmap &= ~(1 << band); pfifo_fast_dequeue()
517 int band = bitmap2band[priv->bitmap]; pfifo_fast_peek()
536 priv->bitmap = 0; pfifo_fast_reset()
/linux-4.1.27/arch/x86/kvm/
H A Dlapic.c83 static inline int apic_test_vector(int vec, void *bitmap) apic_test_vector() argument
85 return test_bit(VEC_POS(vec), (bitmap) + REG_POS(vec)); apic_test_vector()
96 static inline void apic_set_vector(int vec, void *bitmap) apic_set_vector() argument
98 set_bit(VEC_POS(vec), (bitmap) + REG_POS(vec)); apic_set_vector()
101 static inline void apic_clear_vector(int vec, void *bitmap) apic_clear_vector() argument
103 clear_bit(VEC_POS(vec), (bitmap) + REG_POS(vec)); apic_clear_vector()
106 static inline int __apic_test_and_set_vector(int vec, void *bitmap) __apic_test_and_set_vector() argument
108 return __test_and_set_bit(VEC_POS(vec), (bitmap) + REG_POS(vec)); __apic_test_and_set_vector()
111 static inline int __apic_test_and_clear_vector(int vec, void *bitmap) __apic_test_and_clear_vector() argument
113 return __test_and_clear_bit(VEC_POS(vec), (bitmap) + REG_POS(vec)); __apic_test_and_clear_vector()
296 static int find_highest_vector(void *bitmap) find_highest_vector() argument
303 reg = bitmap + REG_POS(vec); find_highest_vector()
311 static u8 count_vectors(void *bitmap) count_vectors() argument
318 reg = bitmap + REG_POS(vec); count_vectors()
685 unsigned long bitmap = 1; kvm_irq_delivery_to_apic_fast() local
726 apic_logical_id(map, irq->dest_id, &cid, (u16 *)&bitmap); kvm_irq_delivery_to_apic_fast()
735 for_each_set_bit(i, &bitmap, 16) { kvm_irq_delivery_to_apic_fast()
744 bitmap = (l >= 0) ? 1 << l : 0; kvm_irq_delivery_to_apic_fast()
748 for_each_set_bit(i, &bitmap, 16) { kvm_irq_delivery_to_apic_fast()
1137 void *bitmap = apic->regs + APIC_ISR; lapic_timer_int_injected() local
1140 bitmap = apic->regs + APIC_IRR; lapic_timer_int_injected()
1142 if (apic_test_vector(vec, bitmap)) lapic_timer_int_injected()
H A Dmmu.h100 * used to sync dirty bitmap when we do KVM_GET_DIRTY_LOG. The differences
106 * the dirty bitmap to userspace since it only write-protects the page
107 * logged in the bitmap, that means the page in the dirty bitmap is not
H A Dirq_comm.c180 unsigned long *bitmap = &kvm->arch.irq_sources_bitmap; kvm_request_irq_source_id() local
184 irq_source_id = find_first_zero_bit(bitmap, BITS_PER_LONG); kvm_request_irq_source_id()
194 set_bit(irq_source_id, bitmap); kvm_request_irq_source_id()
/linux-4.1.27/drivers/sh/
H A Dpm_runtime.c20 #include <linux/bitmap.h>
/linux-4.1.27/arch/x86/include/uapi/asm/
H A Dkvm_para.h12 /* This CPUID returns a feature bitmap in eax. Before enabling a particular
/linux-4.1.27/arch/sh/kernel/cpu/irq/
H A Dimask.c21 #include <linux/bitmap.h>
/linux-4.1.27/arch/mn10300/unit-asb2305/
H A Dpci-asb2305.h50 u16 bitmap; /* Available IRQs */ member in struct:irq_info::__anon2179
/linux-4.1.27/arch/powerpc/kernel/vdso32/
H A Ddatapage.S48 * bottom so that memory actually contains a linear bitmap
/linux-4.1.27/arch/powerpc/kernel/vdso64/
H A Ddatapage.S48 * bottom so that memory actually contains a linear bitmap
/linux-4.1.27/tools/perf/util/include/linux/
H A Dbitmap.h10 int __bitmap_weight(const unsigned long *bitmap, int bits);
/linux-4.1.27/drivers/net/wireless/brcm80211/brcmsmac/
H A Dpub.h79 /* def bitmap of txchain */
81 /* default bitmap of tx chains for nphy */
83 /* default bitmap of tx chains for nphy */
85 /* def bitmap of rxchain */
87 /* default bitmap of rx chains for nphy */
89 /* default bitmap of rx chains for nphy */
163 u8 _n_enab; /* bitmap of 11N + HT support */
H A Dampdu.c844 u8 bitmap[8], queue, tid; brcms_c_ampdu_dotxstatus_complete() local
870 memset(bitmap, 0, sizeof(bitmap)); brcms_c_ampdu_dotxstatus_complete()
880 bitmap[0] = (txs->status & TX_STATUS_BA_BMAP03_MASK) >> brcms_c_ampdu_dotxstatus_complete()
886 bitmap[0] |= brcms_c_ampdu_dotxstatus_complete()
889 bitmap[1] = (s1 >> 8) & 0xff; brcms_c_ampdu_dotxstatus_complete()
890 bitmap[2] = (s1 >> 16) & 0xff; brcms_c_ampdu_dotxstatus_complete()
891 bitmap[3] = (s1 >> 24) & 0xff; brcms_c_ampdu_dotxstatus_complete()
893 bitmap[4] = s2 & 0xff; brcms_c_ampdu_dotxstatus_complete()
894 bitmap[5] = (s2 >> 8) & 0xff; brcms_c_ampdu_dotxstatus_complete()
895 bitmap[6] = (s2 >> 16) & 0xff; brcms_c_ampdu_dotxstatus_complete()
896 bitmap[7] = (s2 >> 24) & 0xff; brcms_c_ampdu_dotxstatus_complete()
960 isset(bitmap, bindex), index); brcms_c_ampdu_dotxstatus_complete()
963 && isset(bitmap, bindex)) { brcms_c_ampdu_dotxstatus_complete()
/linux-4.1.27/drivers/input/keyboard/
H A Dgpio_keys.c62 * keys [ro] - bitmap of keys (EV_KEY) which can be
64 * switches [ro] - bitmap of switches (EV_SW) which can be
66 * disabled_keys [rw] - bitmap of keys currently disabled
67 * disabled_switches [rw] - bitmap of switches currently disabled
96 * Return value of this function can be used to allocate bitmap
155 * gpio_keys_attr_show_helper() - fill in stringified bitmap of buttons
157 * @buf: buffer where stringified bitmap is written
203 * gpio_keys_attr_store_helper() - enable/disable buttons based on given bitmap
205 * @buf: buffer from userspace that contains stringified bitmap
208 * This function parses stringified bitmap from @buf and disables/enables
/linux-4.1.27/arch/sparc/mm/
H A Diommu.c60 unsigned long *bitmap; sbus_iommu_init() local
111 bitmap = kmalloc(IOMMU_NPTES>>3, GFP_KERNEL); sbus_iommu_init()
112 if (!bitmap) { sbus_iommu_init()
113 prom_printf("Unable to allocate iommu bitmap [%d]\n", sbus_iommu_init()
117 bit_map_init(&iommu->usemap, bitmap, IOMMU_NPTES); sbus_iommu_init()
/linux-4.1.27/net/rds/
H A Dtcp_recv.c95 * bitmap. They must add up to the exact size of the congestion bitmap. We
97 * congestion bitmap for the remote address of this connection. We then tell
98 * the congestion core that the bitmap has been changed so that it can wake up
102 * bitmap indicates that their recipient is congested.
/linux-4.1.27/drivers/staging/rtl8723au/hal/
H A Drtl8723a_cmd.c139 /* bitmap[0:27] = tx_rate_bitmap */
140 /* bitmap[28:31]= Rate Adaptive id */
143 void rtl8723a_add_rateatid(struct rtw_adapter *pAdapter, u32 bitmap, u8 arg, u8 rssi_level) rtl8723a_add_rateatid() argument
147 u32 raid = bitmap & 0xf0000000; rtl8723a_add_rateatid()
149 bitmap &= 0x0fffffff; rtl8723a_add_rateatid()
151 bitmap = ODM_Get_Rate_Bitmap23a(pHalData, macid, bitmap, rtl8723a_add_rateatid()
154 bitmap |= raid; rtl8723a_add_rateatid()
156 rtl8723a_set_raid_cmd(pAdapter, bitmap, arg); rtl8723a_add_rateatid()
/linux-4.1.27/kernel/power/
H A Dsnapshot.c227 * Memory bitmap is a structure consiting of many linked lists of
229 * and each of them corresonds to one zone. For each zone bitmap
231 * represent each blocks of bitmap in which information is stored.
234 * bitmap objects, a struct bm_position used for browsing the bitmap,
236 * zone bitmap objects and bitmap block objects.
238 * NOTE: It has to be possible to lay out the bitmap in memory
239 * using only allocations of order 0. Additionally, the bitmap is
243 * struct zone_bitmap contains a pointer to a list of bitmap block
244 * objects and a pointer to the bitmap block object that has been
249 * information is stored (in the form of a block of bitmap)
253 * The memory bitmap is organized as a radix tree to guarantee fast random
260 * access of the memory bitmap.
282 * struct mem_zone_bm_rtree represents a bitmap used for one
308 * bitmap objects and bitmap block
568 * memory_bm_create - allocate memory for a memory bitmap
610 * memory_bm_free - free memory occupied by the memory bitmap @bm
626 * bitmap
628 * Find the bit in the bitmap @bm that corresponds to given pfn.
760 * memory bitmap. This is either the next node in the current
793 * memory_bm_rtree_next_pfn - Find the next set bit in the bitmap @bm
796 * for the next set bit in the memory bitmap and returns its
927 * contents of which should not be saved in a given bitmap.
1303 * Memory bitmap used for marking saveable pages (during hibernation) or
1308 * Memory bitmap used during hibernation for marking allocated page frames that
1921 * pack_pfns - pfns corresponding to the set bits found in the bitmap @bm
2085 * the corresponding bit in the memory bitmap @bm
2132 * suspend image. The bits in the memory bitmap @bm that correspond to the
2191 /* The page is "safe", set its bit the bitmap */ prepare_highmem_image()
2318 * prepare_image - use the memory bitmap @bm to mark the pages that will free_highmem_data()
2323 * The idea is to allocate a new memory bitmap first and then allocate free_highmem_data()
/linux-4.1.27/drivers/iommu/
H A Dio-pgtable.h37 * @quirks: A bitmap of hardware quirks that require some special
39 * @pgsize_bitmap: A bitmap of page sizes supported by this set of page
/linux-4.1.27/drivers/md/bcache/
H A Djournal.c149 __set_bit(b, bitmap); \ bch_journal_read()
160 unsigned long bitmap[SB_JOURNAL_BUCKETS / BITS_PER_LONG]; for_each_cache() local
164 bitmap_zero(bitmap, SB_JOURNAL_BUCKETS); for_each_cache()
174 if (test_bit(l, bitmap)) for_each_cache()
187 for (l = find_first_zero_bit(bitmap, ca->sb.njournal_buckets); for_each_cache()
189 l = find_next_zero_bit(bitmap, ca->sb.njournal_buckets, l + 1)) for_each_cache()
201 r = find_next_bit(bitmap, ca->sb.njournal_buckets, l + 1); for_each_cache()
233 if (test_bit(l, bitmap)) for_each_cache()
/linux-4.1.27/arch/mips/include/asm/dec/
H A Dprom.h65 #define REX_PROM_GETBITMAP 0x84/4 /* get mem bitmap */
82 unsigned char bitmap[0]; member in struct:__anon1877
/linux-4.1.27/include/uapi/scsi/fc/
H A Dfc_ns.h97 #define FC_NS_BPW 32 /* bits per word in bitmap */
100 __be32 ff_type_map[FC_NS_TYPES / FC_NS_BPW]; /* bitmap of FC-4 types */
/linux-4.1.27/arch/nios2/kernel/
H A Dsetup.c174 * the bootmem bitmap so we then reserve it after freeing it :-) setup_arch()
181 * Reserve the bootmem bitmap itself as well. We do this in two setup_arch()
/linux-4.1.27/kernel/irq/
H A Dautoprobe.c107 * probe_irq_mask - scan a bitmap of interrupt lines
110 * Scan the interrupt lines and return a bitmap of active
/linux-4.1.27/drivers/staging/rtl8188eu/include/
H A Drtl8188e_cmd.h111 void rtl8188e_Add_RateATid(struct adapter *padapter, u32 bitmap, u8 arg,
/linux-4.1.27/arch/unicore32/mm/
H A Dinit.c136 phys_addr_t bitmap; uc32_bootmem_init() local
140 * Allocate the bootmem bitmap page. This must be in a region uc32_bootmem_init()
144 bitmap = memblock_alloc_base(boot_pages << PAGE_SHIFT, L1_CACHE_BYTES, uc32_bootmem_init()
153 init_bootmem_node(pgdat, __phys_to_pfn(bitmap), start_pfn, end_pfn); uc32_bootmem_init()
/linux-4.1.27/arch/x86/include/asm/
H A Dcalgary.h37 unsigned long *it_map; /* A simple allocation bitmap for now */
/linux-4.1.27/include/media/davinci/
H A Dvpbe_osd.h65 * @PIXFMT_1BPP: 1-bit-per-pixel bitmap
66 * @PIXFMT_2BPP: 2-bits-per-pixel bitmap
67 * @PIXFMT_4BPP: 4-bits-per-pixel bitmap
68 * @PIXFMT_8BPP: 8-bits-per-pixel bitmap
/linux-4.1.27/include/uapi/linux/raid/
H A Dmd_p.h111 #define MD_SB_BITMAP_PRESENT 8 /* bitmap may be present nearby */
235 __le32 bitmap_offset; /* sectors after start of superblock that bitmap starts
236 * NOTE: signed, so bitmap can be before superblock
303 * is guided by bitmap.
/linux-4.1.27/arch/sh/include/asm/
H A Dsuspend.h82 /* a bitmap of supported sleep modes (SUSP_SH..) */
/linux-4.1.27/net/wireless/
H A Dradiotap.c124 /* find payload start allowing for extended bitmap(s) */ ieee80211_radiotap_iterator_init()
309 * check for insanity where we are given a bitmap that ieee80211_radiotap_iterator_next()
320 /* these special ones are valid in each bitmap word */ ieee80211_radiotap_iterator_next()
345 * -- move to next u32 bitmap ieee80211_radiotap_iterator_next()
/linux-4.1.27/sound/usb/
H A Dmixer.h56 unsigned int cmask; /* channel mask bitmap: 0 = master */
/linux-4.1.27/drivers/net/ethernet/brocade/bna/
H A Dbfa_defs_cna.h167 u8 pfc_primap; /* bitmap of priorties with PFC enabled */
168 u8 fcoe_primap; /* bitmap of priorities used for FcoE traffic */
169 u8 iscsi_primap; /* bitmap of priorities used for iSCSI traffic */
/linux-4.1.27/drivers/infiniband/hw/ehca/
H A Dipz_pt_fn.c152 bit = find_first_zero_bit(page->bitmap, IPZ_SPAGE_PER_KPAGE >> order); alloc_small_queue_page()
153 __set_bit(bit, page->bitmap); alloc_small_queue_page()
184 __clear_bit(bit, page->bitmap); free_small_queue_page()
/linux-4.1.27/drivers/base/regmap/
H A Dregcache-lzo.c149 * allocate a bitmap to be used when syncing the cache with regcache_lzo_init()
151 * bit is set in the bitmap, so we know that we have to sync regcache_lzo_init()
215 * the pointer to the bitmap used for syncing the cache regcache_lzo_exit()
/linux-4.1.27/fs/sysv/
H A Dballoc.c4 * minix/bitmap.c
51 * This code does not work at all for AFS (it has a bitmap sysv_free_block()
169 * This code does not work at all for AFS (it has a bitmap sysv_count_free_blocks()
/linux-4.1.27/drivers/gpu/drm/
H A Ddrm_context.c41 /** \name Context bitmap support */
45 * Free a handle from the context bitmap.
62 * Context bitmap allocation.
82 * Context bitmap initialization.
95 * Context bitmap cleanup.
/linux-4.1.27/fs/ufs/
H A Dutil.h377 * These functions work like classical bitmap operations.
378 * The difference is that we don't have the whole bitmap
381 * position of the beginning of the bitmap.
420 static inline unsigned find_last_zero_bit (unsigned char * bitmap, find_last_zero_bit() argument
427 mapp = bitmap + (size >> 3); find_last_zero_bit()

Completed in 5296 milliseconds

12345