Lines Matching full:isi
30 static int iomap_swapfile_add_extent(struct iomap_swapfile_info *isi) in iomap_swapfile_add_extent() argument
32 struct iomap *iomap = &isi->iomap; in iomap_swapfile_add_extent()
40 if (unlikely(isi->nr_pages >= isi->sis->max)) in iomap_swapfile_add_extent()
42 max_pages = isi->sis->max - isi->nr_pages; in iomap_swapfile_add_extent()
66 if (isi->lowest_ppage > first_ppage_reported) in iomap_swapfile_add_extent()
67 isi->lowest_ppage = first_ppage_reported; in iomap_swapfile_add_extent()
68 if (isi->highest_ppage < (next_ppage - 1)) in iomap_swapfile_add_extent()
69 isi->highest_ppage = next_ppage - 1; in iomap_swapfile_add_extent()
72 error = add_swap_extent(isi->sis, isi->nr_pages, nr_pages, first_ppage); in iomap_swapfile_add_extent()
75 isi->nr_extents += error; in iomap_swapfile_add_extent()
76 isi->nr_pages += nr_pages; in iomap_swapfile_add_extent()
80 static int iomap_swapfile_fail(struct iomap_swapfile_info *isi, const char *str) in iomap_swapfile_fail() argument
86 p = file_path(isi->file, buf, PATH_MAX); in iomap_swapfile_fail()
98 struct iomap *iomap, struct iomap_swapfile_info *isi) in iomap_swapfile_iter() argument
107 return iomap_swapfile_fail(isi, "is inline"); in iomap_swapfile_iter()
109 return iomap_swapfile_fail(isi, "has unallocated extents"); in iomap_swapfile_iter()
114 return iomap_swapfile_fail(isi, "is not committed"); in iomap_swapfile_iter()
116 return iomap_swapfile_fail(isi, "has shared extents"); in iomap_swapfile_iter()
119 if (iomap->bdev != isi->sis->bdev) in iomap_swapfile_iter()
120 return iomap_swapfile_fail(isi, "outside the main device"); in iomap_swapfile_iter()
122 if (isi->iomap.length == 0) { in iomap_swapfile_iter()
124 memcpy(&isi->iomap, iomap, sizeof(isi->iomap)); in iomap_swapfile_iter()
125 } else if (isi->iomap.addr + isi->iomap.length == iomap->addr) { in iomap_swapfile_iter()
127 isi->iomap.length += iomap->length; in iomap_swapfile_iter()
130 int error = iomap_swapfile_add_extent(isi); in iomap_swapfile_iter()
133 memcpy(&isi->iomap, iomap, sizeof(isi->iomap)); in iomap_swapfile_iter()
153 struct iomap_swapfile_info isi = { in iomap_swapfile_activate() local
169 iter.processed = iomap_swapfile_iter(&iter, &iter.iomap, &isi); in iomap_swapfile_activate()
173 if (isi.iomap.length) { in iomap_swapfile_activate()
174 ret = iomap_swapfile_add_extent(&isi); in iomap_swapfile_activate()
184 if (isi.nr_pages == 0) { in iomap_swapfile_activate()
189 *pagespan = 1 + isi.highest_ppage - isi.lowest_ppage; in iomap_swapfile_activate()
190 sis->max = isi.nr_pages; in iomap_swapfile_activate()
191 sis->pages = isi.nr_pages - 1; in iomap_swapfile_activate()
192 sis->highest_bit = isi.nr_pages - 1; in iomap_swapfile_activate()
193 return isi.nr_extents; in iomap_swapfile_activate()