raid5-cache.c (497280509f32340d90feac030bce18006a3e3605) raid5-cache.c (bd83d0a28c68bacba88a3193a1bd6a083bb8d9f5)
1/*
2 * Copyright (C) 2015 Shaohua Li <shli@fb.com>
3 * Copyright (C) 2016 Song Liu <songliubraving@fb.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *

--- 294 unchanged lines hidden (view full) ---

303 enum r5l_io_unit_state state)
304{
305 if (WARN_ON(io->state >= state))
306 return;
307 io->state = state;
308}
309
310static void
1/*
2 * Copyright (C) 2015 Shaohua Li <shli@fb.com>
3 * Copyright (C) 2016 Song Liu <songliubraving@fb.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *

--- 294 unchanged lines hidden (view full) ---

303 enum r5l_io_unit_state state)
304{
305 if (WARN_ON(io->state >= state))
306 return;
307 io->state = state;
308}
309
310static void
311r5c_return_dev_pending_writes(struct r5conf *conf, struct r5dev *dev,
312 struct bio_list *return_bi)
311r5c_return_dev_pending_writes(struct r5conf *conf, struct r5dev *dev)
313{
314 struct bio *wbi, *wbi2;
315
316 wbi = dev->written;
317 dev->written = NULL;
318 while (wbi && wbi->bi_iter.bi_sector <
319 dev->sector + STRIPE_SECTORS) {
320 wbi2 = r5_next_bio(wbi, dev->sector);
321 md_write_end(conf->mddev);
312{
313 struct bio *wbi, *wbi2;
314
315 wbi = dev->written;
316 dev->written = NULL;
317 while (wbi && wbi->bi_iter.bi_sector <
318 dev->sector + STRIPE_SECTORS) {
319 wbi2 = r5_next_bio(wbi, dev->sector);
320 md_write_end(conf->mddev);
322 if (!raid5_dec_bi_active_stripes(wbi)) {
323 bio_list_add(return_bi, wbi);
324 }
321 if (!raid5_dec_bi_active_stripes(wbi))
322 bio_endio(wbi);
325 wbi = wbi2;
326 }
327}
328
329void r5c_handle_cached_data_endio(struct r5conf *conf,
323 wbi = wbi2;
324 }
325}
326
327void r5c_handle_cached_data_endio(struct r5conf *conf,
330 struct stripe_head *sh, int disks, struct bio_list *return_bi)
328 struct stripe_head *sh, int disks)
331{
332 int i;
333
334 for (i = sh->disks; i--; ) {
335 if (sh->dev[i].written) {
336 set_bit(R5_UPTODATE, &sh->dev[i].flags);
329{
330 int i;
331
332 for (i = sh->disks; i--; ) {
333 if (sh->dev[i].written) {
334 set_bit(R5_UPTODATE, &sh->dev[i].flags);
337 r5c_return_dev_pending_writes(conf, &sh->dev[i],
338 return_bi);
335 r5c_return_dev_pending_writes(conf, &sh->dev[i]);
339 bitmap_endwrite(conf->mddev->bitmap, sh->sector,
340 STRIPE_SECTORS,
341 !test_bit(STRIPE_DEGRADED, &sh->state),
342 0);
343 }
344 }
345}
346

--- 2765 unchanged lines hidden ---
336 bitmap_endwrite(conf->mddev->bitmap, sh->sector,
337 STRIPE_SECTORS,
338 !test_bit(STRIPE_DEGRADED, &sh->state),
339 0);
340 }
341 }
342}
343

--- 2765 unchanged lines hidden ---