From: Dan Carpenter <dan.carpenter@oracle.com>
To: havasi@inf.u-szeged.hu
Cc: linux-mtd@lists.infradead.org
Subject: [bug report] [JFFS2] Add erase block summary support (mount time improvement)
Date: Thu, 7 Nov 2019 11:00:41 +0300 [thread overview]
Message-ID: <20191107080041.GA14320@mwanda> (raw)
Hi JFFS2 devs,
The patch e631ddba5887: "[JFFS2] Add erase block summary support
(mount time improvement)" from Sep 7, 2005, leads to the following
static checker warning:
fs/jffs2/wbuf.c:934 jffs2_flash_writev()
warn: inconsistent returns 'c->wbuf_sem'.
Locked on : 908
Unlocked on: 916,934
fs/jffs2/wbuf.c
859 for (invec = 0; invec < count; invec++) {
860 int vlen = invecs[invec].iov_len;
861 uint8_t *v = invecs[invec].iov_base;
862
863 wbuf_retlen = jffs2_fill_wbuf(c, v, vlen);
864
865 if (c->wbuf_len == c->wbuf_pagesize) {
866 ret = __jffs2_flush_wbuf(c, NOPAD);
867 if (ret)
868 goto outerr;
869 }
870 vlen -= wbuf_retlen;
871 outvec_to += wbuf_retlen;
872 donelen += wbuf_retlen;
873 v += wbuf_retlen;
874
875 if (vlen >= c->wbuf_pagesize) {
876 ret = mtd_write(c->mtd, outvec_to, PAGE_DIV(vlen),
877 &wbuf_retlen, v);
878 if (ret < 0 || wbuf_retlen != PAGE_DIV(vlen))
879 goto outfile;
880
881 vlen -= wbuf_retlen;
882 outvec_to += wbuf_retlen;
883 c->wbuf_ofs = outvec_to;
884 donelen += wbuf_retlen;
885 v += wbuf_retlen;
886 }
887
888 wbuf_retlen = jffs2_fill_wbuf(c, v, vlen);
889 if (c->wbuf_len == c->wbuf_pagesize) {
890 ret = __jffs2_flush_wbuf(c, NOPAD);
891 if (ret)
892 goto outerr;
893 }
894
895 outvec_to += wbuf_retlen;
896 donelen += wbuf_retlen;
897 }
898
899 /*
900 * If there's a remainder in the wbuf and it's a non-GC write,
901 * remember that the wbuf affects this ino
902 */
903 *retlen = donelen;
904
905 if (jffs2_sum_active()) {
906 int res = jffs2_sum_add_kvec(c, invecs, count, (uint32_t) to);
907 if (res)
908 return res;
^^^^^^^^^^^
This should probably be "ret" instead of "res" and then goto outfile or
got outerr?
909 }
910
911 if (c->wbuf_len && ino)
912 jffs2_wbuf_dirties_inode(c, ino);
913
914 ret = 0;
915 up_write(&c->wbuf_sem);
916 return ret;
917
918 outfile:
919 /*
920 * At this point we have no problem, c->wbuf is empty. However
921 * refile nextblock to avoid writing again to same address.
922 */
923
924 spin_lock(&c->erase_completion_lock);
925
926 jeb = &c->blocks[outvec_to / c->sector_size];
927 jffs2_block_refile(c, jeb, REFILE_ANYWAY);
928
929 spin_unlock(&c->erase_completion_lock);
930
931 outerr:
932 *retlen = 0;
933 up_write(&c->wbuf_sem);
934 return ret;
935 }
regards,
dan carpenter
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
reply other threads:[~2019-11-07 8:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191107080041.GA14320@mwanda \
--to=dan.carpenter@oracle.com \
--cc=havasi@inf.u-szeged.hu \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.