Whamcloud - gitweb
LU-11663 osd-zfs: write partial pages with correct offset
[fs/lustre-release.git] / lustre / osd-zfs / osd_io.c
index bd26af6..b836536 100644 (file)
@@ -211,7 +211,7 @@ static ssize_t osd_declare_write(const struct lu_env *env, struct dt_object *dt,
 
 static ssize_t osd_write(const struct lu_env *env, struct dt_object *dt,
                        const struct lu_buf *buf, loff_t *pos,
-                       struct thandle *th, int ignore_quota)
+                        struct thandle *th)
 {
        struct osd_object  *obj  = osd_dt_obj(dt);
        struct osd_device  *osd = osd_obj2dev(obj);
@@ -692,8 +692,6 @@ static int osd_declare_write_commit(const struct lu_env *env,
                space += osd_roundup2blocksz(size, offset, blksz);
        }
 
-       oh->ot_write_commit = 1; /* used in osd_trans_start() for fail_loc */
-
        /* backend zfs filesystem might be configured to store multiple data
         * copies */
        space  *= osd->od_os->os_copies;
@@ -833,6 +831,9 @@ static int osd_write_commit(const struct lu_env *env, struct dt_object *dt,
            osd->od_readcache_max_filesize)
                drop_cache = 1;
 
+       if (OBD_FAIL_CHECK(OBD_FAIL_OST_MAPBLK_ENOSPC))
+               RETURN(-ENOSPC);
+
        /* LU-8791: take oo_guard to avoid the deadlock that changing block
         * size and assigning arcbuf take place at the same time.
         *
@@ -880,8 +881,8 @@ static int osd_write_commit(const struct lu_env *env, struct dt_object *dt,
 
                if (lnb[i].lnb_page->mapping == (void *)obj) {
                        osd_dmu_write(osd, obj->oo_dn, lnb[i].lnb_file_offset,
-                                     lnb[i].lnb_len, kmap(lnb[i].lnb_page),
-                                     oh->ot_tx);
+                                     lnb[i].lnb_len, kmap(lnb[i].lnb_page) +
+                                     lnb[i].lnb_page_offset, oh->ot_tx);
                        kunmap(lnb[i].lnb_page);
                        iosize += lnb[i].lnb_len;
                        abufsz = lnb[i].lnb_len; /* to drop cache below */