Lines Matching refs:vol
47 struct ubi_volume *vol = desc->vol;
49 spin_lock(&vol->ubi->volumes_lock);
50 users = vol->readers + vol->writers + vol->exclusive + vol->metaonly;
53 ubi_err(vol->ubi, "%d users for volume %d", users, vol->vol_id);
56 vol->readers = vol->writers = vol->metaonly = 0;
57 vol->exclusive = 1;
61 spin_unlock(&vol->ubi->volumes_lock);
73 struct ubi_volume *vol = desc->vol;
75 spin_lock(&vol->ubi->volumes_lock);
76 ubi_assert(vol->readers == 0 && vol->writers == 0 && vol->metaonly == 0);
77 ubi_assert(vol->exclusive == 1 && desc->mode == UBI_EXCLUSIVE);
78 vol->exclusive = 0;
80 vol->readers = 1;
82 vol->writers = 1;
84 vol->metaonly = 1;
86 vol->exclusive = 1;
87 spin_unlock(&vol->ubi->volumes_lock);
120 struct ubi_volume *vol = desc->vol;
123 vol->ubi->ubi_num, vol->vol_id, desc->mode);
125 if (vol->updating) {
126 ubi_warn(vol->ubi, "update of volume %d not finished, volume is damaged",
127 vol->vol_id);
128 ubi_assert(!vol->changing_leb);
129 vol->updating = 0;
130 vfree(vol->upd_buf);
131 } else if (vol->changing_leb) {
133 vol->upd_received, vol->upd_bytes, vol->ubi->ubi_num,
134 vol->vol_id);
135 vol->changing_leb = 0;
136 vfree(vol->upd_buf);
146 struct ubi_volume *vol = desc->vol;
148 if (vol->updating) {
150 ubi_err(vol->ubi, "updating");
154 return fixed_size_llseek(file, offset, origin, vol->used_bytes);
161 struct ubi_device *ubi = desc->vol->ubi;
175 struct ubi_volume *vol = desc->vol;
176 struct ubi_device *ubi = vol->ubi;
182 count, *offp, vol->vol_id);
184 if (vol->updating) {
185 ubi_err(vol->ubi, "updating");
188 if (vol->upd_marker) {
189 ubi_err(vol->ubi, "damaged volume, update marker is set");
192 if (*offp == vol->used_bytes || count == 0)
195 if (vol->corrupted)
196 dbg_gen("read from corrupted volume %d", vol->vol_id);
198 if (*offp + count > vol->used_bytes)
199 count_save = count = vol->used_bytes - *offp;
201 tbuf_size = vol->usable_leb_size;
209 lnum = div_u64_rem(*offp, vol->usable_leb_size, &off);
214 if (off + len >= vol->usable_leb_size)
215 len = vol->usable_leb_size - off;
217 err = ubi_eba_read_leb(ubi, vol, lnum, tbuf, off, len, 0);
222 if (off == vol->usable_leb_size) {
224 off -= vol->usable_leb_size;
252 struct ubi_volume *vol = desc->vol;
253 struct ubi_device *ubi = vol->ubi;
258 if (!vol->direct_writes)
262 count, *offp, vol->vol_id);
264 if (vol->vol_type == UBI_STATIC_VOLUME)
267 lnum = div_u64_rem(*offp, vol->usable_leb_size, &off);
273 if (*offp + count > vol->used_bytes)
274 count_save = count = vol->used_bytes - *offp;
282 tbuf_size = vol->usable_leb_size;
294 if (off + len >= vol->usable_leb_size)
295 len = vol->usable_leb_size - off;
303 err = ubi_eba_write_leb(ubi, vol, lnum, tbuf, off, len);
308 if (off == vol->usable_leb_size) {
310 off -= vol->usable_leb_size;
328 struct ubi_volume *vol = desc->vol;
329 struct ubi_device *ubi = vol->ubi;
331 if (!vol->updating && !vol->changing_leb)
334 if (vol->updating)
335 err = ubi_more_update_data(ubi, vol, buf, count);
337 err = ubi_more_leb_change_data(ubi, vol, buf, count);
352 if (vol->changing_leb) {
361 err = ubi_check_volume(ubi, vol->vol_id);
367 vol->vol_id, ubi->ubi_num);
368 vol->corrupted = 1;
370 vol->checked = 1;
371 ubi_volume_notify(ubi, vol, UBI_VOLUME_UPDATED);
383 struct ubi_volume *vol = desc->vol;
384 struct ubi_device *ubi = vol->ubi;
409 rsvd_bytes = (long long)vol->reserved_pebs *
410 vol->usable_leb_size;
420 err = ubi_start_update(ubi, vol, bytes);
422 ubi_volume_notify(ubi, vol, UBI_VOLUME_UPDATED);
441 vol->vol_type == UBI_STATIC_VOLUME) {
448 if (!ubi_leb_valid(vol, req.lnum) ||
449 req.bytes < 0 || req.bytes > vol->usable_leb_size)
456 err = ubi_start_leb_change(ubi, vol, &req);
474 vol->vol_type == UBI_STATIC_VOLUME) {
479 if (!ubi_leb_valid(vol, lnum)) {
484 dbg_gen("erase LEB %d:%d", vol->vol_id, lnum);
485 err = ubi_eba_unmap_leb(ubi, vol, lnum);
549 desc->vol->direct_writes = !!req.value;
746 if (re->desc->vol->name_len == name_len &&
747 !memcmp(re->desc->vol->name, name, name_len)) {
757 vol_id, re->desc->vol->name, name);
775 if (re->new_name_len == re1->desc->vol->name_len &&
776 !memcmp(re->new_name, re1->desc->vol->name,
777 re1->desc->vol->name_len)) {
815 re1->desc->vol->vol_id, re1->desc->vol->name);
930 pebs = div_u64(req.bytes + desc->vol->usable_leb_size - 1,
931 desc->vol->usable_leb_size);