Whamcloud - gitweb
LU-7045 osd: enough credits for single indirect block write 30/16330/8
authorFan Yong <fan.yong@intel.com>
Fri, 7 Aug 2015 05:13:03 +0000 (13:13 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 14 Oct 2015 04:34:01 +0000 (04:34 +0000)
For single indirect block case, if the i_data[LDISKFS_IND_BLOCK]
block is not allocated, the osd_calc_bkmap_credits() should declare
additional three blocks for subsequent write operation; otherwise,
preserve another single block for that.

Test-Parameters: alwaysuploadlogs envdefinitions=SLOW=yes,ENABLE_QUOTA=yes,CONF_SANITY_EXCEPT=45 mdtfilesystemtype=ldiskfs mdsfilesystemtype=ldiskfs ostfilesystemtype=ldiskfs clientdistro=el7 ossdistro=el7 mdsdistro=el7 mdtcount=1 testlist=conf-sanity,conf-sanity,conf-sanity,conf-sanity,conf-sanity
Test-Parameters: alwaysuploadlogs envdefinitions=SLOW=yes,ENABLE_QUOTA=yes,CONF_SANITY_EXCEPT=45 mdtfilesystemtype=ldiskfs mdsfilesystemtype=ldiskfs ostfilesystemtype=ldiskfs clientdistro=el7 ossdistro=el7 mdsdistro=el7 mdscount=2 mdtcount=4 testlist=conf-sanity,conf-sanity,conf-sanity,conf-sanity,conf-sanity
Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I76b50cef8df56b49dae7afe4d759a55599548479
Reviewed-on: http://review.whamcloud.com/16330
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Tested-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/osd-ldiskfs/osd_io.c

index 98da270..83c72ff 100644 (file)
@@ -1527,9 +1527,12 @@ static inline int osd_calc_bkmap_credits(struct super_block *sb,
        } else if (pos + size <= (LDISKFS_NDIR_BLOCKS + 1024) * bs) {
                /* single indirect */
                credits = blocks * 3;
-               /* probably indirect block has been allocated already */
-               if (!inode || LDISKFS_I(inode)->i_data[LDISKFS_IND_BLOCK])
+               if (inode == NULL ||
+                   LDISKFS_I(inode)->i_data[LDISKFS_IND_BLOCK] == 0)
                        credits += 3;
+               else
+                       /* The indirect block may be modified. */
+                       credits += 1;
        }
 
        return credits;