Hi Jean-Pierre,

Sometimes, I failed to add a file, and error log shows "Could not check
whether sparse"

A runlist that merged from two runlist  may exist more than one NOT_MAPPED
region, thus failed to pass sparse check in
ntfs_attr_update_mapping_pairs_i.

Following patch works for me.

Thanks,
-Forrest


diff --git a/libntfs-3g/attrib.c b/libntfs-3g/attrib.c
index 3df3a96..1a9ef37 100644
--- a/libntfs-3g/attrib.c
+++ b/libntfs-3g/attrib.c
@@ -5567,7 +5567,7 @@ retry:
  BOOL changed;

  if (!(na->data_flags & ATTR_IS_SPARSE)) {
- int sparse;
+ int sparse = 0;
  runlist_element *xrl;

  /*
@@ -5575,10 +5575,18 @@ retry:
  * have to check whether there is a hole
  * in the updated region.
  */
- xrl = na->rl;
- if (xrl->lcn == LCN_RL_NOT_MAPPED)
- xrl++;
- sparse = ntfs_rl_sparse(xrl);
+ for (xrl = na->rl; xrl->length; xrl++) {
+ if (xrl->lcn < 0) {
+ if (xrl->lcn == LCN_HOLE) {
+ sparse = 1;
+ break;
+ }
+ if (xrl->lcn != LCN_RL_NOT_MAPPED) {
+ sparse = -1;
+ break;
+ }
+ }
+ }
  if (sparse < 0) {
  ntfs_log_error("Could not check whether sparse\n");
  errno = EIO;
-- 
1.8.3.2
------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
ntfs-3g-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel

Reply via email to