Whamcloud - gitweb
LU-2099 osd: clear iobuf up on I/O completion 05/10305/3
authorAlex Zhuravlev <alexey.zhuravlev@intel.com>
Tue, 13 May 2014 06:33:03 +0000 (10:33 +0400)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 14 May 2014 15:19:48 +0000 (15:19 +0000)
it was a bad idea to clear iobuf on buffer release because the
same buffers can be used few times in case of transient ENOSPC.

Change-Id: Ic1d2ddaa0794f2f6f7d1ba71620e06b4ea7a99d2
Signed-off-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-on: http://review.whamcloud.com/10305
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Tested-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/osd-ldiskfs/osd_handler.c
lustre/osd-ldiskfs/osd_internal.h
lustre/osd-ldiskfs/osd_io.c

index 46aff66..8f32d68 100644 (file)
@@ -1151,6 +1151,7 @@ static int osd_trans_stop(const struct lu_env *env, struct dt_device *dt,
         */
        wait_event(iobuf->dr_wait,
                       atomic_read(&iobuf->dr_numreqs) == 0);
+       osd_fini_iobuf(oti->oti_dev, iobuf);
        if (!rc)
                rc = iobuf->dr_error;
 
index 3925b7a..cb1299e 100644 (file)
@@ -1084,5 +1084,7 @@ static inline int fid_is_internal(const struct lu_fid *fid)
 void ldiskfs_inc_count(handle_t *handle, struct inode *inode);
 void ldiskfs_dec_count(handle_t *handle, struct inode *inode);
 
+void osd_fini_iobuf(struct osd_device *d, struct osd_iobuf *iobuf);
+
 #endif /* __KERNEL__ */
 #endif /* _OSD_INTERNAL_H */
index 7bab102..d223585 100644 (file)
@@ -372,6 +372,7 @@ out:
        if (iobuf->dr_rw == 0) {
                wait_event(iobuf->dr_wait,
                           atomic_read(&iobuf->dr_numreqs) == 0);
+               osd_fini_iobuf(osd, iobuf);
        }
 
        if (rc == 0)
@@ -489,15 +490,8 @@ cleanup:
 static int osd_bufs_put(const struct lu_env *env, struct dt_object *dt,
                         struct niobuf_local *lnb, int npages)
 {
-        struct osd_thread_info *oti = osd_oti_get(env);
-        struct osd_iobuf       *iobuf = &oti->oti_iobuf;
-        struct osd_device      *d = osd_obj2dev(osd_dt_obj(dt));
         int                     i;
 
-        /* to do IO stats, notice we do this here because
-         * osd_do_bio() doesn't wait for write to complete */
-        osd_fini_iobuf(d, iobuf);
-
         for (i = 0; i < npages; i++) {
                 if (lnb[i].page == NULL)
                         continue;
@@ -1139,7 +1133,9 @@ static int osd_write_commit(const struct lu_env *env, struct dt_object *dt,
                 rc = osd_do_bio(osd, inode, iobuf);
                 /* we don't do stats here as in read path because
                  * write is async: we'll do this in osd_put_bufs() */
-        }
+       } else {
+               osd_fini_iobuf(osd, iobuf);
+       }
 
         if (unlikely(rc != 0)) {
                 /* if write fails, we should drop pages from the cache */