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()
746 static inline unsigned long file_page_index(struct bitmap_storage *store, in file_page_index() argument
749 if (store->sb_page) in file_page_index()
755 static inline unsigned long file_page_offset(struct bitmap_storage *store, in file_page_offset() argument
758 if (store->sb_page) in file_page_offset()
767 static inline struct page *filemap_get_page(struct bitmap_storage *store, in filemap_get_page() argument
770 if (file_page_index(store, chunk) >= store->file_pages) in filemap_get_page()
772 return store->filemap[file_page_index(store, chunk)]; in filemap_get_page()
775 static int md_bitmap_storage_alloc(struct bitmap_storage *store, in md_bitmap_storage_alloc() argument
790 store->filemap = kmalloc_array(num_pages, sizeof(struct page *), in md_bitmap_storage_alloc()
792 if (!store->filemap) in md_bitmap_storage_alloc()
795 if (with_super && !store->sb_page) { in md_bitmap_storage_alloc()
796 store->sb_page = alloc_page(GFP_KERNEL|__GFP_ZERO); in md_bitmap_storage_alloc()
797 if (store->sb_page == NULL) in md_bitmap_storage_alloc()
802 if (store->sb_page) { in md_bitmap_storage_alloc()
803 store->filemap[0] = store->sb_page; in md_bitmap_storage_alloc()
805 store->sb_page->index = offset; in md_bitmap_storage_alloc()
809 store->filemap[pnum] = alloc_page(GFP_KERNEL|__GFP_ZERO); in md_bitmap_storage_alloc()
810 if (!store->filemap[pnum]) { in md_bitmap_storage_alloc()
811 store->file_pages = pnum; in md_bitmap_storage_alloc()
814 store->filemap[pnum]->index = pnum + offset; in md_bitmap_storage_alloc()
816 store->file_pages = pnum; in md_bitmap_storage_alloc()
820 store->filemap_attr = kzalloc( in md_bitmap_storage_alloc()
823 if (!store->filemap_attr) in md_bitmap_storage_alloc()
826 store->bytes = bytes; in md_bitmap_storage_alloc()
831 static void md_bitmap_file_unmap(struct bitmap_storage *store) in md_bitmap_file_unmap() argument
837 file = store->file; in md_bitmap_file_unmap()
838 map = store->filemap; in md_bitmap_file_unmap()
839 pages = store->file_pages; in md_bitmap_file_unmap()
840 sb_page = store->sb_page; in md_bitmap_file_unmap()
846 kfree(store->filemap_attr); in md_bitmap_file_unmap()
930 struct bitmap_storage *store = &bitmap->storage; in md_bitmap_file_set_bit() local
934 node_offset = bitmap->cluster_slot * store->file_pages; in md_bitmap_file_set_bit()
959 struct bitmap_storage *store = &bitmap->storage; in md_bitmap_file_clear_bit() local
963 node_offset = bitmap->cluster_slot * store->file_pages; in md_bitmap_file_clear_bit()
1064 struct bitmap_storage *store = &bitmap->storage; in md_bitmap_init_from_disk() local
1067 file = store->file; in md_bitmap_init_from_disk()
1071 store->filemap = NULL; in md_bitmap_init_from_disk()
1072 store->file_pages = 0; in md_bitmap_init_from_disk()
1088 if (file && i_size_read(file->f_mapping->host) < store->bytes) { in md_bitmap_init_from_disk()
1092 store->bytes); in md_bitmap_init_from_disk()
1102 node_offset = bitmap->cluster_slot * (DIV_ROUND_UP(store->bytes, PAGE_SIZE)); in md_bitmap_init_from_disk()
1111 if (index == store->file_pages-1) in md_bitmap_init_from_disk()
1112 count = store->bytes - index * PAGE_SIZE; in md_bitmap_init_from_disk()
1115 page = store->filemap[index]; in md_bitmap_init_from_disk()
1167 bmname(bitmap), store->file_pages, in md_bitmap_init_from_disk()
2066 struct bitmap_storage store; in md_bitmap_resize() local
2112 memset(&store, 0, sizeof(store)); in md_bitmap_resize()
2114 ret = md_bitmap_storage_alloc(&store, chunks, in md_bitmap_resize()
2119 md_bitmap_file_unmap(&store); in md_bitmap_resize()
2128 md_bitmap_file_unmap(&store); in md_bitmap_resize()
2135 store.file = bitmap->storage.file; in md_bitmap_resize()
2138 if (store.sb_page && bitmap->storage.sb_page) in md_bitmap_resize()
2139 memcpy(page_address(store.sb_page), in md_bitmap_resize()
2144 bitmap->storage = store; in md_bitmap_resize()