]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - include/linux/bio.h
bio: skip atomic inc/dec of ->bi_remaining for non-chains
[mirror_ubuntu-zesty-kernel.git] / include / linux / bio.h
index da3a127c99583ba1c38d9cad1ed35550bb9666ca..8bfe9eee6d1a0ef8d1ebc4a397f98a628c7c5364 100644 (file)
@@ -644,6 +644,17 @@ static inline struct bio *bio_list_get(struct bio_list *bl)
        return bio;
 }
 
+/*
+ * Increment chain count for the bio. Make sure the CHAIN flag update
+ * is visible before the raised count.
+ */
+static inline void bio_inc_remaining(struct bio *bio)
+{
+       bio->bi_flags |= (1 << BIO_CHAIN);
+       smp_mb__before_atomic();
+       atomic_inc(&bio->__bi_remaining);
+}
+
 /*
  * bio_set is used to allow other portions of the IO system to
  * allocate their own private memory pools for bio and iovec structures.