Skip to content

Commit

Permalink
drivers/bch: ioctl() - BIOC_FLUSH: Add calling ioctl() of block driver
Browse files Browse the repository at this point in the history
Passing `BIOC_FLUSH` to block driver to ensure that changes transfers ("flushes") to the block device

Signed-off-by: wangjianyu3 <[email protected]>
  • Loading branch information
JianyuWang0623 committed Sep 26, 2024
1 parent b0f8b6e commit e46ab01
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions drivers/bch/bchdev_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,14 +420,6 @@ static int bch_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
}
break;

case BIOC_FLUSH:
{
/* Flush any dirty pages remaining in the cache */

ret = bchlib_flushsector(bch, false);
}
break;

#ifdef CONFIG_BCH_ENCRYPTION
/* This is a request to set the encryption key? */

Expand All @@ -439,9 +431,20 @@ static int bch_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
break;
#endif

/* Otherwise, pass the IOCTL command on to the contained block
* driver.
*/
case BIOC_FLUSH:
{
/* Flush any dirty pages remaining in the cache */

ret = bchlib_flushsector(bch, false);
if (ret < 0)
{
break;
}

/* Go through */
}

/* Pass the IOCTL command on to the contained block driver. */

default:
{
Expand Down

0 comments on commit e46ab01

Please sign in to comment.