Lines Matching refs:store
217 struct bitmap_storage *store = &bitmap->storage; in write_sb_page() local
227 if (page->index == store->file_pages-1) { in write_sb_page()
228 int last_page_size = store->bytes & (PAGE_SIZE-1); in write_sb_page()
748 static inline unsigned long file_page_index(struct bitmap_storage *store, in file_page_index() argument
751 if (store->sb_page) in file_page_index()
757 static inline unsigned long file_page_offset(struct bitmap_storage *store, in file_page_offset() argument
760 if (store->sb_page) in file_page_offset()
769 static inline struct page *filemap_get_page(struct bitmap_storage *store, in filemap_get_page() argument
772 if (file_page_index(store, chunk) >= store->file_pages) in filemap_get_page()
774 return store->filemap[file_page_index(store, chunk)]; in filemap_get_page()
777 static int md_bitmap_storage_alloc(struct bitmap_storage *store, in md_bitmap_storage_alloc() argument
792 store->filemap = kmalloc_array(num_pages, sizeof(struct page *), in md_bitmap_storage_alloc()
794 if (!store->filemap) in md_bitmap_storage_alloc()
797 if (with_super && !store->sb_page) { in md_bitmap_storage_alloc()
798 store->sb_page = alloc_page(GFP_KERNEL|__GFP_ZERO); in md_bitmap_storage_alloc()
799 if (store->sb_page == NULL) in md_bitmap_storage_alloc()
804 if (store->sb_page) { in md_bitmap_storage_alloc()
805 store->filemap[0] = store->sb_page; in md_bitmap_storage_alloc()
807 store->sb_page->index = offset; in md_bitmap_storage_alloc()
811 store->filemap[pnum] = alloc_page(GFP_KERNEL|__GFP_ZERO); in md_bitmap_storage_alloc()
812 if (!store->filemap[pnum]) { in md_bitmap_storage_alloc()
813 store->file_pages = pnum; in md_bitmap_storage_alloc()
816 store->filemap[pnum]->index = pnum + offset; in md_bitmap_storage_alloc()
818 store->file_pages = pnum; in md_bitmap_storage_alloc()
822 store->filemap_attr = kzalloc( in md_bitmap_storage_alloc()
825 if (!store->filemap_attr) in md_bitmap_storage_alloc()
828 store->bytes = bytes; in md_bitmap_storage_alloc()
833 static void md_bitmap_file_unmap(struct bitmap_storage *store) in md_bitmap_file_unmap() argument
839 file = store->file; in md_bitmap_file_unmap()
840 map = store->filemap; in md_bitmap_file_unmap()
841 pages = store->file_pages; in md_bitmap_file_unmap()
842 sb_page = store->sb_page; in md_bitmap_file_unmap()
848 kfree(store->filemap_attr); in md_bitmap_file_unmap()
932 struct bitmap_storage *store = &bitmap->storage; in md_bitmap_file_set_bit() local
936 node_offset = bitmap->cluster_slot * store->file_pages; in md_bitmap_file_set_bit()
961 struct bitmap_storage *store = &bitmap->storage; in md_bitmap_file_clear_bit() local
965 node_offset = bitmap->cluster_slot * store->file_pages; in md_bitmap_file_clear_bit()
1066 struct bitmap_storage *store = &bitmap->storage; in md_bitmap_init_from_disk() local
1069 file = store->file; in md_bitmap_init_from_disk()
1073 store->filemap = NULL; in md_bitmap_init_from_disk()
1074 store->file_pages = 0; in md_bitmap_init_from_disk()
1090 if (file && i_size_read(file->f_mapping->host) < store->bytes) { in md_bitmap_init_from_disk()
1094 store->bytes); in md_bitmap_init_from_disk()
1104 node_offset = bitmap->cluster_slot * (DIV_ROUND_UP(store->bytes, PAGE_SIZE)); in md_bitmap_init_from_disk()
1113 if (index == store->file_pages-1) in md_bitmap_init_from_disk()
1114 count = store->bytes - index * PAGE_SIZE; in md_bitmap_init_from_disk()
1117 page = store->filemap[index]; in md_bitmap_init_from_disk()
1169 bmname(bitmap), store->file_pages, in md_bitmap_init_from_disk()
2068 struct bitmap_storage store; in md_bitmap_resize() local
2114 memset(&store, 0, sizeof(store)); in md_bitmap_resize()
2116 ret = md_bitmap_storage_alloc(&store, chunks, in md_bitmap_resize()
2121 md_bitmap_file_unmap(&store); in md_bitmap_resize()
2130 md_bitmap_file_unmap(&store); in md_bitmap_resize()
2137 store.file = bitmap->storage.file; in md_bitmap_resize()
2140 if (store.sb_page && bitmap->storage.sb_page) in md_bitmap_resize()
2141 memcpy(page_address(store.sb_page), in md_bitmap_resize()
2146 bitmap->storage = store; in md_bitmap_resize()