diff options
author | David Woodhouse <David.Woodhouse@intel.com> | 2010-02-26 14:04:15 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-02-26 14:06:24 -0500 |
commit | a7790532f5b7358c33a6b1834dc2b318de209f31 (patch) | |
tree | 0ceb9e24b3f54cb5c8453fb5a218e2a94a0f1cce /fs/ext4/xattr.c | |
parent | 2764fb4244cc1bc08df3667924ca4a972e90ac70 (diff) | |
parent | 60b341b778cc2929df16c0a504c91621b3c6a4ad (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
The SmartMedia FTL code depends on new kfifo bits from 2.6.33
Diffstat (limited to 'fs/ext4/xattr.c')
-rw-r--r-- | fs/ext4/xattr.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index 910bf9a59cb3..f3a2f7ed45aa 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c | |||
@@ -92,7 +92,7 @@ static struct buffer_head *ext4_xattr_cache_find(struct inode *, | |||
92 | struct mb_cache_entry **); | 92 | struct mb_cache_entry **); |
93 | static void ext4_xattr_rehash(struct ext4_xattr_header *, | 93 | static void ext4_xattr_rehash(struct ext4_xattr_header *, |
94 | struct ext4_xattr_entry *); | 94 | struct ext4_xattr_entry *); |
95 | static int ext4_xattr_list(struct inode *inode, char *buffer, | 95 | static int ext4_xattr_list(struct dentry *dentry, char *buffer, |
96 | size_t buffer_size); | 96 | size_t buffer_size); |
97 | 97 | ||
98 | static struct mb_cache *ext4_xattr_cache; | 98 | static struct mb_cache *ext4_xattr_cache; |
@@ -140,7 +140,7 @@ ext4_xattr_handler(int name_index) | |||
140 | ssize_t | 140 | ssize_t |
141 | ext4_listxattr(struct dentry *dentry, char *buffer, size_t size) | 141 | ext4_listxattr(struct dentry *dentry, char *buffer, size_t size) |
142 | { | 142 | { |
143 | return ext4_xattr_list(dentry->d_inode, buffer, size); | 143 | return ext4_xattr_list(dentry, buffer, size); |
144 | } | 144 | } |
145 | 145 | ||
146 | static int | 146 | static int |
@@ -325,7 +325,7 @@ ext4_xattr_get(struct inode *inode, int name_index, const char *name, | |||
325 | } | 325 | } |
326 | 326 | ||
327 | static int | 327 | static int |
328 | ext4_xattr_list_entries(struct inode *inode, struct ext4_xattr_entry *entry, | 328 | ext4_xattr_list_entries(struct dentry *dentry, struct ext4_xattr_entry *entry, |
329 | char *buffer, size_t buffer_size) | 329 | char *buffer, size_t buffer_size) |
330 | { | 330 | { |
331 | size_t rest = buffer_size; | 331 | size_t rest = buffer_size; |
@@ -335,9 +335,10 @@ ext4_xattr_list_entries(struct inode *inode, struct ext4_xattr_entry *entry, | |||
335 | ext4_xattr_handler(entry->e_name_index); | 335 | ext4_xattr_handler(entry->e_name_index); |
336 | 336 | ||
337 | if (handler) { | 337 | if (handler) { |
338 | size_t size = handler->list(inode, buffer, rest, | 338 | size_t size = handler->list(dentry, buffer, rest, |
339 | entry->e_name, | 339 | entry->e_name, |
340 | entry->e_name_len); | 340 | entry->e_name_len, |
341 | handler->flags); | ||
341 | if (buffer) { | 342 | if (buffer) { |
342 | if (size > rest) | 343 | if (size > rest) |
343 | return -ERANGE; | 344 | return -ERANGE; |
@@ -350,8 +351,9 @@ ext4_xattr_list_entries(struct inode *inode, struct ext4_xattr_entry *entry, | |||
350 | } | 351 | } |
351 | 352 | ||
352 | static int | 353 | static int |
353 | ext4_xattr_block_list(struct inode *inode, char *buffer, size_t buffer_size) | 354 | ext4_xattr_block_list(struct dentry *dentry, char *buffer, size_t buffer_size) |
354 | { | 355 | { |
356 | struct inode *inode = dentry->d_inode; | ||
355 | struct buffer_head *bh = NULL; | 357 | struct buffer_head *bh = NULL; |
356 | int error; | 358 | int error; |
357 | 359 | ||
@@ -376,7 +378,7 @@ ext4_xattr_block_list(struct inode *inode, char *buffer, size_t buffer_size) | |||
376 | goto cleanup; | 378 | goto cleanup; |
377 | } | 379 | } |
378 | ext4_xattr_cache_insert(bh); | 380 | ext4_xattr_cache_insert(bh); |
379 | error = ext4_xattr_list_entries(inode, BFIRST(bh), buffer, buffer_size); | 381 | error = ext4_xattr_list_entries(dentry, BFIRST(bh), buffer, buffer_size); |
380 | 382 | ||
381 | cleanup: | 383 | cleanup: |
382 | brelse(bh); | 384 | brelse(bh); |
@@ -385,8 +387,9 @@ cleanup: | |||
385 | } | 387 | } |
386 | 388 | ||
387 | static int | 389 | static int |
388 | ext4_xattr_ibody_list(struct inode *inode, char *buffer, size_t buffer_size) | 390 | ext4_xattr_ibody_list(struct dentry *dentry, char *buffer, size_t buffer_size) |
389 | { | 391 | { |
392 | struct inode *inode = dentry->d_inode; | ||
390 | struct ext4_xattr_ibody_header *header; | 393 | struct ext4_xattr_ibody_header *header; |
391 | struct ext4_inode *raw_inode; | 394 | struct ext4_inode *raw_inode; |
392 | struct ext4_iloc iloc; | 395 | struct ext4_iloc iloc; |
@@ -404,7 +407,7 @@ ext4_xattr_ibody_list(struct inode *inode, char *buffer, size_t buffer_size) | |||
404 | error = ext4_xattr_check_names(IFIRST(header), end); | 407 | error = ext4_xattr_check_names(IFIRST(header), end); |
405 | if (error) | 408 | if (error) |
406 | goto cleanup; | 409 | goto cleanup; |
407 | error = ext4_xattr_list_entries(inode, IFIRST(header), | 410 | error = ext4_xattr_list_entries(dentry, IFIRST(header), |
408 | buffer, buffer_size); | 411 | buffer, buffer_size); |
409 | 412 | ||
410 | cleanup: | 413 | cleanup: |
@@ -423,12 +426,12 @@ cleanup: | |||
423 | * used / required on success. | 426 | * used / required on success. |
424 | */ | 427 | */ |
425 | static int | 428 | static int |
426 | ext4_xattr_list(struct inode *inode, char *buffer, size_t buffer_size) | 429 | ext4_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size) |
427 | { | 430 | { |
428 | int i_error, b_error; | 431 | int i_error, b_error; |
429 | 432 | ||
430 | down_read(&EXT4_I(inode)->xattr_sem); | 433 | down_read(&EXT4_I(dentry->d_inode)->xattr_sem); |
431 | i_error = ext4_xattr_ibody_list(inode, buffer, buffer_size); | 434 | i_error = ext4_xattr_ibody_list(dentry, buffer, buffer_size); |
432 | if (i_error < 0) { | 435 | if (i_error < 0) { |
433 | b_error = 0; | 436 | b_error = 0; |
434 | } else { | 437 | } else { |
@@ -436,11 +439,11 @@ ext4_xattr_list(struct inode *inode, char *buffer, size_t buffer_size) | |||
436 | buffer += i_error; | 439 | buffer += i_error; |
437 | buffer_size -= i_error; | 440 | buffer_size -= i_error; |
438 | } | 441 | } |
439 | b_error = ext4_xattr_block_list(inode, buffer, buffer_size); | 442 | b_error = ext4_xattr_block_list(dentry, buffer, buffer_size); |
440 | if (b_error < 0) | 443 | if (b_error < 0) |
441 | i_error = 0; | 444 | i_error = 0; |
442 | } | 445 | } |
443 | up_read(&EXT4_I(inode)->xattr_sem); | 446 | up_read(&EXT4_I(dentry->d_inode)->xattr_sem); |
444 | return i_error + b_error; | 447 | return i_error + b_error; |
445 | } | 448 | } |
446 | 449 | ||
@@ -1329,6 +1332,8 @@ retry: | |||
1329 | goto cleanup; | 1332 | goto cleanup; |
1330 | kfree(b_entry_name); | 1333 | kfree(b_entry_name); |
1331 | kfree(buffer); | 1334 | kfree(buffer); |
1335 | b_entry_name = NULL; | ||
1336 | buffer = NULL; | ||
1332 | brelse(is->iloc.bh); | 1337 | brelse(is->iloc.bh); |
1333 | kfree(is); | 1338 | kfree(is); |
1334 | kfree(bs); | 1339 | kfree(bs); |