• Bartlomiej Zolnierkiewicz's avatar
    mg_disk: fix issue with data integrity on error in mg_write() · 394c6cc6
    Bartlomiej Zolnierkiewicz authored
    We cannot acknowledge the sector write before checking its status
    (which is done on the next loop iteration) and we also need to do
    the final status register check after writing the last sector.
    
    Fix mg_write() to match mg_write_intr() in this regard.
    
    While at it:
    - add mg_read_one() and mg_write_one() helpers
    - always use MG_SECTOR_SIZE and remove MG_STORAGE_BUFFER_SIZE
    
    [bart: thanks to Tejun for porting the patch over recent block changes]
    
    Cc: unsik Kim <donari75@gmail.com>
    Cc: Tejun Heo <tj@kernel.org>
    Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
    
    ===================================================================
    Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
    394c6cc6
mg_disk.c 26 KB