Lines Matching refs:store

229 	struct bitmap_storage *store = &bitmap->storage;  in __write_sb_page()  local
237 if (pg_index == store->file_pages - 1) { in __write_sb_page()
238 unsigned int last_page_size = store->bytes & (PAGE_SIZE - 1); in __write_sb_page()
437 struct bitmap_storage *store = &bitmap->storage; in filemap_write_page() local
438 struct page *page = store->filemap[pg_index]; in filemap_write_page()
442 DIV_ROUND_UP(store->bytes, PAGE_SIZE); in filemap_write_page()
445 if (store->file) in filemap_write_page()
780 static inline unsigned long file_page_index(struct bitmap_storage *store, in file_page_index() argument
783 if (store->sb_page) in file_page_index()
789 static inline unsigned long file_page_offset(struct bitmap_storage *store, in file_page_offset() argument
792 if (store->sb_page) in file_page_offset()
801 static inline struct page *filemap_get_page(struct bitmap_storage *store, in filemap_get_page() argument
804 if (file_page_index(store, chunk) >= store->file_pages) in filemap_get_page()
806 return store->filemap[file_page_index(store, chunk)]; in filemap_get_page()
809 static int md_bitmap_storage_alloc(struct bitmap_storage *store, in md_bitmap_storage_alloc() argument
824 store->filemap = kmalloc_array(num_pages, sizeof(struct page *), in md_bitmap_storage_alloc()
826 if (!store->filemap) in md_bitmap_storage_alloc()
829 if (with_super && !store->sb_page) { in md_bitmap_storage_alloc()
830 store->sb_page = alloc_page(GFP_KERNEL|__GFP_ZERO); in md_bitmap_storage_alloc()
831 if (store->sb_page == NULL) in md_bitmap_storage_alloc()
836 if (store->sb_page) { in md_bitmap_storage_alloc()
837 store->filemap[0] = store->sb_page; in md_bitmap_storage_alloc()
839 store->sb_index = offset; in md_bitmap_storage_alloc()
843 store->filemap[pnum] = alloc_page(GFP_KERNEL|__GFP_ZERO); in md_bitmap_storage_alloc()
844 if (!store->filemap[pnum]) { in md_bitmap_storage_alloc()
845 store->file_pages = pnum; in md_bitmap_storage_alloc()
849 store->file_pages = pnum; in md_bitmap_storage_alloc()
853 store->filemap_attr = kzalloc( in md_bitmap_storage_alloc()
856 if (!store->filemap_attr) in md_bitmap_storage_alloc()
859 store->bytes = bytes; in md_bitmap_storage_alloc()
864 static void md_bitmap_file_unmap(struct bitmap_storage *store) in md_bitmap_file_unmap() argument
866 struct file *file = store->file; in md_bitmap_file_unmap()
867 struct page *sb_page = store->sb_page; in md_bitmap_file_unmap()
868 struct page **map = store->filemap; in md_bitmap_file_unmap()
869 int pages = store->file_pages; in md_bitmap_file_unmap()
875 kfree(store->filemap_attr); in md_bitmap_file_unmap()
951 struct bitmap_storage *store = &bitmap->storage; in md_bitmap_file_set_bit() local
952 unsigned long index = file_page_index(store, chunk); in md_bitmap_file_set_bit()
956 node_offset = bitmap->cluster_slot * store->file_pages; in md_bitmap_file_set_bit()
981 struct bitmap_storage *store = &bitmap->storage; in md_bitmap_file_clear_bit() local
982 unsigned long index = file_page_index(store, chunk); in md_bitmap_file_clear_bit()
986 node_offset = bitmap->cluster_slot * store->file_pages; in md_bitmap_file_clear_bit()
1110 struct bitmap_storage *store = &bitmap->storage; in md_bitmap_init_from_disk() local
1111 struct file *file = store->file; in md_bitmap_init_from_disk()
1119 store->filemap = NULL; in md_bitmap_init_from_disk()
1120 store->file_pages = 0; in md_bitmap_init_from_disk()
1132 if (file && i_size_read(file->f_mapping->host) < store->bytes) { in md_bitmap_init_from_disk()
1136 store->bytes); in md_bitmap_init_from_disk()
1142 node_offset = bitmap->cluster_slot * (DIV_ROUND_UP(store->bytes, PAGE_SIZE)); in md_bitmap_init_from_disk()
1144 for (i = 0; i < store->file_pages; i++) { in md_bitmap_init_from_disk()
1145 struct page *page = store->filemap[i]; in md_bitmap_init_from_disk()
1149 if (i == store->file_pages - 1) in md_bitmap_init_from_disk()
1150 count = store->bytes - i * PAGE_SIZE; in md_bitmap_init_from_disk()
1167 for (i = 0; i < store->file_pages; i++) { in md_bitmap_init_from_disk()
1168 struct page *page = store->filemap[i]; in md_bitmap_init_from_disk()
1216 bmname(bitmap), store->file_pages, in md_bitmap_init_from_disk()
2137 struct bitmap_storage store; in md_bitmap_resize() local
2184 memset(&store, 0, sizeof(store)); in md_bitmap_resize()
2186 ret = md_bitmap_storage_alloc(&store, chunks, in md_bitmap_resize()
2191 md_bitmap_file_unmap(&store); in md_bitmap_resize()
2200 md_bitmap_file_unmap(&store); in md_bitmap_resize()
2207 store.file = bitmap->storage.file; in md_bitmap_resize()
2210 if (store.sb_page && bitmap->storage.sb_page) in md_bitmap_resize()
2211 memcpy(page_address(store.sb_page), in md_bitmap_resize()
2216 bitmap->storage = store; in md_bitmap_resize()