On Wed, Nov 21, 2018 at 01:55:51PM +0900, Sergey Senozhatsky wrote:
> On (11/16/18 16:20), Minchan Kim wrote:
> > +           zram_set_flag(zram, index, ZRAM_UNDER_WB);
> > +           zram_slot_unlock(zram, index);
> > +           if (zram_bvec_read(zram, &bvec, index, 0, NULL)) {
> > +                   zram_slot_lock(zram, index);
> > +                   zram_clear_flag(zram, index, ZRAM_UNDER_WB);
> > +                   zram_slot_unlock(zram, index);
> > +                   continue;
> > +           }
> > +
> > +           bio_init(&bio, &bio_vec, 1);
> > +           bio_set_dev(&bio, zram->bdev);
> > +           bio.bi_iter.bi_sector = blk_idx * (PAGE_SIZE >> 9);
> > +           bio.bi_opf = REQ_OP_WRITE | REQ_SYNC;
> > +
> > +           bio_add_page(&bio, bvec.bv_page, bvec.bv_len,
> > +                           bvec.bv_offset);
> > +           /*
> > +            * XXX: A single page IO would be inefficient for write
> > +            * but it would be not bad as starter.
> > +            */
> > +           ret = submit_bio_wait(&bio);
> > +           if (ret) {
> > +                   zram_slot_lock(zram, index);
> > +                   zram_clear_flag(zram, index, ZRAM_UNDER_WB);
> > +                   zram_slot_unlock(zram, index);
> > +                   continue;
> > +           }
> 
> Just a thought,
> 
> I wonder if it will make sense (and if it will be possible) to writeback
> idle _compressed_ objects. Right now we decompress, say, a perfectly
> fine 400-byte compressed object to a PAGE_SIZE-d object and then push
> it to the WB device. In this particular case it has a x10 bigger IO
> pressure on flash. If we can write/read compressed object then we
> will write and read 400-bytes, instead of PAGE_SIZE.

Although it has pros/cons, that's the my final goal although it would
add much complicated stuffs. Sometime, we should have the feature.
However, I want to go simple one first which is very valuable, too.

Reply via email to