public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* xfs_io bmap confused
@ 2015-07-08  7:01 Ming Lin
  2015-07-08  8:53 ` Christoph Hellwig
  2015-07-09  2:07 ` Dave Chinner
  0 siblings, 2 replies; 8+ messages in thread
From: Ming Lin @ 2015-07-08  7:01 UTC (permalink / raw)
  To: xfs; +Cc: Christoph Hellwig

Hi list,

I am testing some direct-io patches.
xfs_tests/xfs/080 failed.

It's strange.
There is no hole in "rwtest.file",
but when read it at some offset it returns zero because of hole.

root@block:~# xfs_io -c bmap /mnt/test/rwtest.file
/mnt/test/rwtest.file:
             0: [0..125671]: 160..125831

Then I read at file offset 659456,
root@block:~# dd if=/mnt/test/rwtest.file of=tmp.file bs=512 skip=1288 count=1

The code actually goes to below if statements.

Any idea what's wrong?

139 static struct bio *
140 do_mpage_readpage(struct bio *bio, struct page *page, unsigned nr_pages,
141                 sector_t *last_block_in_bio, struct buffer_head *map_bh,
142                 unsigned long *first_logical_block, get_block_t get_block)
143 {
....
....
209                 if (!buffer_mapped(map_bh)) {
210                         fully_mapped = 0;
211                         if (first_hole == blocks_per_page)
212                                 first_hole = page_block;
213                         page_block++;
214                         block_in_file++;
215                         continue;
216                 }
....
....
249         if (first_hole != blocks_per_page) {
250                 zero_user_segment(page, first_hole << blkbits, PAGE_CACHE_SIZE);
251                 if (first_hole == 0) {
252                         SetPageUptodate(page);
253                         unlock_page(page);
254                         goto out;
255                 }

Thanks,
Ming


_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: xfs_io bmap confused
  2015-07-08  7:01 xfs_io bmap confused Ming Lin
@ 2015-07-08  8:53 ` Christoph Hellwig
  2015-07-08 13:57   ` Ming Lin
  2015-07-09  2:07 ` Dave Chinner
  1 sibling, 1 reply; 8+ messages in thread
From: Christoph Hellwig @ 2015-07-08  8:53 UTC (permalink / raw)
  To: Ming Lin; +Cc: Christoph Hellwig, xfs

On Wed, Jul 08, 2015 at 12:01:53AM -0700, Ming Lin wrote:
> Hi list,
> 
> I am testing some direct-io patches.
> xfs_tests/xfs/080 failed.
> 
> It's strange.
> There is no hole in "rwtest.file",
> but when read it at some offset it returns zero because of hole.
> 
> root@block:~# xfs_io -c bmap /mnt/test/rwtest.file
> /mnt/test/rwtest.file:
>              0: [0..125671]: 160..125831

Sounds like you see an unwritten extent.  What does xfs_bmap -pv show on
the file?

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: xfs_io bmap confused
  2015-07-08  8:53 ` Christoph Hellwig
@ 2015-07-08 13:57   ` Ming Lin
  2015-07-08 23:40     ` Ming Lin
  0 siblings, 1 reply; 8+ messages in thread
From: Ming Lin @ 2015-07-08 13:57 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Wed, 2015-07-08 at 10:53 +0200, Christoph Hellwig wrote:
> On Wed, Jul 08, 2015 at 12:01:53AM -0700, Ming Lin wrote:
> > Hi list,
> > 
> > I am testing some direct-io patches.
> > xfs_tests/xfs/080 failed.
> > 
> > It's strange.
> > There is no hole in "rwtest.file",
> > but when read it at some offset it returns zero because of hole.
> > 
> > root@block:~# xfs_io -c bmap /mnt/test/rwtest.file
> > /mnt/test/rwtest.file:
> >              0: [0..125671]: 160..125831
> 
> Sounds like you see an unwritten extent.  What does xfs_bmap -pv show on
> the file?

root@block:~# xfs_bmap -pv /mnt/test/rwtest.file 
/mnt/test/rwtest.file:
 EXT: FILE-OFFSET       BLOCK-RANGE      AG AG-OFFSET        TOTAL FLAGS
   0: [0..743]:         160..903          0 (160..903)         744 00000
   1: [744..783]:       904..943          0 (904..943)          40 10000
   2: [784..951]:       944..1111         0 (944..1111)        168 00000
   3: [952..1023]:      1112..1183        0 (1112..1183)        72 10000
   4: [1024..1287]:     1184..1447        0 (1184..1447)       264 00000
   5: [1288..1383]:     1448..1543        0 (1448..1543)        96 10000
   6: [1384..1951]:     1544..2111        0 (1544..2111)       568 00000
   7: [1952..2415]:     2112..2575        0 (2112..2575)       464 10000
   8: [2416..2591]:     2576..2751        0 (2576..2751)       176 00000
   9: [2592..3111]:     2752..3271        0 (2752..3271)       520 10000
  10: [3112..3255]:     3272..3415        0 (3272..3415)       144 00000
  11: [3256..3375]:     3416..3535        0 (3416..3535)       120 10000
  12: [3376..3671]:     3536..3831        0 (3536..3831)       296 00000
  13: [3672..4415]:     3832..4575        0 (3832..4575)       744 10000
  14: [4416..4463]:     4576..4623        0 (4576..4623)        48 00000
  15: [4464..4479]:     4624..4639        0 (4624..4639)        16 10000
  16: [4480..5087]:     4640..5247        0 (4640..5247)       608 00000
  17: [5088..5303]:     5248..5463        0 (5248..5463)       216 10000
  18: [5304..5439]:     5464..5599        0 (5464..5599)       136 00000
  19: [5440..5599]:     5600..5759        0 (5600..5759)       160 10000
  20: [5600..5647]:     5760..5807        0 (5760..5807)        48 00000
  21: [5648..5695]:     5808..5855        0 (5808..5855)        48 10000
  22: [5696..5719]:     5856..5879        0 (5856..5879)        24 00000
  23: [5720..5831]:     5880..5991        0 (5880..5991)       112 10000
  24: [5832..5903]:     5992..6063        0 (5992..6063)        72 00000
  25: [5904..6879]:     6064..7039        0 (6064..7039)       976 10000
  26: [6880..7047]:     7040..7207        0 (7040..7207)       168 00000
  27: [7048..7319]:     7208..7479        0 (7208..7479)       272 10000
  28: [7320..7583]:     7480..7743        0 (7480..7743)       264 00000
  29: [7584..7751]:     7744..7911        0 (7744..7911)       168 10000
  30: [7752..7775]:     7912..7935        0 (7912..7935)        24 00000
  31: [7776..8263]:     7936..8423        0 (7936..8423)       488 10000
  32: [8264..8823]:     8424..8983        0 (8424..8983)       560 00000
  33: [8824..8863]:     8984..9023        0 (8984..9023)        40 10000
  34: [8864..9183]:     9024..9343        0 (9024..9343)       320 00000
  35: [9184..9479]:     9344..9639        0 (9344..9639)       296 10000
  36: [9480..9679]:     9640..9839        0 (9640..9839)       200 00000
  37: [9680..9807]:     9840..9967        0 (9840..9967)       128 10000
  38: [9808..10143]:    9968..10303       0 (9968..10303)      336 00000
  39: [10144..10359]:   10304..10519      0 (10304..10519)     216 10000
  40: [10360..10551]:   10520..10711      0 (10520..10711)     192 00000
  41: [10552..10831]:   10712..10991      0 (10712..10991)     280 10000
  42: [10832..10999]:   10992..11159      0 (10992..11159)     168 00000
  43: [11000..11951]:   11160..12111      0 (11160..12111)     952 10000
  44: [11952..12103]:   12112..12263      0 (12112..12263)     152 00000
  45: [12104..13255]:   12264..13415      0 (12264..13415)    1152 10000
  46: [13256..13559]:   13416..13719      0 (13416..13719)     304 00000
  47: [13560..13703]:   13720..13863      0 (13720..13863)     144 10000
  48: [13704..13839]:   13864..13999      0 (13864..13999)     136 00000
  49: [13840..13991]:   14000..14151      0 (14000..14151)     152 10000
  50: [13992..14455]:   14152..14615      0 (14152..14615)     464 00000
  51: [14456..15639]:   14616..15799      0 (14616..15799)    1184 10000
  52: [15640..15671]:   15800..15831      0 (15800..15831)      32 00000
  53: [15672..15919]:   15832..16079      0 (15832..16079)     248 10000
  54: [15920..15983]:   16080..16143      0 (16080..16143)      64 00000
  55: [15984..16223]:   16144..16383      0 (16144..16383)     240 10000
  56: [16224..16439]:   16384..16599      0 (16384..16599)     216 00000
  57: [16440..16863]:   16600..17023      0 (16600..17023)     424 10000
  58: [16864..16919]:   17024..17079      0 (17024..17079)      56 00000
  59: [16920..17031]:   17080..17191      0 (17080..17191)     112 10000
  60: [17032..17911]:   17192..18071      0 (17192..18071)     880 00000
  61: [17912..18191]:   18072..18351      0 (18072..18351)     280 10000
  62: [18192..18327]:   18352..18487      0 (18352..18487)     136 00000
  63: [18328..18487]:   18488..18647      0 (18488..18647)     160 10000
  64: [18488..18551]:   18648..18711      0 (18648..18711)      64 00000
  65: [18552..18639]:   18712..18799      0 (18712..18799)      88 10000
  66: [18640..19079]:   18800..19239      0 (18800..19239)     440 00000
  67: [19080..19279]:   19240..19439      0 (19240..19439)     200 10000
  68: [19280..19607]:   19440..19767      0 (19440..19767)     328 00000
  69: [19608..20199]:   19768..20359      0 (19768..20359)     592 10000
  70: [20200..20591]:   20360..20751      0 (20360..20751)     392 00000
  71: [20592..20639]:   20752..20799      0 (20752..20799)      48 10000
  72: [20640..20767]:   20800..20927      0 (20800..20927)     128 00000
  73: [20768..20951]:   20928..21111      0 (20928..21111)     184 10000
  74: [20952..21343]:   21112..21503      0 (21112..21503)     392 00000
  75: [21344..21583]:   21504..21743      0 (21504..21743)     240 10000
  76: [21584..21855]:   21744..22015      0 (21744..22015)     272 00000
  77: [21856..22279]:   22016..22439      0 (22016..22439)     424 10000
  78: [22280..22479]:   22440..22639      0 (22440..22639)     200 00000
  79: [22480..22543]:   22640..22703      0 (22640..22703)      64 10000
  80: [22544..22671]:   22704..22831      0 (22704..22831)     128 00000
  81: [22672..22903]:   22832..23063      0 (22832..23063)     232 10000
  82: [22904..23087]:   23064..23247      0 (23064..23247)     184 00000
  83: [23088..23207]:   23248..23367      0 (23248..23367)     120 10000
  84: [23208..23455]:   23368..23615      0 (23368..23615)     248 00000
  85: [23456..23487]:   23616..23647      0 (23616..23647)      32 10000
  86: [23488..24455]:   23648..24615      0 (23648..24615)     968 00000
  87: [24456..25071]:   24616..25231      0 (24616..25231)     616 10000
  88: [25072..25311]:   25232..25471      0 (25232..25471)     240 00000
  89: [25312..25487]:   25472..25647      0 (25472..25647)     176 10000
  90: [25488..25799]:   25648..25959      0 (25648..25959)     312 00000
  91: [25800..25831]:   25960..25991      0 (25960..25991)      32 10000
  92: [25832..26087]:   25992..26247      0 (25992..26247)     256 00000
  93: [26088..26351]:   26248..26511      0 (26248..26511)     264 10000
  94: [26352..26551]:   26512..26711      0 (26512..26711)     200 00000
  95: [26552..26695]:   26712..26855      0 (26712..26855)     144 10000
  96: [26696..26847]:   26856..27007      0 (26856..27007)     152 00000
  97: [26848..27463]:   27008..27623      0 (27008..27623)     616 10000
  98: [27464..27583]:   27624..27743      0 (27624..27743)     120 00000
  99: [27584..27655]:   27744..27815      0 (27744..27815)      72 10000
 100: [27656..28063]:   27816..28223      0 (27816..28223)     408 00000
 101: [28064..28535]:   28224..28695      0 (28224..28695)     472 10000
 102: [28536..28679]:   28696..28839      0 (28696..28839)     144 00000
 103: [28680..29175]:   28840..29335      0 (28840..29335)     496 10000
 104: [29176..29407]:   29336..29567      0 (29336..29567)     232 00000
 105: [29408..29487]:   29568..29647      0 (29568..29647)      80 10000
 106: [29488..29743]:   29648..29903      0 (29648..29903)     256 00000
 107: [29744..30175]:   29904..30335      0 (29904..30335)     432 10000
 108: [30176..30247]:   30336..30407      0 (30336..30407)      72 00000
 109: [30248..30535]:   30408..30695      0 (30408..30695)     288 10000
 110: [30536..30607]:   30696..30767      0 (30696..30767)      72 00000
 111: [30608..30719]:   30768..30879      0 (30768..30879)     112 10000
 112: [30720..30943]:   30880..31103      0 (30880..31103)     224 00000
 113: [30944..31111]:   31104..31271      0 (31104..31271)     168 10000
 114: [31112..31239]:   31272..31399      0 (31272..31399)     128 00000
 115: [31240..31439]:   31400..31599      0 (31400..31599)     200 10000
 116: [31440..31671]:   31600..31831      0 (31600..31831)     232 00000
 117: [31672..31815]:   31832..31975      0 (31832..31975)     144 10000
 118: [31816..31967]:   31976..32127      0 (31976..32127)     152 00000
 119: [31968..32159]:   32128..32319      0 (32128..32319)     192 10000
 120: [32160..32247]:   32320..32407      0 (32320..32407)      88 00000
 121: [32248..32495]:   32408..32655      0 (32408..32655)     248 10000
 122: [32496..32599]:   32656..32759      0 (32656..32759)     104 00000
 123: [32600..32711]:   32760..32871      0 (32760..32871)     112 10000
 124: [32712..32799]:   32872..32959      0 (32872..32959)      88 00000
 125: [32800..32983]:   32960..33143      0 (32960..33143)     184 10000
 126: [32984..33223]:   33144..33383      0 (33144..33383)     240 00000
 127: [33224..33415]:   33384..33575      0 (33384..33575)     192 10000
 128: [33416..33895]:   33576..34055      0 (33576..34055)     480 00000
 129: [33896..33959]:   34056..34119      0 (34056..34119)      64 10000
 130: [33960..34215]:   34120..34375      0 (34120..34375)     256 00000
 131: [34216..34543]:   34376..34703      0 (34376..34703)     328 10000
 132: [34544..35831]:   34704..35991      0 (34704..35991)    1288 00000
 133: [35832..35895]:   35992..36055      0 (35992..36055)      64 10000
 134: [35896..36615]:   36056..36775      0 (36056..36775)     720 00000
 135: [36616..37119]:   36776..37279      0 (36776..37279)     504 10000
 136: [37120..37511]:   37280..37671      0 (37280..37671)     392 00000
 137: [37512..38439]:   37672..38599      0 (37672..38599)     928 10000
 138: [38440..38927]:   38600..39087      0 (38600..39087)     488 00000
 139: [38928..39167]:   39088..39327      0 (39088..39327)     240 10000
 140: [39168..39279]:   39328..39439      0 (39328..39439)     112 00000
 141: [39280..39407]:   39440..39567      0 (39440..39567)     128 10000
 142: [39408..39639]:   39568..39799      0 (39568..39799)     232 00000
 143: [39640..39799]:   39800..39959      0 (39800..39959)     160 10000
 144: [39800..39807]:   39960..39967      0 (39960..39967)       8 00000
 145: [39808..40319]:   39968..40479      0 (39968..40479)     512 10000
 146: [40320..40871]:   40480..41031      0 (40480..41031)     552 00000
 147: [40872..40935]:   41032..41095      0 (41032..41095)      64 10000
 148: [40936..41247]:   41096..41407      0 (41096..41407)     312 00000
 149: [41248..41439]:   41408..41599      0 (41408..41599)     192 10000
 150: [41440..42039]:   41600..42199      0 (41600..42199)     600 00000
 151: [42040..42303]:   42200..42463      0 (42200..42463)     264 10000
 152: [42304..42535]:   42464..42695      0 (42464..42695)     232 00000
 153: [42536..42919]:   42696..43079      0 (42696..43079)     384 10000
 154: [42920..43087]:   43080..43247      0 (43080..43247)     168 00000
 155: [43088..43343]:   43248..43503      0 (43248..43503)     256 10000
 156: [43344..43383]:   43504..43543      0 (43504..43543)      40 00000
 157: [43384..43599]:   43544..43759      0 (43544..43759)     216 10000
 158: [43600..43863]:   43760..44023      0 (43760..44023)     264 00000
 159: [43864..44271]:   44024..44431      0 (44024..44431)     408 10000
 160: [44272..44463]:   44432..44623      0 (44432..44623)     192 00000
 161: [44464..44671]:   44624..44831      0 (44624..44831)     208 10000
 162: [44672..44919]:   44832..45079      0 (44832..45079)     248 00000
 163: [44920..44999]:   45080..45159      0 (45080..45159)      80 10000
 164: [45000..45135]:   45160..45295      0 (45160..45295)     136 00000
 165: [45136..45183]:   45296..45343      0 (45296..45343)      48 10000
 166: [45184..45463]:   45344..45623      0 (45344..45623)     280 00000
 167: [45464..46495]:   45624..46655      0 (45624..46655)    1032 10000
 168: [46496..46751]:   46656..46911      0 (46656..46911)     256 00000
 169: [46752..47023]:   46912..47183      0 (46912..47183)     272 10000
 170: [47024..47343]:   47184..47503      0 (47184..47503)     320 00000
 171: [47344..47511]:   47504..47671      0 (47504..47671)     168 10000
 172: [47512..47543]:   47672..47703      0 (47672..47703)      32 00000
 173: [47544..48055]:   47704..48215      0 (47704..48215)     512 10000
 174: [48056..48175]:   48216..48335      0 (48216..48335)     120 00000
 175: [48176..48343]:   48336..48503      0 (48336..48503)     168 10000
 176: [48344..48495]:   48504..48655      0 (48504..48655)     152 00000
 177: [48496..48999]:   48656..49159      0 (48656..49159)     504 10000
 178: [49000..49399]:   49160..49559      0 (49160..49559)     400 00000
 179: [49400..49767]:   49560..49927      0 (49560..49927)     368 10000
 180: [49768..50343]:   49928..50503      0 (49928..50503)     576 00000
 181: [50344..50583]:   50504..50743      0 (50504..50743)     240 10000
 182: [50584..50639]:   50744..50799      0 (50744..50799)      56 00000
 183: [50640..51215]:   50800..51375      0 (50800..51375)     576 10000
 184: [51216..51575]:   51376..51735      0 (51376..51735)     360 00000
 185: [51576..51711]:   51736..51871      0 (51736..51871)     136 10000
 186: [51712..52407]:   51872..52567      0 (51872..52567)     696 00000
 187: [52408..52631]:   52568..52791      0 (52568..52791)     224 10000
 188: [52632..53055]:   52792..53215      0 (52792..53215)     424 00000
 189: [53056..53279]:   53216..53439      0 (53216..53439)     224 10000
 190: [53280..53431]:   53440..53591      0 (53440..53591)     152 00000
 191: [53432..54127]:   53592..54287      0 (53592..54287)     696 10000
 192: [54128..54239]:   54288..54399      0 (54288..54399)     112 00000
 193: [54240..54295]:   54400..54455      0 (54400..54455)      56 10000
 194: [54296..54743]:   54456..54903      0 (54456..54903)     448 00000
 195: [54744..54887]:   54904..55047      0 (54904..55047)     144 10000
 196: [54888..55151]:   55048..55311      0 (55048..55311)     264 00000
 197: [55152..55607]:   55312..55767      0 (55312..55767)     456 10000
 198: [55608..56359]:   55768..56519      0 (55768..56519)     752 00000
 199: [56360..56567]:   56520..56727      0 (56520..56727)     208 10000
 200: [56568..56975]:   56728..57135      0 (56728..57135)     408 00000
 201: [56976..57367]:   57136..57527      0 (57136..57527)     392 10000
 202: [57368..57791]:   57528..57951      0 (57528..57951)     424 00000
 203: [57792..58239]:   57952..58399      0 (57952..58399)     448 10000
 204: [58240..58295]:   58400..58455      0 (58400..58455)      56 00000
 205: [58296..58527]:   58456..58687      0 (58456..58687)     232 10000
 206: [58528..58727]:   58688..58887      0 (58688..58887)     200 00000
 207: [58728..59167]:   58888..59327      0 (58888..59327)     440 10000
 208: [59168..59295]:   59328..59455      0 (59328..59455)     128 00000
 209: [59296..59311]:   59456..59471      0 (59456..59471)      16 10000
 210: [59312..59607]:   59472..59767      0 (59472..59767)     296 00000
 211: [59608..59687]:   59768..59847      0 (59768..59847)      80 10000
 212: [59688..59983]:   59848..60143      0 (59848..60143)     296 00000
 213: [59984..60087]:   60144..60247      0 (60144..60247)     104 10000
 214: [60088..60199]:   60248..60359      0 (60248..60359)     112 00000
 215: [60200..60279]:   60360..60439      0 (60360..60439)      80 10000
 216: [60280..60655]:   60440..60815      0 (60440..60815)     376 00000
 217: [60656..61135]:   60816..61295      0 (60816..61295)     480 10000
 218: [61136..61327]:   61296..61487      0 (61296..61487)     192 00000
 219: [61328..61439]:   61488..61599      0 (61488..61599)     112 10000
 220: [61440..61607]:   61600..61767      0 (61600..61767)     168 00000
 221: [61608..61935]:   61768..62095      0 (61768..62095)     328 10000
 222: [61936..62135]:   62096..62295      0 (62096..62295)     200 00000
 223: [62136..62559]:   62296..62719      0 (62296..62719)     424 10000
 224: [62560..62583]:   62720..62743      0 (62720..62743)      24 00000
 225: [62584..62607]:   62744..62767      0 (62744..62767)      24 10000
 226: [62608..63087]:   62768..63247      0 (62768..63247)     480 00000
 227: [63088..63303]:   63248..63463      0 (63248..63463)     216 10000
 228: [63304..63903]:   63464..64063      0 (63464..64063)     600 00000
 229: [63904..64727]:   64064..64887      0 (64064..64887)     824 10000
 230: [64728..64951]:   64888..65111      0 (64888..65111)     224 00000
 231: [64952..65207]:   65112..65367      0 (65112..65367)     256 10000
 232: [65208..65223]:   65368..65383      0 (65368..65383)      16 00000
 233: [65224..65367]:   65384..65527      0 (65384..65527)     144 10000
 234: [65368..65591]:   65528..65751      0 (65528..65751)     224 00000
 235: [65592..65679]:   65752..65839      0 (65752..65839)      88 10000
 236: [65680..65823]:   65840..65983      0 (65840..65983)     144 00000
 237: [65824..66487]:   65984..66647      0 (65984..66647)     664 10000
 238: [66488..66687]:   66648..66847      0 (66648..66847)     200 00000
 239: [66688..67263]:   66848..67423      0 (66848..67423)     576 10000
 240: [67264..67927]:   67424..68087      0 (67424..68087)     664 00000
 241: [67928..68127]:   68088..68287      0 (68088..68287)     200 10000
 242: [68128..68383]:   68288..68543      0 (68288..68543)     256 00000
 243: [68384..68591]:   68544..68751      0 (68544..68751)     208 10000
 244: [68592..68807]:   68752..68967      0 (68752..68967)     216 00000
 245: [68808..68879]:   68968..69039      0 (68968..69039)      72 10000
 246: [68880..69055]:   69040..69215      0 (69040..69215)     176 00000
 247: [69056..69495]:   69216..69655      0 (69216..69655)     440 10000
 248: [69496..69599]:   69656..69759      0 (69656..69759)     104 00000
 249: [69600..69847]:   69760..70007      0 (69760..70007)     248 10000
 250: [69848..70071]:   70008..70231      0 (70008..70231)     224 00000
 251: [70072..70359]:   70232..70519      0 (70232..70519)     288 10000
 252: [70360..70615]:   70520..70775      0 (70520..70775)     256 00000
 253: [70616..70919]:   70776..71079      0 (70776..71079)     304 10000
 254: [70920..71319]:   71080..71479      0 (71080..71479)     400 00000
 255: [71320..71535]:   71480..71695      0 (71480..71695)     216 10000
 256: [71536..71791]:   71696..71951      0 (71696..71951)     256 00000
 257: [71792..71887]:   71952..72047      0 (71952..72047)      96 10000
 258: [71888..71975]:   72048..72135      0 (72048..72135)      88 00000
 259: [71976..72167]:   72136..72327      0 (72136..72327)     192 10000
 260: [72168..72303]:   72328..72463      0 (72328..72463)     136 00000
 261: [72304..73167]:   72464..73327      0 (72464..73327)     864 10000
 262: [73168..73719]:   73328..73879      0 (73328..73879)     552 00000
 263: [73720..73871]:   73880..74031      0 (73880..74031)     152 10000
 264: [73872..74399]:   74032..74559      0 (74032..74559)     528 00000
 265: [74400..74583]:   74560..74743      0 (74560..74743)     184 10000
 266: [74584..75007]:   74744..75167      0 (74744..75167)     424 00000
 267: [75008..75439]:   75168..75599      0 (75168..75599)     432 10000
 268: [75440..75655]:   75600..75815      0 (75600..75815)     216 00000
 269: [75656..75943]:   75816..76103      0 (75816..76103)     288 10000
 270: [75944..76087]:   76104..76247      0 (76104..76247)     144 00000
 271: [76088..76239]:   76248..76399      0 (76248..76399)     152 10000
 272: [76240..76471]:   76400..76631      0 (76400..76631)     232 00000
 273: [76472..76735]:   76632..76895      0 (76632..76895)     264 10000
 274: [76736..77271]:   76896..77431      0 (76896..77431)     536 00000
 275: [77272..77511]:   77432..77671      0 (77432..77671)     240 10000
 276: [77512..78071]:   77672..78231      0 (77672..78231)     560 00000
 277: [78072..78183]:   78232..78343      0 (78232..78343)     112 10000
 278: [78184..78231]:   78344..78391      0 (78344..78391)      48 00000
 279: [78232..78367]:   78392..78527      0 (78392..78527)     136 10000
 280: [78368..78687]:   78528..78847      0 (78528..78847)     320 00000
 281: [78688..78751]:   78848..78911      0 (78848..78911)      64 10000
 282: [78752..79063]:   78912..79223      0 (78912..79223)     312 00000
 283: [79064..79679]:   79224..79839      0 (79224..79839)     616 10000
 284: [79680..79743]:   79840..79903      0 (79840..79903)      64 00000
 285: [79744..79951]:   79904..80111      0 (79904..80111)     208 10000
 286: [79952..80335]:   80112..80495      0 (80112..80495)     384 00000
 287: [80336..80375]:   80496..80535      0 (80496..80535)      40 10000
 288: [80376..80399]:   80536..80559      0 (80536..80559)      24 00000
 289: [80400..80711]:   80560..80871      0 (80560..80871)     312 10000
 290: [80712..80831]:   80872..80991      0 (80872..80991)     120 00000
 291: [80832..81279]:   80992..81439      0 (80992..81439)     448 10000
 292: [81280..81471]:   81440..81631      0 (81440..81631)     192 00000
 293: [81472..81655]:   81632..81815      0 (81632..81815)     184 10000
 294: [81656..82255]:   81816..82415      0 (81816..82415)     600 00000
 295: [82256..82455]:   82416..82615      0 (82416..82615)     200 10000
 296: [82456..82671]:   82616..82831      0 (82616..82831)     216 00000
 297: [82672..83207]:   82832..83367      0 (82832..83367)     536 10000
 298: [83208..83855]:   83368..84015      0 (83368..84015)     648 00000
 299: [83856..84423]:   84016..84583      0 (84016..84583)     568 10000
 300: [84424..84567]:   84584..84727      0 (84584..84727)     144 00000
 301: [84568..84791]:   84728..84951      0 (84728..84951)     224 10000
 302: [84792..84807]:   84952..84967      0 (84952..84967)      16 00000
 303: [84808..85119]:   84968..85279      0 (84968..85279)     312 10000
 304: [85120..85303]:   85280..85463      0 (85280..85463)     184 00000
 305: [85304..85631]:   85464..85791      0 (85464..85791)     328 10000
 306: [85632..85647]:   85792..85807      0 (85792..85807)      16 00000
 307: [85648..85711]:   85808..85871      0 (85808..85871)      64 10000
 308: [85712..86063]:   85872..86223      0 (85872..86223)     352 00000
 309: [86064..86639]:   86224..86799      0 (86224..86799)     576 10000
 310: [86640..86839]:   86800..86999      0 (86800..86999)     200 00000
 311: [86840..87175]:   87000..87335      0 (87000..87335)     336 10000
 312: [87176..88039]:   87336..88199      0 (87336..88199)     864 00000
 313: [88040..88151]:   88200..88311      0 (88200..88311)     112 10000
 314: [88152..88367]:   88312..88527      0 (88312..88527)     216 00000
 315: [88368..88559]:   88528..88719      0 (88528..88719)     192 10000
 316: [88560..88759]:   88720..88919      0 (88720..88919)     200 00000
 317: [88760..88839]:   88920..88999      0 (88920..88999)      80 10000
 318: [88840..89119]:   89000..89279      0 (89000..89279)     280 00000
 319: [89120..89335]:   89280..89495      0 (89280..89495)     216 10000
 320: [89336..89567]:   89496..89727      0 (89496..89727)     232 00000
 321: [89568..90127]:   89728..90287      0 (89728..90287)     560 10000
 322: [90128..90367]:   90288..90527      0 (90288..90527)     240 00000
 323: [90368..90447]:   90528..90607      0 (90528..90607)      80 10000
 324: [90448..90455]:   90608..90615      0 (90608..90615)       8 00000
 325: [90456..90647]:   90616..90807      0 (90616..90807)     192 10000
 326: [90648..90919]:   90808..91079      0 (90808..91079)     272 00000
 327: [90920..90935]:   91080..91095      0 (91080..91095)      16 10000
 328: [90936..91519]:   91096..91679      0 (91096..91679)     584 00000
 329: [91520..92375]:   91680..92535      0 (91680..92535)     856 10000
 330: [92376..92783]:   92536..92943      0 (92536..92943)     408 00000
 331: [92784..93479]:   92944..93639      0 (92944..93639)     696 10000
 332: [93480..93599]:   93640..93759      0 (93640..93759)     120 00000
 333: [93600..93623]:   93760..93783      0 (93760..93783)      24 10000
 334: [93624..93751]:   93784..93911      0 (93784..93911)     128 00000
 335: [93752..93991]:   93912..94151      0 (93912..94151)     240 10000
 336: [93992..94239]:   94152..94399      0 (94152..94399)     248 00000
 337: [94240..94367]:   94400..94527      0 (94400..94527)     128 10000
 338: [94368..94895]:   94528..95055      0 (94528..95055)     528 00000
 339: [94896..95191]:   95056..95351      0 (95056..95351)     296 10000
 340: [95192..95583]:   95352..95743      0 (95352..95743)     392 00000
 341: [95584..95847]:   95744..96007      0 (95744..96007)     264 10000
 342: [95848..96831]:   96008..96991      0 (96008..96991)     984 00000
 343: [96832..97103]:   96992..97263      0 (96992..97263)     272 10000
 344: [97104..97503]:   97264..97663      0 (97264..97663)     400 00000
 345: [97504..97799]:   97664..97959      0 (97664..97959)     296 10000
 346: [97800..97935]:   97960..98095      0 (97960..98095)     136 00000
 347: [97936..98599]:   98096..98759      0 (98096..98759)     664 10000
 348: [98600..98663]:   98760..98823      0 (98760..98823)      64 00000
 349: [98664..99223]:   98824..99383      0 (98824..99383)     560 10000
 350: [99224..99399]:   99384..99559      0 (99384..99559)     176 00000
 351: [99400..99735]:   99560..99895      0 (99560..99895)     336 10000
 352: [99736..100047]:  99896..100207     0 (99896..100207)    312 00000
 353: [100048..100687]: 100208..100847    0 (100208..100847)   640 10000
 354: [100688..100759]: 100848..100919    0 (100848..100919)    72 00000
 355: [100760..101191]: 100920..101351    0 (100920..101351)   432 10000
 356: [101192..101391]: 101352..101551    0 (101352..101551)   200 00000
 357: [101392..101551]: 101552..101711    0 (101552..101711)   160 10000
 358: [101552..101679]: 101712..101839    0 (101712..101839)   128 00000
 359: [101680..102039]: 101840..102199    0 (101840..102199)   360 10000
 360: [102040..102687]: 102200..102847    0 (102200..102847)   648 00000
 361: [102688..102823]: 102848..102983    0 (102848..102983)   136 10000
 362: [102824..103167]: 102984..103327    0 (102984..103327)   344 00000
 363: [103168..103599]: 103328..103759    0 (103328..103759)   432 10000
 364: [103600..103847]: 103760..104007    0 (103760..104007)   248 00000
 365: [103848..104343]: 104008..104503    0 (104008..104503)   496 10000
 366: [104344..104535]: 104504..104695    0 (104504..104695)   192 00000
 367: [104536..104655]: 104696..104815    0 (104696..104815)   120 10000
 368: [104656..104743]: 104816..104903    0 (104816..104903)    88 00000
 369: [104744..104991]: 104904..105151    0 (104904..105151)   248 10000
 370: [104992..105527]: 105152..105687    0 (105152..105687)   536 00000
 371: [105528..105735]: 105688..105895    0 (105688..105895)   208 10000
 372: [105736..105767]: 105896..105927    0 (105896..105927)    32 00000
 373: [105768..105999]: 105928..106159    0 (105928..106159)   232 10000
 374: [106000..106231]: 106160..106391    0 (106160..106391)   232 00000
 375: [106232..106415]: 106392..106575    0 (106392..106575)   184 10000
 376: [106416..106807]: 106576..106967    0 (106576..106967)   392 00000
 377: [106808..107023]: 106968..107183    0 (106968..107183)   216 10000
 378: [107024..107167]: 107184..107327    0 (107184..107327)   144 00000
 379: [107168..107455]: 107328..107615    0 (107328..107615)   288 10000
 380: [107456..107511]: 107616..107671    0 (107616..107671)    56 00000
 381: [107512..107743]: 107672..107903    0 (107672..107903)   232 10000
 382: [107744..107943]: 107904..108103    0 (107904..108103)   200 00000
 383: [107944..108135]: 108104..108295    0 (108104..108295)   192 10000
 384: [108136..108375]: 108296..108535    0 (108296..108535)   240 00000
 385: [108376..108431]: 108536..108591    0 (108536..108591)    56 10000
 386: [108432..108703]: 108592..108863    0 (108592..108863)   272 00000
 387: [108704..108855]: 108864..109015    0 (108864..109015)   152 10000
 388: [108856..109047]: 109016..109207    0 (109016..109207)   192 00000
 389: [109048..109543]: 109208..109703    0 (109208..109703)   496 10000
 390: [109544..109615]: 109704..109775    0 (109704..109775)    72 00000
 391: [109616..109671]: 109776..109831    0 (109776..109831)    56 10000
 392: [109672..109847]: 109832..110007    0 (109832..110007)   176 00000
 393: [109848..109983]: 110008..110143    0 (110008..110143)   136 10000
 394: [109984..110079]: 110144..110239    0 (110144..110239)    96 00000
 395: [110080..110159]: 110240..110319    0 (110240..110319)    80 10000
 396: [110160..110303]: 110320..110463    0 (110320..110463)   144 00000
 397: [110304..110447]: 110464..110607    0 (110464..110607)   144 10000
 398: [110448..111103]: 110608..111263    0 (110608..111263)   656 00000
 399: [111104..111263]: 111264..111423    0 (111264..111423)   160 10000
 400: [111264..111327]: 111424..111487    0 (111424..111487)    64 00000
 401: [111328..111527]: 111488..111687    0 (111488..111687)   200 10000
 402: [111528..111727]: 111688..111887    0 (111688..111887)   200 00000
 403: [111728..111823]: 111888..111983    0 (111888..111983)    96 10000
 404: [111824..112015]: 111984..112175    0 (111984..112175)   192 00000
 405: [112016..112111]: 112176..112271    0 (112176..112271)    96 10000
 406: [112112..112399]: 112272..112559    0 (112272..112559)   288 00000
 407: [112400..112639]: 112560..112799    0 (112560..112799)   240 10000
 408: [112640..113351]: 112800..113511    0 (112800..113511)   712 00000
 409: [113352..114183]: 113512..114343    0 (113512..114343)   832 10000
 410: [114184..114335]: 114344..114495    0 (114344..114495)   152 00000
 411: [114336..115047]: 114496..115207    0 (114496..115207)   712 10000
 412: [115048..115119]: 115208..115279    0 (115208..115279)    72 00000
 413: [115120..115303]: 115280..115463    0 (115280..115463)   184 10000
 414: [115304..115759]: 115464..115919    0 (115464..115919)   456 00000
 415: [115760..115863]: 115920..116023    0 (115920..116023)   104 10000
 416: [115864..116039]: 116024..116199    0 (116024..116199)   176 00000
 417: [116040..116263]: 116200..116423    0 (116200..116423)   224 10000
 418: [116264..116407]: 116424..116567    0 (116424..116567)   144 00000
 419: [116408..116687]: 116568..116847    0 (116568..116847)   280 10000
 420: [116688..116967]: 116848..117127    0 (116848..117127)   280 00000
 421: [116968..117207]: 117128..117367    0 (117128..117367)   240 10000
 422: [117208..117311]: 117368..117471    0 (117368..117471)   104 00000
 423: [117312..117343]: 117472..117503    0 (117472..117503)    32 10000
 424: [117344..117559]: 117504..117719    0 (117504..117719)   216 00000
 425: [117560..117831]: 117720..117991    0 (117720..117991)   272 10000
 426: [117832..117919]: 117992..118079    0 (117992..118079)    88 00000
 427: [117920..118143]: 118080..118303    0 (118080..118303)   224 10000
 428: [118144..118231]: 118304..118391    0 (118304..118391)    88 00000
 429: [118232..118439]: 118392..118599    0 (118392..118599)   208 10000
 430: [118440..118495]: 118600..118655    0 (118600..118655)    56 00000
 431: [118496..118631]: 118656..118791    0 (118656..118791)   136 10000
 432: [118632..119351]: 118792..119511    0 (118792..119511)   720 00000
 433: [119352..119623]: 119512..119783    0 (119512..119783)   272 10000
 434: [119624..119791]: 119784..119951    0 (119784..119951)   168 00000
 435: [119792..119959]: 119952..120119    0 (119952..120119)   168 10000
 436: [119960..120223]: 120120..120383    0 (120120..120383)   264 00000
 437: [120224..120447]: 120384..120607    0 (120384..120607)   224 10000
 438: [120448..120903]: 120608..121063    0 (120608..121063)   456 00000
 439: [120904..121143]: 121064..121303    0 (121064..121303)   240 10000
 440: [121144..121527]: 121304..121687    0 (121304..121687)   384 00000
 441: [121528..121687]: 121688..121847    0 (121688..121847)   160 10000
 442: [121688..121879]: 121848..122039    0 (121848..122039)   192 00000
 443: [121880..122391]: 122040..122551    0 (122040..122551)   512 10000
 444: [122392..122887]: 122552..123047    0 (122552..123047)   496 00000
 445: [122888..123191]: 123048..123351    0 (123048..123351)   304 10000
 446: [123192..123927]: 123352..124087    0 (123352..124087)   736 00000
 447: [123928..124215]: 124088..124375    0 (124088..124375)   288 10000
 448: [124216..124815]: 124376..124975    0 (124376..124975)   600 00000
 449: [124816..125007]: 124976..125167    0 (124976..125167)   192 10000
 450: [125008..125095]: 125168..125255    0 (125168..125255)    88 00000
 451: [125096..125223]: 125256..125383    0 (125256..125383)   128 10000
 452: [125224..125671]: 125384..125831    0 (125384..125831)   448 00000



_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: xfs_io bmap confused
  2015-07-08 13:57   ` Ming Lin
@ 2015-07-08 23:40     ` Ming Lin
  2015-07-09  6:54       ` Ming Lin
  0 siblings, 1 reply; 8+ messages in thread
From: Ming Lin @ 2015-07-08 23:40 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Wed, 2015-07-08 at 06:57 -0700, Ming Lin wrote:
> On Wed, 2015-07-08 at 10:53 +0200, Christoph Hellwig wrote:
> > On Wed, Jul 08, 2015 at 12:01:53AM -0700, Ming Lin wrote:
> > > Hi list,
> > >
> > > I am testing some direct-io patches.
> > > xfs_tests/xfs/080 failed.
> > >
> > > It's strange.
> > > There is no hole in "rwtest.file",
> > > but when read it at some offset it returns zero because of hole.
> > >
> > > root@block:~# xfs_io -c bmap /mnt/test/rwtest.file
> > > /mnt/test/rwtest.file:
> > >              0: [0..125671]: 160..125831
> >
> > Sounds like you see an unwritten extent.  What does xfs_bmap -pv show on
> > the file?
>
> root@block:~# xfs_bmap -pv /mnt/test/rwtest.file
> /mnt/test/rwtest.file:
>  EXT: FILE-OFFSET       BLOCK-RANGE      AG AG-OFFSET        TOTAL FLAGS
>    0: [0..743]:         160..903          0 (160..903)         744 00000
>    1: [744..783]:       904..943          0 (904..943)          40 10000
>    2: [784..951]:       944..1111         0 (944..1111)        168 00000
>    3: [952..1023]:      1112..1183        0 (1112..1183)        72 10000
>    4: [1024..1287]:     1184..1447        0 (1184..1447)       264 00000
>    5: [1288..1383]:     1448..1543        0 (1448..1543)        96 10000

file offset 659456 is in EXT 5.
I guess FLAGS 1 means it's an unwritten extent, right?

xfs_tests/xfs/080 basically does:
1. direct io write
2. then buffered read to check the previous dio write

Here is an example of error logs.

doio ( 3626) 16:13:23
---------------------
*** DATA COMPARISON ERROR ***
check_file(/mnt/test/rwtest.file, 239616, 81408, H:3626:block:doio*,
18, 0) failed

Comparison fd is 5, with open flags 0
Corrupt regions follow - unprintable chars are represented as '.'
-----------------------------------------------------------------
corrupt bytes starting at file offset 241664
    1st 32 expected bytes:  oio*H:3626:block:doio*H:3626:blo
    1st 32 actual bytes:    ................................

Request number 981
          fd 4 is file /mnt/test/rwtest.file - open flags are 040001
O_WRONLY,O_DIRECT,
          write done at file offset 239616 - pattern is H (0110)
          number of requests is 1, strides per request is 1
          i/o byte count = 81408
          memory alignment is aligned
          DIRECT I/O: offset % 512 = 0 length % 81408 = 0
          mem alignment 0x200 xfer size: small: 512 large: 2147483136

syscall:  writev(4, (iov on stack), 1)


The "expected bytes" was actually written to the disk successfully,
but for some bug the xfs extent flag was not set correctly.
The flag should be "XFS_EXT_NORM", but now it's "XFS_EXT_UNWRITTEN".

Could you share the code path the extent flag was updated?
Is it also updated through direct io?

Thanks.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: xfs_io bmap confused
  2015-07-08  7:01 xfs_io bmap confused Ming Lin
  2015-07-08  8:53 ` Christoph Hellwig
@ 2015-07-09  2:07 ` Dave Chinner
  1 sibling, 0 replies; 8+ messages in thread
From: Dave Chinner @ 2015-07-09  2:07 UTC (permalink / raw)
  To: Ming Lin; +Cc: Christoph Hellwig, xfs

On Wed, Jul 08, 2015 at 12:01:53AM -0700, Ming Lin wrote:
> Hi list,
> 
> I am testing some direct-io patches.
> xfs_tests/xfs/080 failed.
> 
> It's strange.
> There is no hole in "rwtest.file",
> but when read it at some offset it returns zero because of hole.
> 
> root@block:~# xfs_io -c bmap /mnt/test/rwtest.file
> /mnt/test/rwtest.file:
>              0: [0..125671]: 160..125831
> 
> Then I read at file offset 659456,
> root@block:~# dd if=/mnt/test/rwtest.file of=tmp.file bs=512 skip=1288 count=1
> 
> The code actually goes to below if statements.
> 
> Any idea what's wrong?

XFS maps unwritten extents as holes on read so that they are
correctly zeroed by the generic code. See this patch:

http://oss.sgi.com/archives/xfs/2007-07/msg00742.html

And the followup for why it should be done:

http://oss.sgi.com/archives/xfs/2007-07/msg00744.html

Sadly I was unable to convince anyone to take the patch, and so that
wart in XFS mapping behaviour still exists because the generic
readpage code still doesn't understand unwritten extents natively.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: xfs_io bmap confused
  2015-07-08 23:40     ` Ming Lin
@ 2015-07-09  6:54       ` Ming Lin
  2015-07-09 22:41         ` Dave Chinner
  0 siblings, 1 reply; 8+ messages in thread
From: Ming Lin @ 2015-07-09  6:54 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Wed, 2015-07-08 at 16:40 -0700, Ming Lin wrote:
> On Wed, 2015-07-08 at 06:57 -0700, Ming Lin wrote:
> > On Wed, 2015-07-08 at 10:53 +0200, Christoph Hellwig wrote:
> > > On Wed, Jul 08, 2015 at 12:01:53AM -0700, Ming Lin wrote:
> > > > Hi list,
> > > >
> > > > I am testing some direct-io patches.
> > > > xfs_tests/xfs/080 failed.
> > > >
> > > > It's strange.
> > > > There is no hole in "rwtest.file",
> > > > but when read it at some offset it returns zero because of hole.
> > > >
> > > > root@block:~# xfs_io -c bmap /mnt/test/rwtest.file
> > > > /mnt/test/rwtest.file:
> > > >              0: [0..125671]: 160..125831
> > >
> > > Sounds like you see an unwritten extent.  What does xfs_bmap -pv show on
> > > the file?
> >
> > root@block:~# xfs_bmap -pv /mnt/test/rwtest.file
> > /mnt/test/rwtest.file:
> >  EXT: FILE-OFFSET       BLOCK-RANGE      AG AG-OFFSET        TOTAL FLAGS
> >    0: [0..743]:         160..903          0 (160..903)         744 00000
> >    1: [744..783]:       904..943          0 (904..943)          40 10000
> >    2: [784..951]:       944..1111         0 (944..1111)        168 00000
> >    3: [952..1023]:      1112..1183        0 (1112..1183)        72 10000
> >    4: [1024..1287]:     1184..1447        0 (1184..1447)       264 00000
> >    5: [1288..1383]:     1448..1543        0 (1448..1543)        96 10000
> 
> file offset 659456 is in EXT 5.
> I guess FLAGS 1 means it's an unwritten extent, right?
> 
> xfs_tests/xfs/080 basically does:
> 1. direct io write
> 2. then buffered read to check the previous dio write
> 
> Here is an example of error logs.
> 
> doio ( 3626) 16:13:23
> ---------------------
> *** DATA COMPARISON ERROR ***
> check_file(/mnt/test/rwtest.file, 239616, 81408, H:3626:block:doio*,
> 18, 0) failed
> 
> Comparison fd is 5, with open flags 0
> Corrupt regions follow - unprintable chars are represented as '.'
> -----------------------------------------------------------------
> corrupt bytes starting at file offset 241664
>     1st 32 expected bytes:  oio*H:3626:block:doio*H:3626:blo
>     1st 32 actual bytes:    ................................
> 
> Request number 981
>           fd 4 is file /mnt/test/rwtest.file - open flags are 040001
> O_WRONLY,O_DIRECT,
>           write done at file offset 239616 - pattern is H (0110)
>           number of requests is 1, strides per request is 1
>           i/o byte count = 81408
>           memory alignment is aligned
>           DIRECT I/O: offset % 512 = 0 length % 81408 = 0
>           mem alignment 0x200 xfer size: small: 512 large: 2147483136
> 
> syscall:  writev(4, (iov on stack), 1)
> 
> 
> The "expected bytes" was actually written to the disk successfully,
> but for some bug the xfs extent flag was not set correctly.
> The flag should be "XFS_EXT_NORM", but now it's "XFS_EXT_UNWRITTEN".
> 
> Could you share the code path the extent flag was updated?
> Is it also updated through direct io?

For XFS direct IO, are below the only 2 paths to convert unwritten
extent to written extent?

[   72.279043] Call Trace:
[   72.279719]  [<ffffffff8169c2f3>] dump_stack+0x4f/0x7b
[   72.280898]  [<ffffffff8127140f>] xfs_bmapi_convert_unwritten+0x73/0x176
[   72.282393]  [<ffffffff8127a233>] xfs_bmapi_write+0x2a0/0x7ee
[   72.283705]  [<ffffffff812b8ae8>] xfs_iomap_write_direct+0x23e/0x2f0
[   72.285132]  [<ffffffff8129ef88>] __xfs_get_blocks+0x14c/0xf6c
[   72.286456]  [<ffffffff8103d74b>] ? get_user_pages_fast+0xee/0x14c
[   72.287847]  [<ffffffff8129fdcf>] xfs_get_blocks_direct+0x14/0x16
[   72.289246]  [<ffffffff811879c6>] get_blocks+0x86/0x182
[   72.297467]  [<ffffffff8103d74b>] ? get_user_pages_fast+0xee/0x14c
[   72.298845]  [<ffffffff81187fe6>] __blockdev_direct_IO+0x372/0x666
[   72.300266]  [<ffffffff8129fdbb>] ? xfs_get_blocks+0x13/0x13
[   72.301555]  [<ffffffff8116f9ac>] ? __mnt_drop_write_file+0x12/0x14
[   72.302936]  [<ffffffff8116a017>] ? file_update_time+0xb5/0xcb
[   72.304279]  [<ffffffff8129d890>] xfs_vm_direct_IO+0x89/0x90
[   72.305555]  [<ffffffff8129d943>] ? xfs_setfilesize_trans_alloc+0xac/0xac
[   72.307064]  [<ffffffff8169ae5e>] xfs_file_dio_aio_write+0x2e0/0x449
[   72.308509]  [<ffffffff813e1028>] ? __clear_user+0x36/0x5b
[   72.309755]  [<ffffffff812af9c6>] xfs_file_write_iter+0x75/0x105
[   72.311107]  [<ffffffff81151524>] __vfs_write+0x97/0xc0
[   72.312347]  [<ffffffff81151b1f>] vfs_write+0xb5/0x16f
[   72.313526]  [<ffffffff811522c3>] SyS_write+0x4a/0x94
[   72.314683]  [<ffffffff816a4b17>] system_call_fastpath+0x12/0x6f


[   72.328096] Call Trace:
[   72.328786]  [<ffffffff8169c2f3>] dump_stack+0x4f/0x7b
[   72.330002]  [<ffffffff8127140f>] xfs_bmapi_convert_unwritten+0x73/0x176
[   72.331565]  [<ffffffff8126cd9d>] ? xfs_bmap_search_extents+0x60/0xd6
[   72.333059]  [<ffffffff812c96f1>] ? kmem_zone_alloc+0x6e/0xba
[   72.334412]  [<ffffffff8127a233>] xfs_bmapi_write+0x2a0/0x7ee
[   72.335777]  [<ffffffff812b9455>] xfs_iomap_write_unwritten+0x205/0x413
[   72.337300]  [<ffffffff8129d7e2>] xfs_end_io+0x50/0x75
[   72.338495]  [<ffffffff8129dab9>] xfs_end_io_direct_write+0x176/0x26c
[   72.339952]  [<ffffffff810d20a4>] ? delayacct_end+0x55/0x5e
[   72.341238]  [<ffffffff8118759d>] dio_complete+0x7c/0x134
[   72.342488]  [<ffffffff811882a7>] __blockdev_direct_IO+0x633/0x666
[   72.343908]  [<ffffffff8129fdbb>] ? xfs_get_blocks+0x13/0x13
[   72.345263]  [<ffffffff8129d890>] xfs_vm_direct_IO+0x89/0x90
[   72.346598]  [<ffffffff8129d943>] ? xfs_setfilesize_trans_alloc+0xac/0xac
[   72.348185]  [<ffffffff8169ae5e>] xfs_file_dio_aio_write+0x2e0/0x449
[   72.349652]  [<ffffffff813e1028>] ? __clear_user+0x36/0x5b
[   72.350950]  [<ffffffff812af9c6>] xfs_file_write_iter+0x75/0x105
[   72.352369]  [<ffffffff81151524>] __vfs_write+0x97/0xc0
[   72.353607]  [<ffffffff81151b1f>] vfs_write+0xb5/0x16f
[   72.354832]  [<ffffffff811522c3>] SyS_write+0x4a/0x94
[   72.356060]  [<ffffffff816a4b17>] system_call_fastpath+0x12/0x6f



_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: xfs_io bmap confused
  2015-07-09  6:54       ` Ming Lin
@ 2015-07-09 22:41         ` Dave Chinner
  2015-07-09 23:28           ` Ming Lin
  0 siblings, 1 reply; 8+ messages in thread
From: Dave Chinner @ 2015-07-09 22:41 UTC (permalink / raw)
  To: Ming Lin; +Cc: Christoph Hellwig, xfs

On Wed, Jul 08, 2015 at 11:54:04PM -0700, Ming Lin wrote:
> On Wed, 2015-07-08 at 16:40 -0700, Ming Lin wrote:
> > On Wed, 2015-07-08 at 06:57 -0700, Ming Lin wrote:
> > > On Wed, 2015-07-08 at 10:53 +0200, Christoph Hellwig wrote:
> > > > On Wed, Jul 08, 2015 at 12:01:53AM -0700, Ming Lin wrote:
> > > > > Hi list,
> > > > >
> > > > > I am testing some direct-io patches.
> > > > > xfs_tests/xfs/080 failed.
> > > > >
> > > > > It's strange.
> > > > > There is no hole in "rwtest.file",
> > > > > but when read it at some offset it returns zero because of hole.
> > > > >
> > > > > root@block:~# xfs_io -c bmap /mnt/test/rwtest.file
> > > > > /mnt/test/rwtest.file:
> > > > >              0: [0..125671]: 160..125831
> > > >
> > > > Sounds like you see an unwritten extent.  What does xfs_bmap -pv show on
> > > > the file?
> > >
> > > root@block:~# xfs_bmap -pv /mnt/test/rwtest.file
> > > /mnt/test/rwtest.file:
> > >  EXT: FILE-OFFSET       BLOCK-RANGE      AG AG-OFFSET        TOTAL FLAGS
> > >    0: [0..743]:         160..903          0 (160..903)         744 00000
> > >    1: [744..783]:       904..943          0 (904..943)          40 10000
> > >    2: [784..951]:       944..1111         0 (944..1111)        168 00000
> > >    3: [952..1023]:      1112..1183        0 (1112..1183)        72 10000
> > >    4: [1024..1287]:     1184..1447        0 (1184..1447)       264 00000
> > >    5: [1288..1383]:     1448..1543        0 (1448..1543)        96 10000
> > 
> > file offset 659456 is in EXT 5.
> > I guess FLAGS 1 means it's an unwritten extent, right?
> > 
> > xfs_tests/xfs/080 basically does:
> > 1. direct io write
> > 2. then buffered read to check the previous dio write
> > 
> > Here is an example of error logs.
> > 
> > doio ( 3626) 16:13:23
> > ---------------------
> > *** DATA COMPARISON ERROR ***
> > check_file(/mnt/test/rwtest.file, 239616, 81408, H:3626:block:doio*,
> > 18, 0) failed
> > 
> > Comparison fd is 5, with open flags 0
> > Corrupt regions follow - unprintable chars are represented as '.'
> > -----------------------------------------------------------------
> > corrupt bytes starting at file offset 241664
> >     1st 32 expected bytes:  oio*H:3626:block:doio*H:3626:blo
> >     1st 32 actual bytes:    ................................
> > 
> > Request number 981
> >           fd 4 is file /mnt/test/rwtest.file - open flags are 040001
> > O_WRONLY,O_DIRECT,
> >           write done at file offset 239616 - pattern is H (0110)
> >           number of requests is 1, strides per request is 1
> >           i/o byte count = 81408
> >           memory alignment is aligned
> >           DIRECT I/O: offset % 512 = 0 length % 81408 = 0
> >           mem alignment 0x200 xfer size: small: 512 large: 2147483136
> > 
> > syscall:  writev(4, (iov on stack), 1)
> > 
> > 
> > The "expected bytes" was actually written to the disk successfully,
> > but for some bug the xfs extent flag was not set correctly.
> > The flag should be "XFS_EXT_NORM", but now it's "XFS_EXT_UNWRITTEN".
> > 
> > Could you share the code path the extent flag was updated?
> > Is it also updated through direct io?
> 
> For XFS direct IO, are below the only 2 paths to convert unwritten
> extent to written extent?
> 
> [   72.279043] Call Trace:
> [   72.279719]  [<ffffffff8169c2f3>] dump_stack+0x4f/0x7b
> [   72.280898]  [<ffffffff8127140f>] xfs_bmapi_convert_unwritten+0x73/0x176
> [   72.282393]  [<ffffffff8127a233>] xfs_bmapi_write+0x2a0/0x7ee
> [   72.283705]  [<ffffffff812b8ae8>] xfs_iomap_write_direct+0x23e/0x2f0
> [   72.285132]  [<ffffffff8129ef88>] __xfs_get_blocks+0x14c/0xf6c
> [   72.286456]  [<ffffffff8103d74b>] ? get_user_pages_fast+0xee/0x14c
> [   72.287847]  [<ffffffff8129fdcf>] xfs_get_blocks_direct+0x14/0x16
> [   72.289246]  [<ffffffff811879c6>] get_blocks+0x86/0x182
> [   72.297467]  [<ffffffff8103d74b>] ? get_user_pages_fast+0xee/0x14c
> [   72.298845]  [<ffffffff81187fe6>] __blockdev_direct_IO+0x372/0x666
> [   72.300266]  [<ffffffff8129fdbb>] ? xfs_get_blocks+0x13/0x13
> [   72.301555]  [<ffffffff8116f9ac>] ? __mnt_drop_write_file+0x12/0x14
> [   72.302936]  [<ffffffff8116a017>] ? file_update_time+0xb5/0xcb
> [   72.304279]  [<ffffffff8129d890>] xfs_vm_direct_IO+0x89/0x90
> [   72.305555]  [<ffffffff8129d943>] ? xfs_setfilesize_trans_alloc+0xac/0xac
> [   72.307064]  [<ffffffff8169ae5e>] xfs_file_dio_aio_write+0x2e0/0x449
> [   72.308509]  [<ffffffff813e1028>] ? __clear_user+0x36/0x5b
> [   72.309755]  [<ffffffff812af9c6>] xfs_file_write_iter+0x75/0x105
> [   72.311107]  [<ffffffff81151524>] __vfs_write+0x97/0xc0
> [   72.312347]  [<ffffffff81151b1f>] vfs_write+0xb5/0x16f
> [   72.313526]  [<ffffffff811522c3>] SyS_write+0x4a/0x94
> [   72.314683]  [<ffffffff816a4b17>] system_call_fastpath+0x12/0x6f

There should not be unwritten extent conversion happening through
the allocation path here. Indeed, xfs_iomap_write_direct() only uses
the XFS_BMAPI_PREALLOC flag, which means
xfs_bmapi_convert_unwritten() returns without doing anything to the
newly allocated extent...

> [   72.328096] Call Trace:
> [   72.328786]  [<ffffffff8169c2f3>] dump_stack+0x4f/0x7b
> [   72.330002]  [<ffffffff8127140f>] xfs_bmapi_convert_unwritten+0x73/0x176
> [   72.331565]  [<ffffffff8126cd9d>] ? xfs_bmap_search_extents+0x60/0xd6
> [   72.333059]  [<ffffffff812c96f1>] ? kmem_zone_alloc+0x6e/0xba
> [   72.334412]  [<ffffffff8127a233>] xfs_bmapi_write+0x2a0/0x7ee
> [   72.335777]  [<ffffffff812b9455>] xfs_iomap_write_unwritten+0x205/0x413
> [   72.337300]  [<ffffffff8129d7e2>] xfs_end_io+0x50/0x75
> [   72.338495]  [<ffffffff8129dab9>] xfs_end_io_direct_write+0x176/0x26c
> [   72.339952]  [<ffffffff810d20a4>] ? delayacct_end+0x55/0x5e
> [   72.341238]  [<ffffffff8118759d>] dio_complete+0x7c/0x134
> [   72.342488]  [<ffffffff811882a7>] __blockdev_direct_IO+0x633/0x666
> [   72.343908]  [<ffffffff8129fdbb>] ? xfs_get_blocks+0x13/0x13
> [   72.345263]  [<ffffffff8129d890>] xfs_vm_direct_IO+0x89/0x90
> [   72.346598]  [<ffffffff8129d943>] ? xfs_setfilesize_trans_alloc+0xac/0xac
> [   72.348185]  [<ffffffff8169ae5e>] xfs_file_dio_aio_write+0x2e0/0x449
> [   72.349652]  [<ffffffff813e1028>] ? __clear_user+0x36/0x5b
> [   72.350950]  [<ffffffff812af9c6>] xfs_file_write_iter+0x75/0x105
> [   72.352369]  [<ffffffff81151524>] __vfs_write+0x97/0xc0
> [   72.353607]  [<ffffffff81151b1f>] vfs_write+0xb5/0x16f
> [   72.354832]  [<ffffffff811522c3>] SyS_write+0x4a/0x94
> [   72.356060]  [<ffffffff816a4b17>] system_call_fastpath+0x12/0x6f

This is the only unwritten conversion path that should occur through
direct IO - the IO completion path....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: xfs_io bmap confused
  2015-07-09 22:41         ` Dave Chinner
@ 2015-07-09 23:28           ` Ming Lin
  0 siblings, 0 replies; 8+ messages in thread
From: Ming Lin @ 2015-07-09 23:28 UTC (permalink / raw)
  To: Dave Chinner; +Cc: Christoph Hellwig, xfs

On Thu, Jul 9, 2015 at 3:41 PM, Dave Chinner <david@fromorbit.com> wrote:
> On Wed, Jul 08, 2015 at 11:54:04PM -0700, Ming Lin wrote:
>> On Wed, 2015-07-08 at 16:40 -0700, Ming Lin wrote:
>> > On Wed, 2015-07-08 at 06:57 -0700, Ming Lin wrote:
>> > > On Wed, 2015-07-08 at 10:53 +0200, Christoph Hellwig wrote:
>> > > > On Wed, Jul 08, 2015 at 12:01:53AM -0700, Ming Lin wrote:
>> > > > > Hi list,
>> > > > >
>> > > > > I am testing some direct-io patches.
>> > > > > xfs_tests/xfs/080 failed.
>> > > > >
>> > > > > It's strange.
>> > > > > There is no hole in "rwtest.file",
>> > > > > but when read it at some offset it returns zero because of hole.
>> > > > >
>> > > > > root@block:~# xfs_io -c bmap /mnt/test/rwtest.file
>> > > > > /mnt/test/rwtest.file:
>> > > > >              0: [0..125671]: 160..125831
>> > > >
>> > > > Sounds like you see an unwritten extent.  What does xfs_bmap -pv show on
>> > > > the file?
>> > >
>> > > root@block:~# xfs_bmap -pv /mnt/test/rwtest.file
>> > > /mnt/test/rwtest.file:
>> > >  EXT: FILE-OFFSET       BLOCK-RANGE      AG AG-OFFSET        TOTAL FLAGS
>> > >    0: [0..743]:         160..903          0 (160..903)         744 00000
>> > >    1: [744..783]:       904..943          0 (904..943)          40 10000
>> > >    2: [784..951]:       944..1111         0 (944..1111)        168 00000
>> > >    3: [952..1023]:      1112..1183        0 (1112..1183)        72 10000
>> > >    4: [1024..1287]:     1184..1447        0 (1184..1447)       264 00000
>> > >    5: [1288..1383]:     1448..1543        0 (1448..1543)        96 10000
>> >
>> > file offset 659456 is in EXT 5.
>> > I guess FLAGS 1 means it's an unwritten extent, right?
>> >
>> > xfs_tests/xfs/080 basically does:
>> > 1. direct io write
>> > 2. then buffered read to check the previous dio write
>> >
>> > Here is an example of error logs.
>> >
>> > doio ( 3626) 16:13:23
>> > ---------------------
>> > *** DATA COMPARISON ERROR ***
>> > check_file(/mnt/test/rwtest.file, 239616, 81408, H:3626:block:doio*,
>> > 18, 0) failed
>> >
>> > Comparison fd is 5, with open flags 0
>> > Corrupt regions follow - unprintable chars are represented as '.'
>> > -----------------------------------------------------------------
>> > corrupt bytes starting at file offset 241664
>> >     1st 32 expected bytes:  oio*H:3626:block:doio*H:3626:blo
>> >     1st 32 actual bytes:    ................................
>> >
>> > Request number 981
>> >           fd 4 is file /mnt/test/rwtest.file - open flags are 040001
>> > O_WRONLY,O_DIRECT,
>> >           write done at file offset 239616 - pattern is H (0110)
>> >           number of requests is 1, strides per request is 1
>> >           i/o byte count = 81408
>> >           memory alignment is aligned
>> >           DIRECT I/O: offset % 512 = 0 length % 81408 = 0
>> >           mem alignment 0x200 xfer size: small: 512 large: 2147483136
>> >
>> > syscall:  writev(4, (iov on stack), 1)
>> >
>> >
>> > The "expected bytes" was actually written to the disk successfully,
>> > but for some bug the xfs extent flag was not set correctly.
>> > The flag should be "XFS_EXT_NORM", but now it's "XFS_EXT_UNWRITTEN".
>> >
>> > Could you share the code path the extent flag was updated?
>> > Is it also updated through direct io?
>>
>> For XFS direct IO, are below the only 2 paths to convert unwritten
>> extent to written extent?
>>
>> [   72.279043] Call Trace:
>> [   72.279719]  [<ffffffff8169c2f3>] dump_stack+0x4f/0x7b
>> [   72.280898]  [<ffffffff8127140f>] xfs_bmapi_convert_unwritten+0x73/0x176
>> [   72.282393]  [<ffffffff8127a233>] xfs_bmapi_write+0x2a0/0x7ee
>> [   72.283705]  [<ffffffff812b8ae8>] xfs_iomap_write_direct+0x23e/0x2f0
>> [   72.285132]  [<ffffffff8129ef88>] __xfs_get_blocks+0x14c/0xf6c
>> [   72.286456]  [<ffffffff8103d74b>] ? get_user_pages_fast+0xee/0x14c
>> [   72.287847]  [<ffffffff8129fdcf>] xfs_get_blocks_direct+0x14/0x16
>> [   72.289246]  [<ffffffff811879c6>] get_blocks+0x86/0x182
>> [   72.297467]  [<ffffffff8103d74b>] ? get_user_pages_fast+0xee/0x14c
>> [   72.298845]  [<ffffffff81187fe6>] __blockdev_direct_IO+0x372/0x666
>> [   72.300266]  [<ffffffff8129fdbb>] ? xfs_get_blocks+0x13/0x13
>> [   72.301555]  [<ffffffff8116f9ac>] ? __mnt_drop_write_file+0x12/0x14
>> [   72.302936]  [<ffffffff8116a017>] ? file_update_time+0xb5/0xcb
>> [   72.304279]  [<ffffffff8129d890>] xfs_vm_direct_IO+0x89/0x90
>> [   72.305555]  [<ffffffff8129d943>] ? xfs_setfilesize_trans_alloc+0xac/0xac
>> [   72.307064]  [<ffffffff8169ae5e>] xfs_file_dio_aio_write+0x2e0/0x449
>> [   72.308509]  [<ffffffff813e1028>] ? __clear_user+0x36/0x5b
>> [   72.309755]  [<ffffffff812af9c6>] xfs_file_write_iter+0x75/0x105
>> [   72.311107]  [<ffffffff81151524>] __vfs_write+0x97/0xc0
>> [   72.312347]  [<ffffffff81151b1f>] vfs_write+0xb5/0x16f
>> [   72.313526]  [<ffffffff811522c3>] SyS_write+0x4a/0x94
>> [   72.314683]  [<ffffffff816a4b17>] system_call_fastpath+0x12/0x6f
>
> There should not be unwritten extent conversion happening through
> the allocation path here. Indeed, xfs_iomap_write_direct() only uses
> the XFS_BMAPI_PREALLOC flag, which means
> xfs_bmapi_convert_unwritten() returns without doing anything to the
> newly allocated extent...
>
>> [   72.328096] Call Trace:
>> [   72.328786]  [<ffffffff8169c2f3>] dump_stack+0x4f/0x7b
>> [   72.330002]  [<ffffffff8127140f>] xfs_bmapi_convert_unwritten+0x73/0x176
>> [   72.331565]  [<ffffffff8126cd9d>] ? xfs_bmap_search_extents+0x60/0xd6
>> [   72.333059]  [<ffffffff812c96f1>] ? kmem_zone_alloc+0x6e/0xba
>> [   72.334412]  [<ffffffff8127a233>] xfs_bmapi_write+0x2a0/0x7ee
>> [   72.335777]  [<ffffffff812b9455>] xfs_iomap_write_unwritten+0x205/0x413
>> [   72.337300]  [<ffffffff8129d7e2>] xfs_end_io+0x50/0x75
>> [   72.338495]  [<ffffffff8129dab9>] xfs_end_io_direct_write+0x176/0x26c
>> [   72.339952]  [<ffffffff810d20a4>] ? delayacct_end+0x55/0x5e
>> [   72.341238]  [<ffffffff8118759d>] dio_complete+0x7c/0x134
>> [   72.342488]  [<ffffffff811882a7>] __blockdev_direct_IO+0x633/0x666
>> [   72.343908]  [<ffffffff8129fdbb>] ? xfs_get_blocks+0x13/0x13
>> [   72.345263]  [<ffffffff8129d890>] xfs_vm_direct_IO+0x89/0x90
>> [   72.346598]  [<ffffffff8129d943>] ? xfs_setfilesize_trans_alloc+0xac/0xac
>> [   72.348185]  [<ffffffff8169ae5e>] xfs_file_dio_aio_write+0x2e0/0x449
>> [   72.349652]  [<ffffffff813e1028>] ? __clear_user+0x36/0x5b
>> [   72.350950]  [<ffffffff812af9c6>] xfs_file_write_iter+0x75/0x105
>> [   72.352369]  [<ffffffff81151524>] __vfs_write+0x97/0xc0
>> [   72.353607]  [<ffffffff81151b1f>] vfs_write+0xb5/0x16f
>> [   72.354832]  [<ffffffff811522c3>] SyS_write+0x4a/0x94
>> [   72.356060]  [<ffffffff816a4b17>] system_call_fastpath+0x12/0x6f
>
> This is the only unwritten conversion path that should occur through
> direct IO - the IO completion path....

There is a bug in the direct io rewrite patches.
I have fixed it here:
https://git.kernel.org/cgit/linux/kernel/git/mlin/linux.git/commit/?h=block-dio-rewrite&id=ceeccaa16

Thanks.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-07-09 23:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-08  7:01 xfs_io bmap confused Ming Lin
2015-07-08  8:53 ` Christoph Hellwig
2015-07-08 13:57   ` Ming Lin
2015-07-08 23:40     ` Ming Lin
2015-07-09  6:54       ` Ming Lin
2015-07-09 22:41         ` Dave Chinner
2015-07-09 23:28           ` Ming Lin
2015-07-09  2:07 ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox