* [bug report] [JFFS2] Add erase block summary support (mount time improvement)
@ 2019-11-07 8:00 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2019-11-07 8:00 UTC (permalink / raw)
To: havasi; +Cc: linux-mtd
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/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-11-07 8:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-07 8:00 [bug report] [JFFS2] Add erase block summary support (mount time improvement) Dan Carpenter
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.