Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1343123

Re: [PATCH] jffs2: Don't add summary entry when MTD write fails

From David Woodhouse <dwmw2@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH] jffs2: Don't add summary entry when MTD write fails
Date 2016-02-25 12:40 +0100
Message-ID <r62qZ-37z-3@gated-at.bofh.it> (permalink)
References <qtKls-7E9-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Wed, 2015-11-11 at 21:27 +0100, Thomas Betker wrote:
> 
>  int jffs2_flash_direct_writev(struct jffs2_sb_info *c, const struct kvec *vecs,
>                               unsigned long count, loff_t to, size_t *retlen)
>  {
> +       int ret;
> +
> +       ret = mtd_writev(c->mtd, vecs, count, to, retlen);
> +
>         if (!jffs2_is_writebuffered(c)) {
>                 if (jffs2_sum_active()) {
>                         int res;
> +
> +                       if (ret ||
> +                           *retlen != iov_length((struct iovec *) vecs, count))
> +                               return ret;
> +
>                         res = jffs2_sum_add_kvec(c, vecs, count, (uint32_t) to);
>                         if (res) {
>                                 return res;

OK... but perhaps we can dispense with the separate 'ret' and 'res'
variables and the rats nest of conditions, and do something like:

   int ret;

   ret = mtd_writev(…);

   if (!ret && *retlen == iov_length(…) &&
       !jffs2_is_writebuffered(c) && jffs2_sum_active()) 
          ret = jffs2_sum_add_kvec(…);
   
   return ret;

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [PATCH] jffs2: Don't add summary entry when MTD write fails David Woodhouse <dwmw2@infradead.org> - 2016-02-25 12:40 +0100
  Re: [PATCH] jffs2: Don't add summary entry when MTD write fails Thomas.Betker@rohde-schwarz.com - 2016-02-25 18:50 +0100

csiph-web