md: add comments in md_integrity_register
authorGuoqing Jiang <jgq516@gmail.com>
Thu, 3 Jun 2021 09:21:07 +0000 (17:21 +0800)
committerSong Liu <song@kernel.org>
Tue, 15 Jun 2021 05:32:07 +0000 (22:32 -0700)
Given it is not obvious for the error handling, let's try to add some
comments here to make it clear.

Signed-off-by: Guoqing Jiang <jiangguoqing@kylinos.cn>
Signed-off-by: Song Liu <song@kernel.org>
drivers/md/md.c

index 56b606184c87f2f4830c560421fe4021f271f805..2c69905dd5c0a2bc036a9d5205568fcd56b1ba8c 100644 (file)
@@ -2343,6 +2343,12 @@ int md_integrity_register(struct mddev *mddev)
        if (bioset_integrity_create(&mddev->bio_set, BIO_POOL_SIZE) ||
            (mddev->level != 1 && mddev->level != 10 &&
             bioset_integrity_create(&mddev->io_acct_set, BIO_POOL_SIZE))) {
+               /*
+                * No need to handle the failure of bioset_integrity_create,
+                * because the function is called by md_run() -> pers->run(),
+                * md_run calls bioset_exit -> bioset_integrity_free in case
+                * of failure case.
+                */
                pr_err("md: failed to create integrity pool for %s\n",
                       mdname(mddev));
                return -EINVAL;