Linux-mtd Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Thomas Betker <thomas.betker@freenet.de>, linux-mtd@lists.infradead.org
Cc: linux-kernel@vger.kernel.org,
	Thomas Betker <thomas.betker@rohde-schwarz.com>
Subject: Re: [PATCH] jffs2: Don't add summary entry when MTD write fails
Date: Thu, 25 Feb 2016 11:35:54 +0000	[thread overview]
Message-ID: <1456400154.4666.30.camel@infradead.org> (raw)
In-Reply-To: <1447273666-2679-1-git-send-email-thomas.betker@freenet.de>

[-- Attachment #1: Type: text/plain, Size: 1542 bytes --]

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


[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5691 bytes --]

  reply	other threads:[~2016-02-25 11:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-11 20:27 [PATCH] jffs2: Don't add summary entry when MTD write fails Thomas Betker
2016-02-25 11:35 ` David Woodhouse [this message]
2016-02-25 17:48   ` Thomas.Betker

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=1456400154.4666.30.camel@infradead.org \
    --to=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=thomas.betker@freenet.de \
    --cc=thomas.betker@rohde-schwarz.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox