Lines Matching refs:store
210 struct bitmap_storage *store = &bitmap->storage; in write_sb_page() local
220 if (page->index == store->file_pages-1) { in write_sb_page()
221 int last_page_size = store->bytes & (PAGE_SIZE-1); in write_sb_page()
741 static inline unsigned long file_page_index(struct bitmap_storage *store, in file_page_index() argument
744 if (store->sb_page) in file_page_index()
750 static inline unsigned long file_page_offset(struct bitmap_storage *store, in file_page_offset() argument
753 if (store->sb_page) in file_page_offset()
762 static inline struct page *filemap_get_page(struct bitmap_storage *store, in filemap_get_page() argument
765 if (file_page_index(store, chunk) >= store->file_pages) in filemap_get_page()
767 return store->filemap[file_page_index(store, chunk)]; in filemap_get_page()
770 static int md_bitmap_storage_alloc(struct bitmap_storage *store, in md_bitmap_storage_alloc() argument
785 store->filemap = kmalloc_array(num_pages, sizeof(struct page *), in md_bitmap_storage_alloc()
787 if (!store->filemap) in md_bitmap_storage_alloc()
790 if (with_super && !store->sb_page) { in md_bitmap_storage_alloc()
791 store->sb_page = alloc_page(GFP_KERNEL|__GFP_ZERO); in md_bitmap_storage_alloc()
792 if (store->sb_page == NULL) in md_bitmap_storage_alloc()
797 if (store->sb_page) { in md_bitmap_storage_alloc()
798 store->filemap[0] = store->sb_page; in md_bitmap_storage_alloc()
800 store->sb_page->index = offset; in md_bitmap_storage_alloc()
804 store->filemap[pnum] = alloc_page(GFP_KERNEL|__GFP_ZERO); in md_bitmap_storage_alloc()
805 if (!store->filemap[pnum]) { in md_bitmap_storage_alloc()
806 store->file_pages = pnum; in md_bitmap_storage_alloc()
809 store->filemap[pnum]->index = pnum + offset; in md_bitmap_storage_alloc()
811 store->file_pages = pnum; in md_bitmap_storage_alloc()
815 store->filemap_attr = kzalloc( in md_bitmap_storage_alloc()
818 if (!store->filemap_attr) in md_bitmap_storage_alloc()
821 store->bytes = bytes; in md_bitmap_storage_alloc()
826 static void md_bitmap_file_unmap(struct bitmap_storage *store) in md_bitmap_file_unmap() argument
832 file = store->file; in md_bitmap_file_unmap()
833 map = store->filemap; in md_bitmap_file_unmap()
834 pages = store->file_pages; in md_bitmap_file_unmap()
835 sb_page = store->sb_page; in md_bitmap_file_unmap()
841 kfree(store->filemap_attr); in md_bitmap_file_unmap()
925 struct bitmap_storage *store = &bitmap->storage; in md_bitmap_file_set_bit() local
929 node_offset = bitmap->cluster_slot * store->file_pages; in md_bitmap_file_set_bit()
954 struct bitmap_storage *store = &bitmap->storage; in md_bitmap_file_clear_bit() local
958 node_offset = bitmap->cluster_slot * store->file_pages; in md_bitmap_file_clear_bit()
1059 struct bitmap_storage *store = &bitmap->storage; in md_bitmap_init_from_disk() local
1062 file = store->file; in md_bitmap_init_from_disk()
1066 store->filemap = NULL; in md_bitmap_init_from_disk()
1067 store->file_pages = 0; in md_bitmap_init_from_disk()
1083 if (file && i_size_read(file->f_mapping->host) < store->bytes) { in md_bitmap_init_from_disk()
1087 store->bytes); in md_bitmap_init_from_disk()
1097 node_offset = bitmap->cluster_slot * (DIV_ROUND_UP(store->bytes, PAGE_SIZE)); in md_bitmap_init_from_disk()
1106 if (index == store->file_pages-1) in md_bitmap_init_from_disk()
1107 count = store->bytes - index * PAGE_SIZE; in md_bitmap_init_from_disk()
1110 page = store->filemap[index]; in md_bitmap_init_from_disk()
1162 bmname(bitmap), store->file_pages, in md_bitmap_init_from_disk()
2069 struct bitmap_storage store; in md_bitmap_resize() local
2116 memset(&store, 0, sizeof(store)); in md_bitmap_resize()
2118 ret = md_bitmap_storage_alloc(&store, chunks, in md_bitmap_resize()
2123 md_bitmap_file_unmap(&store); in md_bitmap_resize()
2132 md_bitmap_file_unmap(&store); in md_bitmap_resize()
2139 store.file = bitmap->storage.file; in md_bitmap_resize()
2142 if (store.sb_page && bitmap->storage.sb_page) in md_bitmap_resize()
2143 memcpy(page_address(store.sb_page), in md_bitmap_resize()
2148 bitmap->storage = store; in md_bitmap_resize()